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

Achim Gratz Stromeko@nexgo.de
Mon Mar 12 23:39:00 GMT 2018


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 can't be
simplified.

> Test case 2:
> -------------------
> $ MYDIR=//
> $ test "$(realpath -e "$MYDIR" )" != /  &&  echo rm -rf "$MYDIR"/*
> rm -rf ///bin ///cygdrive ///Cygwin.bat ///Cygwin.ico ///Cygwin-Terminal.ico ///dev ///etc ///home ///lib ///proc ///sbin ///tmp ///usr ///var
> -------------------
> Expected output: no output

This goes to show that you really, really, really want to understand the corner
cases in this script.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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



More information about the Cygwin mailing list