thomas-joiner/k4dirstat — Issue #1: small bug in k4dirstat (weak vs strong quotes)
Author: adren
Created: 2011-10-28 23:14:09+00:00
State: open

Hello,

First I wanted to thank you about your work and that you picked up on this nice project (kdirstat) in order to revive it with this new version: it has been very useful and I'm using it regularly.

Because I usually launch k4dirstat from a terminal, I realized that whenever I was deleting a file, that the program was showing the command used for the deletion: the "rm" with the -rf on top of that that would wipe everything recursively underneath in case of a directory!!.
And because the parameter to delete the file was enclosed in double quotes, it also means that whatever parameter that would be within the quotes would be interpreted.
It means that in order to hit the right file or directory which would have a dollar sign ($) in it, the program would have to use a pair of strong quotes to keep the variable untouched.

If this is not clear, let me give you a very unlikely example that would demonstrate my point:

Let image that you see a bunch of file and among them you have 1 directory:

x.
x.$a

with literally the '$a' at the end which means that if you want to create you'd have to type the following command
mkdir 'x.$a'

now, if you select the 2nd directory (x.$a) and you ask to delete it permanently (no way to remove), because of the "weak" quotes the $a is expanded and translate into a null string which in turn means that the other directory (x.) is recursively deleted by the "rm -rf" command without any chance to recover the files under it

Although my example is a proof of concept a little bit far fetched, I think this is a bug that could lead to consequence and that it should be solved by putting string quotes (') instead.

Regards