Drop /usr/local/sbin:/usr/sbin from $PATH

If $PATH is not set, we get the default from crun [1]:
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
This is not useful, because in the image, /bin, /sbin, /usr/sbin are all
symlinks. /usr/local/sbin does not exist.

When /usr/sbin is a symlink to /usr/bin, and we use have a $PATH with
/usr/sbin before /usr/bin, various tools will discover /usr/sbin/foo when
looking for 'foo' [2], which is confusing and ugly.

[1] https://github.com/containers/crun/blob/a980c89665bb488ff206e47e9083f75b48528714/src/libcrun/container.c#L183
[2] https://src.fedoraproject.org/rpms/setup/pull-request/18#comment-253719

Co-authored-by: Simon de Vlieger <cmdr@supakeen.com>
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-03-19 14:50:50 +01:00
co-authored by Simon de Vlieger
parent b57a77e571
commit 364b0b8f62
+3
View File
@@ -35,6 +35,7 @@
</labels>
<environment>
<env name="container" value="oci"/>
<env name="PATH" value="/usr/local/bin:/usr/bin"/>
</environment>
</containerconfig>
</type>
@@ -65,6 +66,7 @@
</labels>
<environment>
<env name="container" value="oci"/>
<env name="PATH" value="/usr/local/bin:/usr/bin"/>
</environment>
</containerconfig>
</type>
@@ -124,6 +126,7 @@
</labels>
<environment>
<env name="container" value="oci"/>
<env name="PATH" value="/usr/local/bin:/usr/bin"/>
</environment>
</containerconfig>
</type>