public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Oskar Skog <oskar@oskog97.com>
To: cygwin@cygwin.com
Subject: Deleting a directory with the same name as a shortcut deletes everything in CWD
Date: Mon, 8 Aug 2022 13:50:22 +0300	[thread overview]
Message-ID: <4b9acea9-b098-2c06-4530-10a4e9ca42b6@oskog97.com> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 676 bytes --]

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!

[-- Attachment #1.1.2: delete-all-files.tar --]
[-- Type: application/x-tar, Size: 10240 bytes --]

[-- Attachment #1.1.3: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2485 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]

             reply	other threads:[~2022-08-08 10:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 10:50 Oskar Skog [this message]
2022-08-08 11:56 ` Christian Franke
2022-08-08 23:29   ` Ken Brown
2022-08-09 19:52     ` Ken Brown
2022-08-09 20:01       ` Oskar Skog
2022-08-09 20:11         ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b9acea9-b098-2c06-4530-10a4e9ca42b6@oskog97.com \
    --to=oskar@oskog97.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).