[Toybox] [landley/toybox] Add ln -r (#145)

Rob Landley rob at landley.net
Sun Oct 27 15:35:49 PDT 2019


On 10/26/19 1:17 PM, enh wrote:
>> P.S. And I need an xabspath(file, -2) variant that resolves everything except
>> the last path component,

Which is in now, I should do macros for the second constant ala DIRTREE and
MKPATHAT and HR _SPACE and such.

>> because that's what tar wants for this directory
>> replaces symlink thing. I need to resolve before calling unlink() so you can't
>> trick tar into deleting random stuff by following a symlink...
> 
> (see also the current realpath(1), which doesn't support -s or
> --relative-to, which i think will need realpath.c to switch to a
> home-grown implementation instead of realpath(3).)

I think the plumbing is there now?

It actually sounds like realpath might get merged into readlink.c because:

    Options for producing canonical paths (all symlinks/./.. resolved):

    -e  Canonical path to existing entry (fail if missing)
    -f  Full path (fail if directory missing)
    -m  Ignore missing entries, show where it would be
    -n  No trailing newline
    -q  Quiet (no output, just error code)

Is already doing most of it? (That's the one I use...)

Let's see, -e -m and -q are the same. But realpath has -L -s and -z which are
new, and -P which is a NOP? (Well, [-LP] maybe?) And then --relative-to I just
added plumbing for, and --relative-base needs to be implemented.

Hey Andrew: you wanted todo items,here's a fresh one if it looks interesting. :)

Rob



More information about the Toybox mailing list