Deleting a directory with the same name as a shortcut deletes everything in CWD

Oskar Skog oskar@oskog97.com
Mon Aug 8 10:50:22 GMT 2022


Deleting a directory with the same name as a shortcut deletes everything
in the current working directory.

Tested on:
CYGWIN_NT-10.0-19044 3.3.5-341.x86_64 2022-05-13 12:27 UTC x86_64 Cygwin
CYGWIN_NT-10.0-22000 3.3.5-341.x86_64 2022-05-13 12:27 UTC x86_64 Cygwin

Script to reproduce the bug (also in the tar):

#!/bin/bash
echo 'EVERY FILE IN THE CURRENT WORKING DIRECTORY WILL BE DELETED!'
read -p "Enter 'sure' to continue: " var
echo $var | grep -q sure || exit 1

do_stuff ()
{
     mkdir foo
     touch Foo.lnk
     if [ -d foo ]; then
         rm -rf foo
     fi
}
do_stuff
do_stuff
# All files in the current working directory are now GONE!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: delete-all-files.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
URL: <https://cygwin.com/pipermail/cygwin/attachments/20220808/676e5a04/attachment-0001.tar>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x473CD05C78734E49.asc
Type: application/pgp-keys
Size: 2444 bytes
Desc: OpenPGP public key
URL: <https://cygwin.com/pipermail/cygwin/attachments/20220808/676e5a04/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <https://cygwin.com/pipermail/cygwin/attachments/20220808/676e5a04/attachment-0001.sig>


More information about the Cygwin mailing list