Re:Rm -rf / in Windows Subsystem for Linux reveals sharp set...
by NetTechM on Thursday June 30, 2016 @12:39AM
(#12006602)
The --no-preserve-root is the safety net of sorts. If you deliberately type it, you obviously know what you are asking for.
Re:Rm -rf / in Windows Subsystem for Linux reveals sharp set...
by wlesieutre on Thursday June 30, 2016 @12:53AM
(#12006632)
But does the Linux subsystem actually understand that /mnt/c is the root of the drive, or can you omit the option?
Re:Rm -rf / in Windows Subsystem for Linux reveals sharp set...
by koenigdavidmj on Thursday June 30, 2016 @01:10AM
(#12006699)
According to the article, removing / didn't touch the stuff in /mnt/c. Therefore, I would assume (but obviously not test myself!) that this just stops as soon as it sees another mount point.
Re:Rm -rf / in Windows Subsystem for Linux reveals sharp set...
by Ezhik on Thursday June 30, 2016 @01:01AM
(#12006667)
`rm` is probably hardcoded to not touch `/` without the flag and that's it, so most likely it's not necessary.
Re:Rm -rf / in Windows Subsystem for Linux reveals sharp set...
by DSMan195276 on Thursday June 30, 2016 @02:04AM
(#12006874)
I just checked the `rm` source code for the GNU coreutils, and it actually checks for `/` by checking for identical device and inode numbers to `/`. I admittedly don't want to test if the feature works, but in theory if you remount `/` at a different location `rm` will still require the `--no-preserve-root` flag to delete it.
That said, the above only saves you if `/` and `/mnt/c` are the same device mounted at two different places - I haven't used the system to know.
It would be an interesting (and probably good enough) safety net if they treated /mnt/c the same as / in this case.