On 05/17/2014 01:03 AM, Bernhard Voelker wrote:
> On 05/16/2014 11:02 PM, Pádraig Brady wrote:
>> Pushed.
>
> Sorry, a bit late ...
>
>> + /* Only do chroot specific actions if actually changing root.
>> + The main difference here is that we don't change working dir. */
>> + if (! STREQ (argv[optind], "/"))
>
> What about canonicalizing argv[optind] ?
> Or do we want the ability to force chroot(2) like this:
>
> $ src/chroot / env pwd
> /home/berny/git/coreutils
>
> $ src/chroot /. env pwd
> src/chroot: cannot change root directory to /.: Operation not permitted
>
> Probably this might be bit confusing - while some other guys
> might use this difference to check for superuser privileges ...
> ... and fall over once we'll fix this.
Yes I wasn't sure about that.
Better to canonicalize for consistency I suppose.
If one does want to chdir("/") that can be done externally and inherited.
thanks,
Pádraig.