bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] 1.31: Test 162 (sparse07.at) fails on FreeBSD due to iconv() d


From: Christian Weisgerber
Subject: [Bug-tar] 1.31: Test 162 (sparse07.at) fails on FreeBSD due to iconv() differences
Date: Fri, 11 Jan 2019 19:25:16 +0100
User-agent: Mutt/1.11.2 (2019-01-07)

GNU tar 1.31's regression test #162 (sparse07.at) fails on FreeBSD
11 and 12.

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().

Tentative patch below.

I already reported this problem for 1.30.
https://lists.gnu.org/archive/html/bug-tar/2018-04/msg00019.html

When trying to reproduce this on FreeBSD, be careful that the tar
build does not pick up GNU libiconv if the latter happens to be
installed on the test system.  To force use of the native iconv(3),
set CPPFLAGS='-DLIBICONV_PLUG -isystem /usr/local/include'.

--- src/utf8.c.orig     2019-01-11 17:46:41 UTC
+++ src/utf8.c
@@ -81,7 +81,7 @@ utf8_convert (bool to_utf, char const *input, char **o
   outlen = inlen * MB_LEN_MAX + 1;
   ob = ret = xmalloc (outlen);
   ib = (char ICONV_CONST *) input;
-  if (iconv (cd, &ib, &inlen, &ob, &outlen) == -1)
+  if (iconv (cd, &ib, &inlen, &ob, &outlen) != 0)
     {
       free (ret);
       return false;
-- 
Christian "naddy" Weisgerber                          address@hidden

Attachment: testsuite.log
Description: Text document


reply via email to

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