git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fail softly if file system does not like test data.

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Jan 31, 2007, 00:10 UTC
Message-ID
<200701310110.04429.robin.rosenberg.lists@dewire.com>
In-Reply-To
<20070130224446.28311.31828.stgit@lathund.dewire.com>
    Most unix file system allow almost any byte sequence, but other may reject
    sequences that are not valid according to the locale. This change makes
    failure somewhat less likely by using UTF-8-encoded characters and skips
    the test if the local file system does not support the test data.
    
    Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---

The first version of the patch had two errors. First it had a slash too much, then it did not clean up after test for applicability and then it was sent UTF-8 encoded which is wrong for non-utf8 systems. The patch is ment to actually have the UTF-8 byte sequences and not be translated (it should work regardless on most systems).

 t/t9200-git-cvsexportcommit.sh |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index fd0a554..d0d5365 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -169,20 +169,29 @@ test_expect_success \
       test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.2/-kb with spaces.txt/1.2/"
       )'
 
-# This test contains ISO-8859-1 characters
-test_expect_success \
-     'File with non-ascii file name' \
-     'mkdir -p �goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/���&&
-      echo Foo >�goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/���g�dets��det.txt &&
-      git add �goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/���g�dets��det.txt &&
-      cp ../test9200a.png �goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/���g�dets��det.png &&
-      git add �goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/���g�dets��det.png &&
-      git commit -a -m "G� det s�g� det" && \
-      id=$(git rev-list --max-count=1 HEAD) &&
-      (cd "$CVSWORK" &&
-      git-cvsexportcommit -v -c $id &&
-      test "$(echo $(sort �goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/���CVS/Entries|cut -d/ -f2,3,5))" = "g�dets��det.png/1.1/-kb g�dets��det.txt/1.1/"
-      )'
+# This test contains UTF-8 characters and may fail on some filesystems
+mkdir -p "å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" >/dev/null 2>&1
+if test $? -ne 0
+then
+    test_expect_success 'File with non-ascii file name skipped, file system is incompatible with test data' :
+    rm -rf "å"
+else
+    rm -rf "å"
+    test_expect_success \
+	'File with non-ascii file name' \
+	'(mkdir -p "å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" ||
+         echo "Local filesystem does not permit this test" ) &&
+         echo Foo >"å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt" &&
+         git add "å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt" &&
+         cp ../test9200a.png "å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png" &&
+         git add "å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png" &&
+         git commit -a -m "Går det så går det" && \
+         id=$(git rev-list --max-count=1 HEAD) &&
+         (cd "$CVSWORK" &&
+         git-cvsexportcommit -v -c $id &&
+         test "$(echo $(sort "å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/CVS/Entries"|cut -d/ -f2,3,5))" = "gårdetsågårdet.png/1.1/-kb gårdetsågårdet.txt/1.1/"
+         )'
+fi
 
 test_expect_success \
      'Mismatching patch should fail' \
Previous: Brian GernhardtNext: Junio C Hamano
Message 7 of 9 in “t9200-git-cvsexportcommit #8 failure on OS X”
  1. Brian GernhardtJan 30, 2007
  2. Robin RosenbergJan 30, 2007
  3. Fail softly if file system does not like test data.Robin Rosenberg, Jan 30, 2007
  4. Brian GernhardtJan 30, 2007
  5. Robin RosenbergJan 31, 2007
  6. Brian GernhardtJan 31, 2007
  7. Robin RosenbergJan 31, 2007
  8. Junio C HamanoJan 31, 2007
  9. Robin RosenbergJan 31, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.