Skip to contentSkip to conversation

handling "/"

DISCUSSION Carles Pina i Estany 3 participants 3 messages Jan 20, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

I've seen a couple of patches about handling "/".

In Linux (I think that it's up to Linux, but maybe is libc?) things like ///bin///// are valid. Or things like /var/tmp//

Is this not everywhere? I've not verified if POSIX paths says this, but would avoid the things that has been patching and unpatching today.

Just asking/commenting to know.

Signature · 2 lines
Carles Pina i Estany
	http://pinux.info
#1 lore raw
Quoted 7 lines · Carles Pina i Estany

I've seen a couple of patches about handling "/".

In Linux (I think that it's up to Linux, but maybe is libc?) things like ///bin///// are valid. Or things like /var/tmp//

Is this not everywhere? I've not verified if POSIX paths says this, but would avoid the things that has been patching and unpatching today.

POSIX says:

Multiple successive <slash> characters are considered to be the same as one <slash>, except for the case of exactly two leading <slash> characters.

(Two leading <slash> characters are implementation-defined; I think this is for compatibility with the way some systems handle network mounts.)

However, many people feel that multiple contiguous slashes are inelegant anyway, and strive to avoid them.

Signature · 1 line
Colin Watson                                       [[email protected]]
#2 lore raw
In reply to Carles Pina i Estany
Quoted 2 lines · Carles Pina i Estany

Is this not everywhere? I've not verified if POSIX paths says this, but would avoid the things that has been patching and unpatching today.

I believe it is POSIX mandated paths behavior. (Windows on the other hand has limitations on the number of slashes/backslashes... I heard somewhere that it allows two but not three-or-more)

-Isaac