Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11848

Re: wrong prompt and cd to root

From Stephane Chazelas <stephane.chazelas@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: wrong prompt and cd to root
Date 2015-11-07 18:29 +0000
Message-ID <mailman.1907.1446921006.7904.bug-bash@gnu.org> (permalink)
References <CAKaJLsfZCJR1Ypm=feg+6O1BMqVHOSbmZ46GtthvLveMTWaWYg@mail.gmail.com>

Show all headers | View raw


2015-11-07 05:44:02 +0330, Seyyed Razi Alavizadeh:
[...]
> uname output: Linux Razi-MM061 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8
> 14:46:51 UTC 2015 i686 i686 i686 GNU/Linux
> Machine Type: i686-pc-linux-gnu
[...]
> Description:
> wrong prompt and cd to root
> 
> Repeat-By:
> command "cd //" works and show prompt as "//$"
> Expected that "cd //" doesn't work or at least after CDing to root dir
> Terminal shows prompt as "/$"
[...]

While /// or //// or any number of / strictly greater than 2 is
guaranteed to be the same as / by POSIX, // alone is
*allowed* to be special (but left unspecified).

In practice on most systems (including yours), // is also the
same as / but on a few systems like cygwin, // is used for
something else (the content of // has a list of netbios names on
Cygwin, and the // prefix is used for Windows UNC paths).

Now, for "cd //", a shell should do chdir("//") and not assume
it is the same as chdir("/") like it is for other numbers of "/"
characters. Whether it should also set $PWD to "//" is up to
debate but it does seem to be the most sensible thing to do.

In summary, the bash behaviour is the correct one.

-- 
Stephane

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: wrong prompt and cd to root Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-11-07 18:29 +0000

csiph-web