Multiple executables in path (Was: NON-SOURCE POSTINGS CONSIDERED HARMFUL!)

Paul Falstad pfalstad at phoenix.Princeton.EDU
Wed Jan 23 10:14:21 AEST 1991


kaul at icarus.eng.ohio-state.edu (Rich Kaul) wrote:
>In article <5570 at idunno.Princeton.EDU> pfalstad at phoenix.Princeton.EDU (Paul Falstad) writes:
>   tchrist at convex.COM (Tom Christiansen) wrote:
>   >From the keyboard of kaul at icarus.eng.ohio-state.edu (Rich Kaul):
>   >That's odd -- if you have unexpanded tildes in your environment,
>   >I wonder how you get system, popen, and execlp to work without
>   >changing the C library.
>   You don't, it seems.  At least it didn't work for me.  This is probably
>   a bug in bash.  You should use $HOME instead of ~ when you define
>   your PATH.
>Hmmm, I beg to disagree.  Also, $HOME is not appropriate when
>searching another user's directory, cf:

Yes, I know.  You'll have to expand ~name yourself.

>bash$ echo $PATH
>/usr/1/kaul/bin:/usr/1/kaul/bin/sun3:/usr/bin/X11:/usr/local/gnu/bin:/usr/local/bin:~octtools/bin:~cad/bin:/usr/ucb:/usr/bin:/usr/etc:.
>bash$ which magic
>/usr/1/cad/bin/magic
>bash$ magic
>(saying ~cad/bin/magic gives the same result).  Bash does the
>expansion of the ~ before running the program.  It is possible to

Fine, I agree this works.  That's not what Tom was talking about.

Here's a script that demonstrates the problem:  (BIFF is a filter I got
off the net, a la jive)

Script started on Tue Jan 22 18:06:38 1991
Z 1 phoenix:~/pub bash
bash$ PATH=/usr/ucb:/bin:/usr/bin:/usr/princeton/bin:~/bin/sun4
bash$ echo $PATH
/usr/ucb:/bin:/usr/bin:/usr/princeton/bin:~/bin/sun4
bash$ which BIFF
/n/uffda/b/pfalstad/bin/sun4/BIFF
bash$ ls | BIFF
101LAY0UT
CENTREX
CLIENTS
C0MMANDS
KEYREP
MEGAHACK
NEWPH0ENIX
PHXPEF
STRINGS
TYPESCRIPT
VI..REF.  K0WABUNGA D00DZ!!!7
--
BIFF at BIT.NET                                           BIFF at PSUVM.PSU.EDU
BIFF at BIFFVM.BIT.NET                                  BIFF+ at ANDREW.CMU.EDU
     BIFF at PSUVM.ANDREW.PORTAL.COM.XZ.US.RUTGERS.ARPA.BITNET.EDU.UUCP
 MAN!WOMAN!BIRTH!DEATH!INFINITI!ROCKS!TREES!BIT.NET!BIFF at UUNET.UU.NET.EDU
--
BIFF at BIT.NET                                           BIFF at PSUVM.PSU.EDU
BIFF at BIFFVM.BIT.NET                                  BIFF+ at ANDREW.CMU.EDU
     BIFF at PSUVM.ANDREW.PORTAL.COM.XZ.US.RUTGERS.ARPA.BITNET.EDU.UUCP
 MAN!WOMAN!BIRTH!DEATH!INFINITI!ROCKS!TREES!BIT.NET!BIFF at UUNET.UU.NET.EDU
bash$ mail
"/usr/spool/mail/pfalstad": 1 message 1 new
>N  1 pfalstad           Tue Jan 22 18:07   13/396   foo.
& | BIFF
Pipe to: "BIFF"
/bin/sh: BIFF: not found
"BIFF" 13/396
& q
Saved 1 message in /n/uffda/b/pfalstad/mbox
bash$ PATH=/usr/ucb:/bin:/usr/bin:/usr/princeton/bin:/u/pfalstad/bin/sun4
bash$ mail -f ~/mbox
"/n/uffda/b/pfalstad/mbox": 1 message
>   1 pfalstad           Tue Jan 22 18:07   14/407   foo.
& | BIFF
Pipe to: "BIFF"
FR0M PFALSTAD TUE JAN 22 18:07:27 1991
RECEIVED, L00K AT THIS D00DZ: FRUM B0W.  D0N"T HAVE A K0W!!! (THE SIMPSUNZ AR THU KULEST!)PRINCET0N.  C0WABUNGA!!!EDU BY PH0ENIX.PRINCET0N.  C0WABUNGA!!!EDU (4.1/1.106)
        ID AA08726; TUE, 22 JAN 91 18:07:27 EST
FR0M, L00K AT THIS D00DZ: PAUL FALSTAD <PFALSTAD>
RECEIVED, L00K AT THIS D00DZ: BY B0W.  D0N"T HAVE A K0W!!! (THE SIMPSUNZ AR THU KULEST!)PRINCET0N.  C0WABUNGA!!!EDU (4.1/CS_002_CLUSTUR_CLIENT)
        ID AA02829; TUE, 22 JAN 91 18:07:25 EST
DATE, L00K AT THIS D00DZ: TUE, 22 JAN 91 18:07:25 EST
MESSAGE-ID, L00K AT THIS D00DZ: <9101222307.AA02829 at B0W.  D0N"T HAVE A K0W!!! (THE SIMPSUNZ AR THU KULEST!)PRINCET0N.  C0WABUNGA!!!EDU>
T0, L00K AT THIS D00DZ: PFALSTAD
SUBJECT, L00K AT THIS D00DZ: F00.
STATUS, L00K AT THIS D00DZ: R0



--
BIFF at BIT.NET                                           BIFF at PSUVM.PSU.EDU
BIFF at BIFFVM.BIT.NET                                  BIFF+ at ANDREW.CMU.EDU
     BIFF at PSUVM.ANDREW.PORTAL.COM.XZ.US.RUTGERS.ARPA.BITNET.EDU.UUCP
 MAN!WOMAN!BIRTH!DEATH!INFINITI!ROCKS!TREES!BIT.NET!BIFF at UUNET.UU.NET.EDU
--
BIFF at BIT.NET                                           BIFF at PSUVM.PSU.EDU
BIFF at BIFFVM.BIT.NET                                  BIFF+ at ANDREW.CMU.EDU
     BIFF at PSUVM.ANDREW.PORTAL.COM.XZ.US.RUTGERS.ARPA.BITNET.EDU.UUCP
 MAN!WOMAN!BIRTH!DEATH!INFINITI!ROCKS!TREES!BIT.NET!BIFF at UUNET.UU.NET.EDU
"BIFF" 14/407
& d
& q
"/n/uffda/b/pfalstad/mbox" complete
bash$ Z 2 phoenix:~/pub exit

script done on Tue Jan 22 18:09:56 1991


See the problem?  mail, which uses execlp or popen or some such thing,
can't find BIFF because it doesn't know how to expand ~'s in the path.
I know bash does, but other programs don't.  You either need to fix
the c library or fix bash.

>Obligatory plug for bash: it's worth it.  It's a very nice shell, with
>full emacs editing and very good vi editing if that's your dialect.
>It's certainly more fun than tcsh, which I used before, and has a more
>POSIX-ified behavior.  There are still some bugs, although Chet's
>version is nearly bug free, and version 1.06 is long overdue.  I liked
>it so much, I use the shell (or something to that effect).

I mostly agree, although I'm partial to zsh for some strange reason.  :-)

--
Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
In the heat of composition I find that I have inadvertently allowed
myself to assume the form of a large centipede.  I am accordingly
dictating the rest to my secretary.



More information about the Alt.sources.d mailing list