[Toybox] [Suggestion] Add realpath to lib/lib.c

Rob Landley rob at landley.net
Fri Jun 1 19:10:19 PDT 2012


On 05/31/2012 01:08 PM, briggers wrote:
> Hi everyone,
> 
> lib/lib.c contains a bunch of simple wrappers around standard library
> functions(chdir, stat, getcwd etc.). If you could similarly wrap the
> realpath function[1], it would make implementing things like "pwd -P"
> trivial. It would only be a 3 line patch to add this to lib/lib.c.

You mean an xrealpath() that never returns failure, and error_exit()s
instead?

Yeah, all right... done.

> A major drawback though would be relying on PATH_MAX as being the
> maximum possible path length.
> 
> [1] http://pubs.opengroup.org/onlinepubs/009604499/functions/realpath.html

That's SUSv3 (2004), the current one is SUSv4 (2008):

http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

And for realpath(blah, NULL) size limitations on the returned buffer are
really libc's problem, not toybox's. It can be fixed there without us
changing our code.

Rob
-- 
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation.  Pick one.

 1338603019.0


More information about the Toybox mailing list