Skip to contentSkip to conversation

e2scrub: Remove PATH setting from the scripts

PATCH In review Lukas Czerner 3 participants 4 messages Apr 2, 2020 – Apr 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2scrub: Remove PATH setting from the scripts

We don't want to override system setting by changing the PATH. This should remain under administrator/user control.

---
 scrub/e2scrub.in     | 2 --
 scrub/e2scrub_all.in | 2 --
 2 files changed, 4 deletions(-)
scrub/e2scrub.in +0 -2
index 30ab7cbd..7c3f46e9 100644
@@ -23,8 +23,6 @@
 # check filesystems in VGs that have at least 256MB (or so) of
 # free space.
 
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
 if (( $EUID != 0 )); then
     echo "e2scrub must be run as root"
     exit 1
scrub/e2scrub_all.in +0 -2
index 4288b969..b6a7d0ad 100644
@@ -18,8 +18,6 @@
 #  along with this program; if not, write the Free Software Foundation,
 #  Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
 
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
 if (( $EUID != 0 )); then
     echo "e2scrub_all must be run as root"
     exit 1
Signature · 1 line
2.21.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Lukas Czerner

We don't want to override system setting by changing the PATH. This should remain under administrator/user control.

Looks ok to me,

--D

Quoted 34 lines
---
 scrub/e2scrub.in     | 2 --
 scrub/e2scrub_all.in | 2 --
 2 files changed, 4 deletions(-)
scrub/e2scrub.in +0 -2
index 30ab7cbd..7c3f46e9 100644
@@ -23,8 +23,6 @@
 # check filesystems in VGs that have at least 256MB (or so) of
 # free space.
 
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
 if (( $EUID != 0 )); then
     echo "e2scrub must be run as root"
     exit 1
scrub/e2scrub_all.in +0 -2
index 4288b969..b6a7d0ad 100644
@@ -18,8 +18,6 @@
 #  along with this program; if not, write the Free Software Foundation,
 #  Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
 
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
 if (( $EUID != 0 )); then
     echo "e2scrub_all must be run as root"
     exit 1
Signature · 1 line
2.21.1
#2 lore raw
In reply to Lukas Czerner
Quoted 4 lines · Lukas Czerner

We don't want to override system setting by changing the PATH. This should remain under administrator/user control.

The reason why the PATH was added is because most users don't have /sbin or /usr/sbin in their PATH, and if they run "sudo e2scrub", finding commands like lvcreate, lvremove, et. al., wouldn't be there.

I suppose we could do something like

PATH=$PATH:/sbin:/usr/sbin

instead, but otherwise, users will see some unexpected failures.

- Ted

#3 lore raw
Quoted 9 lines · Theodore Y. Ts'o
Quoted 4 lines · Lukas Czerner

We don't want to override system setting by changing the PATH. This should remain under administrator/user control.

The reason why the PATH was added is because most users don't have /sbin or /usr/sbin in their PATH, and if they run "sudo e2scrub", finding commands like lvcreate, lvremove, et. al., wouldn't be there.

I don't understand, e2scrub should be in be in sbin as well, right ? Besides what if such user wants to run lvcreate, or lvremove ? This seems like a problem that should be fixed somewhere else.

Quoted 4 lines

I suppose we could do something like

PATH=$PATH:/sbin:/usr/sbin

that's better than replacing it.

-Lukas

Quoted 5 lines

instead, but otherwise, users will see some unexpected failures.

- Ted