tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: $ORIGIN (was: Re: make: ensure ${.MAKE} works)



On Apr 22,  5:02am, dholland-tech%netbsd.org@localhost (David Holland) wrote:
-- Subject: Re: $ORIGIN (was: Re: make: ensure ${.MAKE} works)

| I had convinced myself it was supposed to fail if it had to look
| outside the cache, but that's only true for the first step.

Correct. Or if someone removed it.

|  > I think what you propose is to call something like a
|  > kernel realpath(path) and use this to set $ORIGIN which is fine
|  > with me. I did not do it because I did not want to deal with path
|  > canonicalization (eliminating ../.././// from the path, but I guess
|  > that getcwd() does this for you if you call it with the full path?).
| 
| namei can already do enough of this to get by on (see for example
| svr4_sys_resolvepath() in sys/compat/svr4/svr4_misc.c) and exec is
| already using this (mis?)feature.

Yes.

| For the time being what we can do is take the path sent back from
| namei, and if it's not absolute call getcwd and graft that onto the
| front. This will in general yield a partially realpath'd path but I
| don't think anyone will care.

I agree, but remember to handle the emul root.

| In the long run I think a fully realpath'd path can be arranged,
| either by calling getcwd first and handing the results to namei to
| grind on, or by explicitly compacting any ..'s that appear in the
| front of the namei result. I sort of favor the first because it makes
| it possible to handle the emulation root properly, I think, but this
| can be discussed later on.

Yes, although I hate doing string manipulations in the kernel.

christos


Home | Main Index | Thread Index | Old Index