htop-dev / htop

htop - an interactive process viewer

Home Page:https://htop.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTOPRC handling too aggressive?

ossimoi opened this issue · comments

Wanted to run htop with default settings. HTOPRC=/dev/null htop as root was a bad idea since htop replaced /dev/null char device with default config. This obviously caused problems. Should there be an extra check to not touch the file if it exists but does not contain actual config?

At least things should not be touched, if the original file is not a regular file (or symlink).

Surely is was a bad idea. But keep in mind the root user is already able to break the system with HTOPRC=/etc/passwd htop (/etc/passwd is surely a regular file).

We've handled the symlinks already in #1412. Maybe we can add exception that any file type that's not regular file should not be touched. This would skip not just device files but also directories, FIFOs, and sockets.