bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash bug - unexpect file deleted using rm command


From: Andreas Kusalananda Kähäri
Subject: Re: bash bug - unexpect file deleted using rm command
Date: Tue, 28 May 2019 16:43:42 +0200
User-agent: Mutt/1.12.0 (2019-05-25)

On Tue, May 28, 2019 at 11:56:04AM +0000, root@minigeek.srve.com wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
> -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
> -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE 
> -DRECYCLES_PIDS  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
> -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fwrapv
> uname output: Linux minigeek.srve.com 2.6.32-754.10.1.el6.x86_64 #1 SMP Tue 
> Jan 15 17:07:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-redhat-linux-gnu
> 
> Bash Version: 4.1
> Patch Level: 2
> Release Status: release
> 
> Description:
>       I deleted the file .DS_Store fom a fat32 partition as root.  bash 
> properly warned me and I answered y which deleted that file.
>       A second different file, named ._.DS_Store was also erased - but 
> without warning, and I did not ask for this.  
>       Therein lies the bug.
>       I recreated two text files with different contents having those same 
> names, and repeated the steps - same problem - both files got erased with the 
> one rm command for just one of them.
> 
> Repeat-By:
>       Create those 2 files. Delete just one.
> 
> Fix:
>       probably some shell filename matching code has an error?
> 
> 

What was your actual command when deleting the file(s)?  If no filename
globbing pattern was used, then I think the shell can be ruled out as
the culprit.  If a globbing pattern was used, e.g. .*DS_Store .DS_Store

$ touch .DS_Store ._.DS_Store
$ ls -la
total 8
drwx------  2 kk    wheel  512 May 28 16:41 .
drwxrwxrwt  7 root  wheel  512 May 28 16:41 ..
-rw-r--r--  1 kk    wheel    0 May 28 16:41 .DS_Store
-rw-r--r--  1 kk    wheel    0 May 28 16:41 ._.DS_Store
$ rm .DS_Store
$ ls -la
total 8
drwx------  2 kk    wheel  512 May 28 16:41 .
drwxrwxrwt  7 root  wheel  512 May 28 16:41 ..
-rw-r--r--  1 kk    wheel    0 May 28 16:41 ._.DS_Store

Note that bash, the shell, would not warn you about deleting files.
This may possibly be something that rm does if used with its -i option,
or under some other circumstances having to do with the permissions on
the files.

-- 
Kusalananda
Sweden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]