Re: [hackers] Add realpath utility

From: Brad Barden <>
Date: Fri, 20 Nov 2015 12:26:22 -0600

On Fri Nov 20, 2015 at 11:17:39AM +0000, Dimitris Papastamos wrote:
> I would prefer if readlink did not in itself support -e and -m. We
> can have realpathm() in libutil/ and use it for both realpath and tar.
> The reason is we cannot include shell scripts in sbase because of the
> sbase-box target.
> What do you think?

Is it just the shell script thing, or do you feel readlink shouldn't
have those options at all? The utilities are so much the same it seems a
waste not to provide both with all the options that something might
expect for nearly free, opposed to spending the extra effort to maintain
two utilities.

Not supporting the options does mean breaking that
might depend on them (e.g., I found "readlink -m" in template scripts
distributed with lxc). But if ignoring rare cases, why not drop realpath
altogether and just have one readlink utility cover it? But then
readlink gets all the flags again, and the user would have to implement
(quite easily) 'realpath' for themselves if they want.

Would it be reasonable to check basename of argv[0] in readlink to pick
default behavior? I've tried that locally, about 6 extra lines of code.
sbase-box makes that a bit of a pain, though. I handled it the same as
the [ -> test link. That feels awfully hacky, and the usage message
would kind of suck this way. It'd say like "[ realpath basename cal ..."
with realpath out of place.

I'm torn on what would be best.

Received on Fri Nov 20 2015 - 19:26:22 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 20 2015 - 19:36:12 CET