[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
{base,dir}name // semantics
From: |
Eric Blake |
Subject: |
{base,dir}name // semantics |
Date: |
Sat, 09 Jul 2005 15:43:02 +0000 |
POSIX allows implementations to define the behavior of 'basename //' and
'dirname //'. Currently, both operations in coreutils output a single /, but
this definition is worthless on platforms (like cygwin) where // is distinct
from /. The intent, according to POSIX, is that 'cd $(dirname "string")
&& stat $(basename "string")' access the same file as 'stat "string"'
would do.
I can look at preparing a patch to make both utilities output //, which
would satisfy the intent of POSIX. First, I have one question - should
this patch be made globally, or should it be limited to only systems
that have a distinct //, leaving other platforms to continue having just
a single slash returned? I would argue that cross-platform consistency
is more important than reducing the output where // has no special
semantics, so the change should probably be made for all platforms.
--
Eric Blake
- {base,dir}name // semantics,
Eric Blake <=