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

briggers at ninthfloor.org briggers at ninthfloor.org
Fri Jun 1 20:32:54 PDT 2012


On Fri, 1 Jun 2012, Rob Landley wrote:

> 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.

Great! I'll send in a patch adding -P and -L functionality to pwd in a 
day or so.

>
>> 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):

My bad, I didn't notice.

>
> 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.
>

 1338607974.0


More information about the Toybox mailing list