[Toybox] [PATCH] tar: Fix support for long symbolic links

Rob Landley rob at landley.net
Thu Mar 21 15:56:17 PDT 2019


On 3/21/19 5:08 PM, Rob Landley wrote:
> P.S. Plenty of todos that aren't in the file, those were just notes on lines of
> code as I was going past. For example, I'm adding an xabspath() constraint where
> each name it's about to create has to fit under the top level directory it's
> exracting under, that's why I'm storing the abspath of cwd in main. This
> _doesn't_ apply to symlinks but _does_ apply to hardlinks. And then there's the
> whole sparse file can of worms, and xattr/selinux support.

Speaking of which, piece of lib/args.c infrastructure plumbing I've been
pondering: there are a lot of "-no-thingy" flags that switch off "-thingy"
flags, I can add a punctuation indicator at the start of the optflag string so
any flag can be switched off by the relevant -no flag automatically.

BUT that leaves a hole where the flag defaults to on and the -no turns it _off_,
which is the case for tar's -no-same-owner when run as root. I can add another
marker for "this flag defaults on when user is root", or I could add a
TOYFLAG_DEFER_ARGS so the main() function can call get_optflags() itself (after
doing flag setup)...

Hmmm, what I should _really_ do is triage all the main() functions and see what
leftover manual processing we do with the options now, and if any of that is
amenable to genericization...

Rob


More information about the Toybox mailing list