Re: CVS commit: src/external/bsd/libarchive/dist/libarchive
Taylor R Campbell <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.userlevel |
|---|---|
| Message-ID | <[email protected]> |
> Date: Mon, 24 Aug 2026 14:01:17 +0000 > From: Taylor R Campbell <[email protected]> > > > Date: Mon, 24 Aug 2026 14:55:06 +0200 > > From: Thomas Klausner <[email protected]> > > > > Personally I'm not quite sure if I want a tar tool to convert between > > encodings. Is the base encoding included in the tar file? If not, how > > does the unpacking tar know how it should interpret the byte sequence? > > It could be EUC-JP for all we know. > > The archive in question is in POSIX pax interchange format, which has > _two paths_ for the file in question (written here in vis(3) > notation): > > - (pax extended header `path' attribute, always UTF-8) Correction: not `always UTF-8' -- rather, UTF-8 by default, unless overridden by hdrcharset. But there is no hdrcharset in this input, so we know the input is supposed to be UTF-8, not EUC-JP. Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/pax.html#tag_20_94_13_03 > (a) taking the pax extended header `path' attribute verbatim (which is > what I would guess, but have not verified, that GNU tar does), I reviewed the GNU tar code, and I believe that: 1. this is, in fact, what GNU tar does, but 2. the GNU tar authors may consider it a bug and intend to fix or at least change it in some way later. So I'm not sure the GNU tar behaviour is any more reliable than the earlier bsdtar behaviour. This is the subroutine in GNU tar that decodes the pax extended header `path' attribute (among other things), from src/xheader.c in v1.35 (commit e545d446dfe6564265cdf4186641ee76f4acc7fa): 1024 static void 1025 decode_string (char **string, char const *arg) 1026 { 1027 if (*string) 1028 { 1029 free (*string); 1030 *string = NULL; 1031 } 1032 if (!utf8_convert (false, arg, string)) 1033 { 1034 /* FIXME: report error and act accordingly to --pax invalid=UTF-8 */ 1035 assign_string (string, arg); 1036 } 1037 } https://cgit.git.savannah.gnu.org/cgit/tar.git/tree/src/xheader.c?h=v1.35&id=e545d446dfe6564265cdf4186641ee76f4acc7fa (assign_string under the hood boils down to strdup.)