From: UnixOS2 Archive To: "UnixOS2 Archive" Date: Mon, 13 Oct 2003 14:13:50 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [UnixOS2_Archive] No. 213 ************************************************** Sunday 12 October 2003 Number 213 ************************************************** Subjects for today 1 Interesting PATH info : Dave Saville" 2 Re: Interesting PATH info : Holger Veit 3 Re: Interesting PATH info : Holger Veit **= Email 1 ==========================** Date: Mon, 13 Oct 2003 17:59:01 +0100 (BST) From: "Dave Saville" Subject: Interesting PATH info At the moment I am having terrible trouble with an upgrade - this is OT for this group but in trouble shooting I found out something that *may* prove useful. I was checking my PATH statement in config.sys when I noticed that there was an entry with no drive specified. If I did a which foo.exe ( foo.exe being in the dir listed w/o the drive) it would work if cd'ed to the correct drive and not if anywhere else. It occurs to me that, at least for exe's but not unfortunately for dll's that one could have different versions of programs in say d:/usr/lib & E:/usr/lib. Have /usr/lib in the path w/o a drive and you would get whichever version by just switching drives and w/o having to mess with the path. Just a thought. -- Regards Dave Saville **= Email 2 ==========================** Date: Mon, 13 Oct 2003 21:15:28 +0200 From: Holger Veit Subject: Re: Interesting PATH info On Mon, Oct 13, 2003 at 05:59:01PM +0100, Dave Saville wrote: > At the moment I am having terrible trouble with an upgrade - this is > OT for this group but in trouble shooting I found out something that > *may* prove useful. > > I was checking my PATH statement in config.sys when I noticed that > there was an entry with no drive specified. > > If I did a which foo.exe ( foo.exe being in the dir listed w/o the > drive) it would work if cd'ed to the correct drive and not if > anywhere else. > > It occurs to me that, at least for exe's but not unfortunately for > dll's that one could have different versions of programs in say > d:/usr/lib & E:/usr/lib. Have /usr/lib in the path w/o a drive and > you would get whichever version by just switching drives and w/o > having to mess with the path. 'which' tries to canonicalize the path components, i.e. makes a full path including drive letter for the file in question. If a path component doesn't have a letter, the current drive is substituted, If tere is no path, i.e. you specified the dot '.' in the path, the current drive+current path is used. Doesn't seem to be too surprising to me, rather I'd have expected it to work this way. It is probably just surprising when you come from a system like Unix which doesn't have drive letters - the 'current path' logic still matches, though. Holger **= Email 3 ==========================** Date: Mon, 13 Oct 2003 21:15:28 +0200 From: Holger Veit Subject: Re: Interesting PATH info On Mon, Oct 13, 2003 at 05:59:01PM +0100, Dave Saville wrote: > At the moment I am having terrible trouble with an upgrade - this is > OT for this group but in trouble shooting I found out something that > *may* prove useful. > > I was checking my PATH statement in config.sys when I noticed that > there was an entry with no drive specified. > > If I did a which foo.exe ( foo.exe being in the dir listed w/o the > drive) it would work if cd'ed to the correct drive and not if > anywhere else. > > It occurs to me that, at least for exe's but not unfortunately for > dll's that one could have different versions of programs in say > d:/usr/lib & E:/usr/lib. Have /usr/lib in the path w/o a drive and > you would get whichever version by just switching drives and w/o > having to mess with the path. 'which' tries to canonicalize the path components, i.e. makes a full path including drive letter for the file in question. If a path component doesn't have a letter, the current drive is substituted, If tere is no path, i.e. you specified the dot '.' in the path, the current drive+current path is used. Doesn't seem to be too surprising to me, rather I'd have expected it to work this way. It is probably just surprising when you come from a system like Unix which doesn't have drive letters - the 'current path' logic still matches, though. Holger