lmi-commits
[Top][All Lists]
Advanced

[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());
         }
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]