freebsd tar fails but not gtar ?!?

Christian Weisgerber naddy at mips.inka.de
Sat Feb 3 19:35:08 UTC 2018


On 2018-01-30, "Dale Scott" <dalescott at shaw.ca> wrote:

> Hi all.  I noticed the tar backup of my WordPress content directory is
> failing.

How is it failing?  The "Can't translate pathname" messages you
quote are warnings, not errors.

> It?s been suggested that locale on the system
> isn?t set correctly. Does this sound familiar to anyone?

Well, when I take a file with UTF-8-encoded non-ASCII characters
in its name and tar it up in the POSIX locale, then I get the same
warning.  Clearly tar is trying to normalize path name encodings
in some way.  Unfortunately this is not documented.  My best guess
is that it tries to iconv(3) path names from the current locale
encoding to UTF-8.  If the path names are have an invalid encoding
in the current locale, iconv(3) fails, prompting the warning.

You can simply ignore the warnings.  If you extract the archive
under the same conditions as those when you created it, the path
names will be just fine.

Or you can make sure that the character encoding in your locale
setting matches those of the file names you are backing up.  Most
likely something like LC_CTYPE=en_US.UTF-8 will do.  If you don't
understand what I'm talking about, you might want to read up on
those topics.

> Next, native freebsd tar with --posix flag

That switches the archive format from the default ustar to pax,
says the man page, but you're not looking at an archive format
limitation.

> (google found some Linux posts that indicated pre-posix tar had
> a filename length limit)

Unless you are using a time machine to post from the 1980s, "old"
pre-POSIX tar is utterly irrelevant.

-- 
Christian "naddy" Weisgerber                          naddy at mips.inka.de


More information about the freebsd-questions mailing list