[Top][All Lists]

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

Re: wrong prompt and cd to root

From: Stephane Chazelas
Subject: Re: wrong prompt and cd to root
Date: Sat, 7 Nov 2015 18:29:56 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]