plasma-umass / browsix

Browsix is a Unix-like operating system for the browser.
Other
3.15k stars 181 forks source link

fix `rm -rf /` #29

Closed bpowers closed 8 years ago

bpowers commented 8 years ago

It currently fails with ENOENT, but it should actually leave the shell unusable.

rvolosatovs commented 8 years ago

The problem seems to be with the '-r' flag, especially on lines14-33. Statement on line 33 is executed asynchronously(as a consequence, the directory may be not empty yet at the moment it is trying to be deleted) Also fs.stat on line 17 should take 'filename' as arg instead of 'dir'(otherwise the following logic fails)

Note that function, which the '-r' flag logic was 'adopted' from uses Sync variations of functions and so the results can differ.

bpowers commented 8 years ago

fixed by #30 + my small hack on top of that. I'll open a separate issue for the .deletedFiles.log thing. Thanks @b1101 !