Menu

#46 :empty gives error message re ".." directory

0.7.8
closed
xaizek
bug (3) trash (2)
1
2014-06-14
2014-06-13
ckester
No

Using git master 727704c71507d6e3bfdb6600c52dee5abcaefb7d,
emptying trash on Debian gives error message

'rm: cannot remove directory /home/ckester/.vifm/Trash/..'

In src/trash.c, the function empty_trash_dir() has the following line:

snprintf(cmd, sizeof(cmd), "sh -c 'rm -rf %s/* %s/.[^.]*'", escaped, escaped);

On Debian, however, /bin/sh is linked to dash and that shell doesn't recognize the [^.] as intended by this line of code.

For example, the output from

$ dash -c 'ls .[^.]*'

will include the content of the parent directory, whereas

$ bash -c 'ls .[^.]*'

will list only the dotfiles in the current directory.

Discussion

  • xaizek

    xaizek - 2014-06-14
    • labels: --> bug, trash
    • status: open --> closed
    • assigned_to: xaizek
     
  • xaizek

    xaizek - 2014-06-14

    Thanks for the bug report. This is actually the third time (if I remember correctly) this command needs to be fixed:

    1. A couple years ago, for zsh.
    2. Recently, for csh-like shells.
    3. Now, for dash.

    I'm getting tired of this, so throw away this code and implemented removal manually. Also moved it to a separate thread, which is visible in :jobs menu.

     
  • xaizek

    xaizek - 2014-06-14
    • Group: v1.0_(example) --> 0.7.8
     

Log in to post a comment.