kerl icon indicating copy to clipboard operation
kerl copied to clipboard

kerl deleted files home directory

Open tholschuh opened this issue 13 years ago • 4 comments

I keep my fingers away from kerl since it deleted a bunch of files in my home directory. There is a very dangerous delete option in the code which should be revised.

tholschuh avatar Jun 01 '11 02:06 tholschuh

I'm sorry about this, can you develop on what happened? Were you using environment modifiers? Can you please post your .kerlrc file?

evax avatar Jun 01 '11 06:06 evax

I'll survive.. Unfortunately I don't have the kerl files anymore.. deleted everything in wrath. I've looked through the script to reproduce what happened. As far as I remember I've curled kerl into my ~/bin directory. I installed R14B02 through kerl but didn't remember it. So I've compiled 03 myself but the kerl installed 02 in ~/bin was prior on my path so my installation didn't work. I've tried to delete the kerl installation with (as I remember):

~$ kerl delete installation .

Problem revolves IMO around ff lines 595 in kerl script.

Other than my problem I like the idea of having a tool organize erlang installations.

Cheers

On 11-05-31 11:14 PM, evax wrote:

I'm sorry about this, can you develop on what happened? Were you using environment modifiers? Can you please post your .kerlrc file?

tholschuh avatar Jun 01 '11 17:06 tholschuh

Ok, I think I understand what happened. Before deleting an installation directory kerl tries to ensure it's really a kerl install dir by looking for an "activate" file. In your case kerl actually found an "activate" file and deleted the whole directory but it was somehow a "shared" directory (you had other stuff in it before putting a kerl install inside) and kerl assumes its installation dirs are not shared and reserved for its exclusive use. So to prevent other people to hit the problem I'll update the docs and maybe implement a check on install so that installation fails if the destination already exists and is not empty. Does it sound like it addresses the issue?

evax avatar Jun 01 '11 18:06 evax

Frankly, I don't think that is enough. When installing ensure the install directory is empty and named by, e.g. build, and that you only remove the named directory when you delete. DO NOT delete on a given argument as in:

rm -rf $3

Do not trust any input! Use absolute paths. Implement a user interaction that asks before delete. Etc.

A "BTW: if you mess up the command, kerl might delete your home directory" in the documentation is not helpful.

tholschuh avatar Jun 07 '11 02:06 tholschuh