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

Andrew Ilijic ilijic.andrew at gmail.com
Mon Nov 4 06:05:01 PST 2019


Just a quick update and some questions. I have `realpath` implemented
in the `readlink` file. I am using the `readlink` tests as a rough
template and working on implementing them and getting them to pass for
`realpath`.

http://man7.org/linux/man-pages/man1/realpath.1.html
http://man7.org/linux/man-pages/man1/readlink.1.html
I saw that options `-v` and `-z` were not implemented for `readlink`.
Do we want those options implemented? What about `-z` for `realpath`?
I noticed that only the long-form argument `--canonicalize` is turned
on. Do you want me to turn on the others?

~Andrew

On Sun, Oct 27, 2019 at 6:33 PM Rob Landley <rob at landley.net> wrote:
>
> 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