Subject: bug#9950: closed (Re: bug#9950: rm -r partial failure)

From: Graham Lawrence <[email-masked]>
Date: Fri, 4 Nov 2011 16:30:15 -0700

The system is stock slackware 13.37 on my vanilla home desktop pc, of
which I am the sole user.
Here is the data you requested.  With this new set of swp files
behavior is exactly as you said it should be.  Is there any way I can
recover the original set of swp files that I removed, or is rm for
keeps?

~ $echo *.swp
*.swp
~ $ls -ldog *.swp
ls: cannot access *.swp: No such file or directory
~ $echo $0
bash
~ $echo $SHELL
/bin/bash
~ $ls -ldog /bin/sh
lrwxrwxrwx 1 4 Oct 22 04:56 /bin/sh -> bash
~ $find . -name '*.swp' -printf '%F %p\n'
ext4 ./.vim/config.swp
ext4 ./.vim/music.sh.swp
ext4 ./.vim/freedom.swp
ext4 ./.vim/Notes.swp
ext4 ./.vim/nzb.sh.swp
ext4 ./.vim/makesess.vim.swp
ext4 ./.vim/.vimrc.swp
ext4 ./.vim/.bashrc.swp
ext4 ./.vim/renamer.sh.swp
ext4 ./.vim/vimcht.swp
ext4 ./.vim/grepnotes.sh.swp
~ $find . -name '*.swp' | wc -l
11
~ $echo *.swp
*.swp
~ $ls -ldog *.swp
ls: cannot access *.swp: No such file or directory
~ $rm -rf *.swp
~ $find . -name '*.swp' | wc -l
11
~ $find /home -name *swp
/home/g/.vim/config.swp
/home/g/.vim/music.sh.swp
/home/g/.vim/freedom.swp
/home/g/.vim/Notes.swp
/home/g/.vim/nzb.sh.swp
/home/g/.vim/makesess.vim.swp
/home/g/.vim/.vimrc.swp
/home/g/.vim/.bashrc.swp
/home/g/.vim/renamer.sh.swp
/home/g/.vim/vimcht.swp
/home/g/.vim/grepnotes.sh.swp
~ $rm -rf *.swp
~ $find /home -name *swp
/home/g/.vim/config.swp
/home/g/.vim/music.sh.swp
/home/g/.vim/freedom.swp
/home/g/.vim/Notes.swp
/home/g/.vim/nzb.sh.swp
/home/g/.vim/makesess.vim.swp
/home/g/.vim/.vimrc.swp
/home/g/.vim/.bashrc.swp
/home/g/.vim/renamer.sh.swp
/home/g/.vim/vimcht.swp
/home/g/.vim/grepnotes.sh.swp
~ $

On Fri, Nov 4, 2011 at 1:26 PM, Bob Proulx <[email-masked]> wrote:
> Graham Lawrence wrote:
>> I appreciate the detailed response from Bob Proulx, but I do not think
>> it addressed the question I raised.
>
> Please keep the discussion going until we have reached consensus.
>
>> I had expected "rm -rf *.swp" to remove all the files listed by
>> find, Mr Proulx informed me that it would have removed none of them,
>
> Not given the information discussed so far. :-)
>
>> but in fact what it did was remove SOME of them.
>
> What?  That is very unexpected behavior!  Please show us the result of
> these commands:
>
>  echo *.swp
>
>  ls -ldog *.swp
>
> What shell are you using?
>
>  echo $0
>
>  echo $SHELL
>
> If that happens to turn out to be /bin/sh then please follow up by
> figuring out if /bin/sh is a symlink to a different shell.  And if it
> isn't a symlink try to find out what shell it is really.
>
>  ls -ldog /bin/sh
>
> Expansion of the '*.swp' is a function of your shell.  So finding that
> information is critical to understanding the behavior.  I am using
> bash.  If you are using a different shell then the behavior could be
> quite different.  But it would still be a function of the shell.
>
> What filesystem are you operating upon?  Is it a local filesystem or
> a network mounted filesystem such as NFS or Samba?  'find' can print
> this information.
>
>  find . -name '*.swp' -printf '%F %p\n'
>
>> For example, why did it remove
>> /home/g/.vim/renamer.sh.swp
>> but ignore
>> /home/g/.vim/backup.sh.swp
>
> I am unable to reproduce your results.  I used the following setup
> actions to recreate your test case:
>
>  mkdir g
>  mkdir g/.vim
>  touch g/.vim/config.swp
>  touch g/.vim/Notes.swp
>  touch g/.vim/nzb.sh.swp
>  touch g/.vim/makesess.vim.swp
>  touch g/.vim/backup.sh.swp
>  touch g/.vim/.vimrc.swp
>  touch g/.vim/.bashrc.swp
>  touch g/.vim/renamer.sh.swp
>  touch g/.vim/vimcht.swp
>  touch g/.vim/grepnotes.sh.swp
>  mkdir g/Scripts
>  touch g/Scripts/.reseq.awk.swp
>  mkdir g/.fluxbox
>  touch g/.fluxbox/.menu.swp
>
>  $ cd g
>
>  $ find . -name '*.swp'
>  ./.vim/.vimrc.swp
>  ./.vim/vimcht.swp
>  ./.vim/nzb.sh.swp
>  ./.vim/Notes.swp
>  ./.vim/config.swp
>  ./.vim/makesess.vim.swp
>  ./.vim/renamer.sh.swp
>  ./.vim/backup.sh.swp
>  ./.vim/.bashrc.swp
>  ./.vim/grepnotes.sh.swp
>  ./Scripts/.reseq.awk.swp
>  ./.fluxbox/.menu.swp
>
>  $ find . -name '*.swp' | wc -l
>  12
>
>  $ echo *.swp
>  *.swp
>
>  $ ls -ldog *.swp
>  ls: cannot access *.swp: No such file or directory
>
>  $ rm -rf *.swp
>  $ find . -name '*.swp' | wc -l
>  12
>
> Bob
>