tar: Fix path encoding conversion error messages
Since commit 71c981a213 (Encoding: Fix potential encoding issues with
libarchive on Windows, 2014-06-12, v3.1.0-rc1~350^2) we use libarchive's
wide character APIs for entry paths. This works well on Windows where
this conversion expects UTF-8 and produces UTF-16. However, on
non-Windows platforms this conversion expects the locale's encoding.
Under `LANG=C` conversion may fail on paths using encodings such as
UTF-8, but we've been ignoring `ToWide` failure and passing empty paths
to libarchive. This causes incomplete diagnostics like "Can't lstat".
Restore use of libarchive's narrow APIs on non-Windows platforms. This
defers encoding conversions to libarchive, enabling better diagnostics
like "Can't translate Pathname '...' to UTF-8".
Issue: #26903
2 files changed