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 2018-03-14 04:58, Mikhail Usenko via cygwin wrote:
> On Mon, 12 Mar 2018 20:43:13 -0500
> Eric Blake <...> wrote:
> I don't know what this is for, but nevertheless,
> thank you for your efforts to eliminate of illiteracy among readers...

>> POSIX allows leeway between implementations; this is one of those 
>> documented places where they differ, yet are still both POSIX compliant 
>> with their different choices.  If your script is not robust to what 
>> POSIX has already warned you about, fix your script.
>>
>>> 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.
>>
>> 3 of the 4 do the same thing on ALL POSIX platforms.  The only one that 
>> has implementation-defined behavior is 'rm -rf //*', which is different 
>> on systems where // is distinct (such as Cygwin).  All the other 
>> spellings (attempt) to remove all non-hidden files from the root directory.
>>
> If you really claims that Cygwin may and should be different and distinct from all other
> existing POSIX systems (the more so that it is allowed by POSIX),
> then it would probably be more obvious and clear to say this at the very begining, e.g.
> "Get that Linux feeling (with all those differents and distinctions) - on Windows"
> 
>> Use of // in Linux is already on shaky ground, given that POSIX has 
>> already declared it to be implementation-defined.
> Shaky ground? There must be some good reasons (beyond the declaration of such an abstarct
> possibility) that it should to be done differently than it has been so far.

POSIX Rationale for Pathname Resolution:
http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_13

Notes:
POSIX agrees to standardize what is common among their IEEE, OpenGroup, ISO, and
IEC members implementations.

Eric, and some of the other maintainers on Cygwin lists, are also participants
in POSIX, so they have background, knowledge, and experience there.

Background:
BSD diverged from AT&T to support TCP/IP networking and sockets instead of telco
OSI and streams, then each of the BSDs went their own ways; many vendors joined
consortiums to agree on features, took some of these approaches, and implemented
them with their own proprietary tweaks; Linux was based on one of these
implementations (Solaris, with SysV unification on SunOS BSD base); the rest was
based on GNU, designed to remove limits built into the SysV and BSD libraries
and utilities (I got into this stuff after I hit 128... line length and other
limits in various utilities and systems): the world is not only Linux or GNU;
the commercial world is heavily SysV and/or BSD based; guess who pays to
participate?
IBM, MS, HPE, and others participate to ensure that POSIX maintains conformance
for their systems, so they comply to US FIPS, and can bid them on US .gov and
.mil contracts. (WSL anyone?) ;^>

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
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]