[OpenAFS-devel] Re: solaris 10: chdir("/") after chroot(path) returns ENOENT

Douglas E. Engert deengert@anl.gov
Tue, 08 Jun 2010 11:05:23 -0500


On 6/8/2010 10:29 AM, Andrew Deason wrote:
> On Tue, 08 Jun 2010 09:20:51 -0400
> "Tony D'Amato"<tdamato@odu.edu>  wrote:
>
>> chdir(AFS_PATH);
>> chroot(AFS_PATH);
>> chdir("/");
>>
>> The problem is that the third call (chdir("/")) returns a ENOENT error.
>
> We're given an empty pathname component when this occurs, so we're
> looking up "" in the parent dir; afs_lookup can't cope with that. If I
> fake it so we pass in "." to afs_lookup when we detect this happening,
> it seems to work.
>
> Hmm, is something like that a plausible solution, or should afs_lookup
> just be made to interpret looking up a "" entry as looking up the
> directory itself?
>

Some other test results:
Using chdir("/.") works as well as chdir("/home") where
home is a symlink to .

The tests work on Solaris 9, but fail on Solaris 10. The results are the same
if the chroot is to the top level directory in a volume or a sub directory.

Sounds like your fix might work.

-- 

  Douglas E. Engert  <DEEngert@anl.gov>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444