LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Tar keeps reporting 99 character limit despite using posix option (https://www.linuxquestions.org/questions/linux-software-2/tar-keeps-reporting-99-character-limit-despite-using-posix-option-4175578854/)

Cyrisse 05-02-2016 04:30 PM

Tar keeps reporting 99 character limit despite using posix option
 
Hi,

I'm using Ubuntu 14.04 with tar 1.27.1 to make daily backups.

I'm running a simple command like

Code:

tar -czf /tmp/webdev_backup.tgz *
That used to work fine, but since a few days, I'm suddenly getting many errors like

Code:

tar: bsa/wp-content/uploads/2014/09/copy-copy-cropped-copy-cropped-copy-cropped-cropped-header-musical1-1024x628.jpg: file name is too long (max 99); not dumped
So I learned that this is a limitation in the "gnu" format that this version of tar uses and using "ustar" or "posix" doesn't have this limitation.

So I tried all of the below:

Code:

tar --posix -czf /tmp/webdev_backup.tgz *
tar -czf --format=ustar /tmp/webdev_backup.tgz *
tar -czf --format=posix /tmp/webdev_backup.tgz *
tar -H posix -czf /tmp/webdev_backup.tgz *

But there's no change. I still get the errors. I couldn't find anyone having the same problem :-(.

I hope anyone has an idea for what might be wrong here... :-D

Thanks!

rigor 05-02-2016 06:13 PM

__________________________________________________

rigor 05-02-2016 07:22 PM

Here's fun
 
As I've illustrated further below, I'm using Ubuntu 14.04.3 and tar 1.27.1.

Code:

~/extern/lq.org/tar_w_very_long_filenames $  cat /etc/*elease
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
NAME="Ubuntu"
VERSION="14.04.3 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.3 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"


~/extern/lq.org/tar_w_very_long_filenames $  tar --version
tar (GNU tar) 1.27.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

AFAIK, the 99 char file name length limit is actually from the old v7 format.

If I put in my shell environment a variable that specifies options for tar, it can be overridden by a command line option. But ( it seems ) whether or not there is a slash specified on the command line as part of the path to the files to be archived, affects the operation as in the following sample runs.


Code:

/tmp/tar_w_vary_long_filenames$ export TAR_OPTIONS='--format=v7'


/tmp/tar_w_vary_long_filenames $  tar -czvf tar_file bsa/*
bsa/wp-content/
bsa/wp-content/uploads/
bsa/wp-content/uploads/2014/
bsa/wp-content/uploads/2014/09/
tar: bsa/wp-content/uploads/2014/09/a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-filename-indeed.txt: file name is too long (max 99); not dumped
tar: bsa/wp-content/uploads/2014/09/a_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename_indeed.txt: file name is too long (max 99); not dumped
tar: Exiting with failure status due to previous errors


/tmp/tar_w_vary_long_filenames$ tar -czvf tar_file *
a_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename_indeed.txt
bsa/
bsa/wp-content/
bsa/wp-content/uploads/
bsa/wp-content/uploads/2014/
bsa/wp-content/uploads/2014/09/
bsa/wp-content/uploads/2014/09/a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-filename-indeed.txt
bsa/wp-content/uploads/2014/09/a_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename_indeed.txt
tar_file


/tmp/tar_w_vary_long_filenames$ tar -czvf --format=posix tar_file *
tar_file
a_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename_indeed.txt
bsa/
bsa/wp-content/
bsa/wp-content/uploads/
bsa/wp-content/uploads/2014/
bsa/wp-content/uploads/2014/09/
bsa/wp-content/uploads/2014/09/a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-filename-indeed.txt
bsa/wp-content/uploads/2014/09/a_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename_indeed.txt
tar_file


/tmp/tar_w_vary_long_filenames$ tar -czvf --format=posix tar_file bsa/*
tar_file
bsa/wp-content/
bsa/wp-content/uploads/
bsa/wp-content/uploads/2014/
bsa/wp-content/uploads/2014/09/
tar: bsa/wp-content/uploads/2014/09/a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-filename-indeed.txt: file name is too long (max 99); not dumped
tar: bsa/wp-content/uploads/2014/09/a_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename_indeed.txt: file name is too long (max 99); not dumped
tar: Exiting with failure status due to previous errors
/tmp/tar_w_vary_long_filenames $


Cyrisse 05-03-2016 01:52 AM

Thanks Rigor!

I eventually figured it out. Using --posix *did* make the errors about 99 characters go away, but there were others (about not being able to split filenames - some were very long indeed, based on weird URLs) and I just removed those files. Then I bumped into more stuff with link names that were too long :-). I was able to remove the stuff that was causing that too, fortunately.

So in summary, it should just work indeed.


All times are GMT -5. The time now is 05:31 AM.