[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tarlz: error archiving broken symbolic link

From: Antonio Diaz Diaz
Subject: Re: tarlz: error archiving broken symbolic link
Date: Wed, 09 Mar 2022 17:56:34 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv: Gecko/20110420 SeaMonkey/2.0.14

Jason Lenz wrote:
Output from ls -l on fuse:
lrwxrwxrwx 1 lenzj users 0 Nov 11 10:59 broken_symlink_filename -> ..

Output from ls -l on ext4:
lrwxrwxrwx 1 lenzj users 120 Nov 11 10:59 broken_symlink_filename -> ..

So in other words, the fuse filesystem is showing the size of all the
symlink files as zero vs. a size of something greater than zero on the
ext4 system.

Thank you for investigating this. It looks like a bug in fuse which reports 0 in st_size for broken symlinks (at least). This does not meet POSIX's description of 'struct stat':

   off_t st_size           For regular files, the file size in bytes.
                           For symbolic links, the length in bytes of the
                           pathname contained in the symbolic link.

and GNU tar says:

   55   /* Some buggy file systems report garbage in st_size.  Defend
   56      against them by ignoring outlandish st_size values in the initial
   57      memory allocation.  */

and then enters an horribly complicated loop malloc'ing and realloc'ing a buffer until the output of readlink fits in it.

I really do not want to do such things in tarlz. GNU tar aims at working everywhere (and supporting all tar formats), but I just want tarlz to work correctly on well-behaved systems. I think I'll just make tarlz emit a diagnostic when it finds a symlink with a st_size of 0.

This seems like something the restic development team probably needs to
fix on their fuse system implementation, but admittedly I'm not an expert
on how fuse systems work. I will reach out to them to see if indeed this
is something they can/should fix.

Thank you. Fixing their fuse filesystem implementation is the best solution. It would spare other tools from working around the bug, and would even make GNU tar more efficient at reading symlinks (no need to loop).

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]