From 7e3de5361ad4c8bbbe1000fbcf55e297815e1949 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 13 Dec 2025 01:54:14 +0300 Subject: [PATCH] libutil/tarfile: Mention pathname in warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fetching gcc-15.2.0.tar.gz I get a warning about UTF8 archive names. This now mentions problematic pathnames. warning: getting archive member 'gcc-15.2.0/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir/Äfoo.go': Pathname can't be converted from UTF-8 to current locale. warning: getting archive member 'gcc-15.2.0/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir/Ämain.go': Pathname can't be converted from UTF-8 to current locale. Also apparently libarchive depends on locale (yikes). Fixing reproducibility issues that stem from this is a separate issue. At least having the warning actually mention the pathname should be useful enough even though it's not actionable. At least using the default locale yields something sane: builtins.readDir "${gcc}/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir" { "Äfoo.go" = "regular"; "Ämain.go" = "regular"; } --- src/libutil/tarfile.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index 0757b3a81..e71c11037 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -136,7 +136,7 @@ static void extract_archive(TarArchive & archive, const std::filesystem::path & if (!name) throw Error("cannot get archive member name: %s", archive_error_string(archive.archive)); if (r == ARCHIVE_WARN) - warn(archive_error_string(archive.archive)); + warn("getting archive member '%1%': %2%", name, archive_error_string(archive.archive)); else archive.check(r); @@ -193,7 +193,7 @@ time_t unpackTarfileToSink(TarArchive & archive, ExtendedFileSystemObjectSink & throw Error("cannot get archive member name: %s", archive_error_string(archive.archive)); auto cpath = CanonPath{path}; if (r == ARCHIVE_WARN) - warn(archive_error_string(archive.archive)); + warn("getting archive member '%1%': %2%", path, archive_error_string(archive.archive)); else archive.check(r);