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

From: Bob Proulx <[email-masked]>
Date: Fri, 4 Nov 2011 14:26:43 -0600

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