Article View: gnu.bash.bug
Article #130Re: cd in bash 0.99
From: Chet Ramey
Date: Fri, 16 Jun 1989 20:02
Date: Fri, 16 Jun 1989 20:02
57 lines
1970 bytes
1970 bytes
In article <8906161251.AA04266@csvax.caltech.edu> andy@CSVAX.CALTECH.EDU (Andy Fyfe) writes:
>It's permitted to put multiple /'s between components in a path name
>Cd, with "..", however, get's confused by this.
> $ cd /usr/local//src
> $ pwd
> /usr/local/src
> $ cd ../..
> $ pwd
> /usr/local
Here's a quick look at what happens after I fix it; a one-line diff for
general.c follows (note that I have aliased pwd to "echo $PWD"; this
makes no difference).
cwns5$ echo $SHLVL
2
cwns5$ cd /usr/homes/chet/src/Shells/bash////Rt-AOS/
cwns5$ pwd
/usr/homes/chet/src/Shells/bash////Rt-AOS
cwns5$ cd ../..
cwns5$ pwd
/usr/homes/chet/src/Shells/bash//
cwns5$ cd Rt-AOS/
cwns5$ ./bash
cwns5$ echo $SHLVL
3
cwns5$ cd /usr/homes/chet/src/Shells/bash////Rt-AOS/
cwns5$ pwd
/usr/homes/chet/src/Shells/bash////Rt-AOS
cwns5$ cd ../..
cwns5$ pwd
/usr/homes/chet/src/Shells
cwns5$
Here's the fix (your line numbers may vary; I've made other changes):
*** bash-0.99/general.c Wed May 24 21:16:07 1989
--- src-0.99/general.c Fri Jun 16 15:22:59 1989
***************
*** 293,297
while (n--)
{
! if (*p == '/')
p--;
--- 293,297 -----
while (n--)
{
! while (*p == '/') /* skip multiple occurrences of '/' */
p--;
Chet Ramey Network Services Group, CWRU chet@cwjcc.INS.CWRU.Edu
"The flagon with the dragon has the potion with the poison;
the vessel with the pestle holds the brew that is true!"
Technical Details
Message-ID:
<366@cwjcc.CWRU.Edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!kiwi!chetReferences:
<8906161251.AA04266@csvax.caltech.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!kiwi!chet From: chet@kiwi.CWRU.EDU (Chet Ramey) Newsgroups: gnu.bash.bug Subject: Re: cd in bash 0.99 Summary: Fix Message-ID: <366@cwjcc.CWRU.Edu> Date: 16 Jun 89 20:02:52 GMT References: <8906161251.AA04266@csvax.caltech.edu> Sender: news@cwjcc.CWRU.Edu Reply-To: chet@cwjcc.INS.CWRU.Edu (Chet Ramey) Distribution: gnu Organization: CWRU Andrew R. Jennings Computing Center Lines: 57