[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 6ddb0fa 25/33: Rework a 'wine' workaround aga
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 6ddb0fa 25/33: Rework a 'wine' workaround again |
Date: |
Mon, 3 May 2021 08:15:55 -0400 (EDT) |
branch: master
commit 6ddb0fad1ecfc533f4828f391b6c72dd9ea52163
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rework a 'wine' workaround again
Cf. commits
26dd8aa5c0b40
6d8e4f143e069
fbb5aacf5eaf4
Felicitously, perhaps, some versions of 'wine' happen to choke on a
'....' path, and wind up producing an outcome that is reasonable.
This exotic edge case is not an lmi error and no sane end user would
encounter it. Using the insights recorded here, the whole matter can
be revisited someday if desired.
---
path_utility_test.cpp | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/path_utility_test.cpp b/path_utility_test.cpp
index 787299a..52a3b3b 100644
--- a/path_utility_test.cpp
+++ b/path_utility_test.cpp
@@ -336,16 +336,31 @@ void test_unique_filepath_with_ludicrous_filenames()
// represents a '.' extension-delimiter followed by an extension
// consisting of a single '.'. When fs::replace_extension() is
// called by unique_filepath() here, adding that extension to ".."
- // yields "...." path, which won't work if it is actually used by msw,
- // but is still allowed (although of course discouraged).
- if(running_under_wine())
+ // yields "....".
+
+ fs::path pathx = {".."};
+ LMI_TEST_EQUAL("..", pathx.string());
+ LMI_TEST_EQUAL("" , pathx.extension().string());
+ pathx.replace_extension(pathx);
+ LMI_TEST_EQUAL("....", pathx.string());
+
+ // Such a pathname is forbidden by msw, yet allowed (although of
+ // course discouraged) by posix; but those are semantic rules,
+ // which std::filesystem doesn't try to enforce. However, if
+ // unique_filepath() decides that such a file exists, then it
+ // tries to remove it; and if that fails, then it appends a
+ // timestamp to render it unique. That exceptional behavior is
+ // observed only with (certain versions of) 'wine'.
+
+ fs::path path3 = unique_filepath(fs::path(".."), "..");
+
+ if(running_under_wine() && "...." != path3.string())
{
- std::cout << "TEST SKIPPED DUE TO A PRESUMED WINE DEFECT" << std::endl;
+ std::cout << "\n'wine' did something extraordinary" << std::endl;
}
else
{
- fs::path path3 = unique_filepath(fs::path(".."), "..");
- LMI_TEST_EQUAL(path3.string(), "....");
+ LMI_TEST_EQUAL("....", path3.string());
}
}
- [lmi-commits] [lmi] master 4ab2c4e 20/33: Further improve modify_directory() documentation, (continued)
- [lmi-commits] [lmi] master 4ab2c4e 20/33: Further improve modify_directory() documentation, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master b64436f 19/33: Improve modify_directory() documentation and tests, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 0e3d61a 21/33: Rework modify_directory() documentation; augment unit test, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 40096c3 24/33: Conserve 70-character comment width, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 4473403 29/33: Improve output spacing, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master bc805ad 28/33: Augment path-validation unit test, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 6fd9f69 32/33: Remove the last occurrence of /name.check/, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 0c2d6b4 30/33: Revert "Revert "Trap exceptions from filesystem library"", Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master bfa1255 27/33: Enable some tests that were conditionally suppressed, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 8538df8 31/33: Improve unit tests and their documentation, Greg Chicares, 2021/05/03
- [lmi-commits] [lmi] master 6ddb0fa 25/33: Rework a 'wine' workaround again,
Greg Chicares <=
- [lmi-commits] [lmi] master 0296ac4 33/33: Deboostify still more, Greg Chicares, 2021/05/03