Re:Google Chrome Keystone is modifying /var symlink on non S...
by olafure on Tuesday September 24, 2019 @07:04PM
(#21065613)
I start bash scripts, by setting the holy trinity:
set -eou
That prevents end-of-the-world scenario like the one above, if the script derails.
Re:Google Chrome Keystone is modifying /var symlink on non S...
by saagarjha on Tuesday September 24, 2019 @07:26PM
(#21065814)
Maybe also add "pipefail" to the end of that?
Re:Google Chrome Keystone is modifying /var symlink on non S...
by scarejunba on Tuesday September 24, 2019 @09:57PM
(#21066819)
Haha right, I feel like these should always be popularized as `set -eu` and `set -o pipefail` rather than making it look like you an `set pipefail`. I wonder if that chap has been uselessly printing options at the beginning of scripts for a while now.
Re:Google Chrome Keystone is modifying /var symlink on non S...
by loeg on Tuesday September 24, 2019 @07:56PM
(#21066065)
alias rm='rm --no-preserve-root'
Re:Google Chrome Keystone is modifying /var symlink on non S...
by outworlder on Tuesday September 24, 2019 @06:52PM
(#21065502)
There was a similar issue with EVE Online deleting boot.ini
Re:Google Chrome Keystone is modifying /var symlink on non S...
by css on Wednesday September 25, 2019 @09:38AM
(#21070636)
Did they remove this from the git history? I cannot find the original code or the commit that fixed it.
Re:Google Chrome Keystone is modifying /var symlink on non S...
by jen20 on Wednesday September 25, 2019 @07:50AM
(#21069801)
Of course, Linux could do what Solaris did decades ago and define the directory order in which `rm -rf /` works to start with `pwd` - and thus fail immediately. That would fix that problem completely.
Re:Google Chrome Keystone is modifying /var symlink on non S...
by w-m on Wednesday September 25, 2019 @08:19AM
(#21070002)
How did they fix that, in the rm binary?
In the example above, the command would be `rm -rf /` without the variable present, and the shell would expand / to all the folders in /. So it's not a direct call to `rm -rf /`, you would need to handle the shell expansion of /* as well?
Re:Google Chrome Keystone is modifying /var symlink on non S...
by jen20 on Wednesday September 25, 2019 @11:51AM
(#21071929)
I missed the * on the end.
Re:Google Chrome Keystone is modifying /var symlink on non S...
by techslave on Wednesday September 25, 2019 @10:38AM
(#21071193)
you can rmdir $PWD no problem. as long as there are no files in it. i guess it catches almost all cases though.
come to think of it, when would you ever want to rm -rf/? even in a chroot it doesn’t seem like a thing you’d want to do.
Re:Google Chrome Keystone is modifying /var symlink on non S...
by thenewwazoo on Wednesday September 25, 2019 @12:01PM
(#21072021)
When working in chroot jails on embedded distributions, I have needed to run `rm -rf /`. It's admittedly really edge-casey, but it's happened.
[1] https://github.com/valvesoftware/steam-for-linux/issues/3671...