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

2018-03-12 Thread Mikhail Usenko via cygwin
coreutils-8.26-2 cygwin-2.10.0-1 Test case 1: --- $ realpath // // --- Expected output: / Test case 2: --- $ MYDIR=// $ test "$(realpath -e "$MYDIR" )" != / && echo rm -rf "$MYDIR"/* rm -rf ///bin ///cygdrive ///Cygwin.bat ///Cygwin.ico ///Cygwin-

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

2018-03-12 Thread Eric Blake
On 03/12/2018 03:28 PM, Mikhail Usenko via cygwin wrote: coreutils-8.26-2 cygwin-2.10.0-1 Test case 1: --- $ realpath // // Correct. --- Expected output: / Wrong. On cygwin, '/' and '//' are two different directories, as allowed by POSIX. Converting // int

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

2018-03-12 Thread Achim Gratz
Mikhail Usenko via cygwin writes: > coreutils-8.26-2 > cygwin-2.10.0-1 > > Test case 1: > --- > $ realpath // > // > --- > Expected output: / Adjust your expectations, a double slash at the beginning signifies a network path (as expressedly allowed for in POSIX) and

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

2018-03-12 Thread Mikhail Usenko via cygwin
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

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

2018-03-12 Thread Eric Blake
On 03/12/2018 06:38 PM, Mikhail Usenko via cygwin wrote: 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) POSIX says that the behavior of leading // is implementation-defined (that is

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

2018-03-14 Thread Mikhail Usenko via cygwin
On Mon, 12 Mar 2018 20:43:13 -0500 Eric Blake <...> wrote: > Furthermore, you need to realize that GNU coreutils 'rm' already has > special logic (permitted by POSIX) such that 'rm -rf /' fails unless you > use --no-preserve-root ('rm -rf /*' unfortunately does not trigger the > special logic,

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

2018-03-14 Thread Brian Inglis
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 o

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

2018-03-15 Thread Thomas Wolff
Am 14.03.2018 um 11:58 schrieb Mikhail Usenko via cygwin: On Mon, 12 Mar 2018 20:43:13 -0500 Eric Blake <...> wrote: ... Just because Linux has taken the stance that their documented definition of // is "synonym for /" does NOT mean that ALL POSIX systems have taken the same approach; Cygwin ha

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

2018-03-16 Thread Brian Inglis
On 2018-03-15 01:11, Thomas Wolff wrote: > Am 14.03.2018 um 11:58 schrieb Mikhail Usenko via cygwin: >> On Mon, 12 Mar 2018 20:43:13 -0500 >> Eric Blake <...> wrote: >>> Just because Linux has taken the stance that their documented definition >>> of // is "synonym for /" does NOT mean that ALL POSI