This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Realpath & context sensitive symlinks


On Thu, Sep 27, 2001 at 12:26:54PM -0700, Paul Eggert wrote:
> > Date: Thu, 27 Sep 2001 15:03:12 -0400
> > From: Daniel Jacobowitz <drow@mvista.com>
> > 
> > On Thu, Sep 27, 2001 at 11:57:11AM -0700, Paul Eggert wrote:
> > > Realpath could invoke the 'resolvepath' system call, if it is available.
> > > That would be more reliable than the chdir/getcwd hack that you suggested.
> > 
> > I can certainly see it being more elegant, but in what way is it more
> > reliable?
> 
> chdir, getcwd, and chdir back can be interrupted (which means that
> your signal handler will run in the wrong directory), or can fail for
> reasons unrelated to the realpath (e.g. you may not be able to chdir
> back -- then what do you do?).

Ah, I see.  Thanks.  We can do this without chdir; it's just a little
more complicated to do.  stat("symlinkpath"), then
opendir("symlinkpath/.."), and then walk through the directory looking
for the entry with the same inode as stat("symlinkpath") returned.
That's hideously time-consuming, of course...

> How about getting resolvepath into Linux?  I think you can build a
> good case for it.

Sure, but that doesn't really solve the problem of it not existing
already - requiring a brand-new kernel for a functionality as basic as
resolvepath is somewhat impractical.  Still, this sounds like a good
idea.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]