bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] tar-1.30: test 156 fails on FreeBSD due to iconv differences


From: Christian Weisgerber
Subject: [Bug-tar] tar-1.30: test 156 fails on FreeBSD due to iconv differences
Date: Mon, 30 Apr 2018 19:38:14 +0200
User-agent: Mutt/1.9.5 (2018-04-13)

On FreeBSD 11, I see this regression test failure with GNU tar 1.30:

156: sparse files with unicode names                 FAILED (sparse07.at:24)

See the testsuite.log at the end of this message.

This has nothing to do with sparse files.  It concerns unicode file
names in general.  The underlying problem appears to be a difference
between GNU iconv() and FreeBSD's iconv().  For a conversion from
UTF-8 to ASCII, GNU iconv() will return -1 and signal an error if
the input contains any characters that cannot be represented in
ASCII.  FreeBSD's iconv() replaces those characters with '?' and
returns the number of such substitutions.  This latter behavior is
in agreement with my reading of the POSIX standard on iconv().

The difference can be papered over with something like this...

--- src/utf8.c.orig     2018-04-30 17:25:34 UTC
+++ src/utf8.c
@@ -85,7 +85,7 @@ utf8_convert (bool to_utf, char const *i
   ib = (char ICONV_CONST *) input;
   rc = iconv (cd, &ib, &inlen, &ob, &outlen);
   *ob = 0;
-  return rc != -1;
+  return rc == 0;
 }

... but I'm uncertain if this doesn't have other consequences.
The regression tests pass fine with it.


------------------------------------------------------------------------
#                             -*- compilation -*-
156. sparse07.at:21: testing sparse files with unicode names ...
./sparse07.at:24:
mkdir posix
(cd posix
TEST_TAR_FORMAT=posix
export TEST_TAR_FORMAT
TAR_OPTIONS="-H posix"
export TAR_OPTIONS
rm -rf *

genfile --sparse --file žluť --block-size 512 0 ABCD 1M EFGH 2000K IJKL || exit 
77
tar -c -f archive --sparse žluť || exit 1

tar tf archive
)
--- -   2018-04-30 19:16:35.785125184 +0200
+++ 
/usr/ports/archivers/gtar/work/tar-1.30/tests/testsuite.dir/at-groups/156/stdout
    2018-04-30 19:16:35.784543000 +0200
@@ -1,2 +1,2 @@
-\305\276lu\305\245
+?lu?
 
156. sparse07.at:21: 156. sparse files with unicode names (sparse07.at:21): 
FAILED (sparse07.at:24)

-- 
Christian "naddy" Weisgerber                          address@hidden



reply via email to

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