This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [bug] coreutils: potentially dangerous: $(realpath //) != /


On Mon, 12 Mar 2018 21:47:09 +0100
Achim Gratz <...> wrote:
> This goes to show that you really, really, really want to understand the corner
> cases in this script.

On Mon, 12 Mar 2018 15:41:00 -0500
Eric Blake <...> wrote:
> On cygwin, '/' and '//' are two different directories, as allowed by 
> POSIX. Converting // into / is a violation of the POSIX requirements on 
> pathname resolution on systems where // is distinct from /.
> ...
> If you want to guarantee that an arbitrary variable concatenated 
> with / and then a glob expands into the expected directory, then YOU 
> have to prefilter the arbitrary variable to make sure it does not 
> consist solely of slashes. 

Well, guys my expextations are that the program/script execution conditions
in Cygwin should be the same as in other popular POSIX systems
(namely it is Linux) and, as a consequence, I should avoid the case where
somewhere in a bash script evaluating of some variable would lead to one of
the following command to execute:
rm -rf /*
rm -rf //*
rm -rf ///*
rm -rf ////*
that all do the very same thing in Linux.

If at some time it was considered that
$ ls //Server/Folder
in Cygwin should behave like
> net view \\Server\Folder
in Windows to be able to view network shares, I belive this could be realized
with using of some special folder e.g. /cygnetwork, like /cygdrive does it for
Windows drives.
Supporting of UNC paths that are actually off the POSIX unified tree, directly
for POSIX user commands, breaks consistency with Linux user environment, which
is the feature of Cygwin that is highly valued by the most of the users.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]