I'm doing archive-wide package rebuilds in GitLab CI/CD and my toolchain
uses 'setpriv --reset-env' to drop privileges and reset the environment >variables, which results in:
PATH=/usr/local/bin:/bin:/usr/bin
This unusual ordering appears to be intentional for setpriv:
https://manpages.debian.org/bookworm/util-linux/setpriv.1.en.html
However this ordering is different than the PATH used on buildd's:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Having /bin before /usr/bin cause FTBFS of some packages. The most
simple example is packages that invoke gradle. It appears to happen
both on bookworm and trixie, and is easy to reproduce:
podman run -it --rm debian:trixie
apt-get update
apt-get install -y --no-install-recommends gradle >PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
gradle
/bin/gradle: 23: cd: can't cd to /bin/../share/gradle/bin/..
The problem seems that it is generating a relative path to its ownIMO yes, see below.
command expanded via PATH, which doesn't work because there is no /share >symlink but there is /usr/share/.
Is this a problem in 'gradle' (and other packages) that should be
reported and fixed?
What severity?
What can packages assume about PATH? What can packages not assume? In >particular wrt ordering. Are there written down rules for this?
The problem seems that it is generating a relative path to its own command expanded via PATH, which doesn't work because there is no /share symlink but there is /usr/share/.
Is this a problem in 'gradle' (and other packages) that should be
reported and fixed? What severity?
What can packages assume about PATH? What can packages not assume? In particular wrt ordering. Are there written down rules for this?
podman run -it --rm debian:trixie
apt-get update
apt-get install -y --no-install-recommends gradle PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
gradle
/bin/gradle: 23: cd: can't cd to /bin/../share/gradle/bin/..
The problem seems that it is generating a relative path to its own
command expanded via PATH, which doesn't work because there is no /share symlink but there is /usr/share/.
Is this a problem in 'gradle' (and other packages) that should be
reported and fixed? What severity?
What can packages assume about PATH? What can packages not assume? In particular wrt ordering. Are there written down rules for this?
Hi,
Quoting Simon Josefsson (2025-05-06 11:34:47)
The problem seems that it is generating a relative path to its own command >> expanded via PATH, which doesn't work because there is no /share symlink but >> there is /usr/share/.
Is this a problem in 'gradle' (and other packages) that should be
reported and fixed? What severity?
What can packages assume about PATH? What can packages not assume? In
particular wrt ordering. Are there written down rules for this?
I think you can reformulate this problem a bit differently. Instead of saying "is it a problem to shuffle PATH order" you could also ask "should it be a problem whether a program is invoked from either their aliased or unaliased location?"
With the finalization of /usr-merge, many programs were moved from /bin into their unaliased location under /usr/bin also with the argument: if programs rely on it to exist in /bin then that is still the case even after moving the actual path due to the top-level symlink. What you have here is an instance where a program is intended to never be called from their unaliased path or otherwise it cannot find /usr/share.
My gut feeling is that software that does this should be made robust in finding
/usr/share independent of from where it is called.
podman run -it --rm debian:trixie
apt-get update
apt-get install -y --no-install-recommends gradle >>PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
gradle
/bin/gradle: 23: cd: can't cd to /bin/../share/gradle/bin/..
I'll point out that this is not even trying to build a Debian package,
so the typical Debian package build environment would be irrelevant
here.
The problem seems that it is generating a relative path to its ownIMO yes, see below.
command expanded via PATH, which doesn't work because there is no /share >>symlink but there is /usr/share/.
Is this a problem in 'gradle' (and other packages) that should be
reported and fixed?
What severity?
normal?
What can packages assume about PATH? What can packages not assume? In >>particular wrt ordering. Are there written down rules for this?
Probably in POSIX. Per my understanding PATH is defined to be used in
a specific algorithm, which is basically "stat the name of the
executable you are looking for in these directories, in the given
order". Everything else is probably unspecified, and deriving file
system paths that are not actually given in PATH is undefined
behaviour, and can just break.
If a program needs to know a path to supporting files, this path
should be known at build time of that program (here: gradle), and then
be baked into it (and maybe also be configurable at runtime).
The problem seems that it is generating a relative path to its own
command expanded via PATH, which doesn't work because there is no /share
symlink but there is /usr/share/.
Perfectly reasonable method to support installing to /usr, /usr/local, $HOME/.local, ...
On 06/05/2025 10:34, Simon Josefsson wrote:
podman run -it --rm debian:trixie
apt-get update
apt-get install -y --no-install-recommends gradle PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
gradle
/bin/gradle: 23: cd: can't cd to /bin/../share/gradle/bin/..
The problem seems that it is generating a relative path to its own
command expanded via PATH, which doesn't work because there is no /share symlink but there is /usr/share/.
Perfectly reasonable method to support installing to /usr, /usr/local, $HOME/.local, ...
On 06.05.25 13:31, Ahmad Khalifa wrote:
Fedora doesn't set /bin anymore in the $PATH
IMHO we should follow that practice, post-Trixie.
On 06.05.25 13:31, Ahmad Khalifa wrote:
Fedora doesn't set /bin anymore in the $PATH
IMHO we should follow that practice, post-Trixie.
El 7/5/25 a las 10:39, Matthias Urlichs escribi�:
On 06.05.25 13:31, Ahmad Khalifa wrote:
Fedora doesn't set /bin anymore in the $PATHIMHO we should follow that practice, post-Trixie.
I disagree that we should do that.
AFAIK, the usr-merge was not about moving everything to usr/bin (that's an implementation detail) but about making /bin and /usr/bin equivalent.
So, while we could in theory drop /bin, doing so might involve undesired
side effects.
For example, some configure script might look in the PATH and decide
that sh is in /usr/bin and ship shell scripts as #!/usr/bin/sh.
On 07.05.25 12:00, Santiago Vila wrote:
For example, some configure script might look in
the PATH and decide that sh is in /usr/bin and ship shell scripts
as #!/usr/bin/sh.
That's not a problem, because today's default (according to my /etc/login.defs) is "/usr/local/bin:/usr/bin:/bin" (plus /sbin for
root, plus …/games for non-root), i.e. with the symlinks last.
That's not a problem, because today's default (according to my /etc/login.defs) is "/usr/local/bin:/usr/bin:/bin" (plus /sbin for root,
plus …/games for non-root), i.e. with the symlinks last.
Santiago Vila <[email protected]> writes:
El 7/5/25 a las 10:39, Matthias Urlichs escribió:
On 06.05.25 13:31, Ahmad Khalifa wrote:
Fedora doesn't set /bin anymore in the $PATHIMHO we should follow that practice, post-Trixie.
I disagree that we should do that.
AFAIK, the usr-merge was not about moving everything to usr/bin (that's an >> implementation detail) but about making /bin and /usr/bin equivalent.
So, while we could in theory drop /bin, doing so might involve undesired
side effects.
I think we need to separate:
1) Removing /bin from the default PATH environment variable.
2) Removing the /bin symlink.
To clarify, are you against both or just one of these?
I think a reasonable conservative system policy is PATH=/usr/bin and
anything beyond that is something the user or system administrator have
to add. I think we should give up on /usr/games and move those
executables to /usr/bin, renaming any binaries that conflict.
El 7/5/25 a las 13:40, Simon Josefsson escribi�:...
I think we need to separate:
...2) Removing the /bin symlink.
(I don't think anybody is proposing 2) right now).
My understanding is that the compatibility symlinks /bin, /lib* andCorrect.
/sbin in the root directory can never be deleted, and even the least >conservative advocates of merged-/usr don't intend to delete them,
because they are part of the platform ABI.
Hi,
On 5/6/25 20:31, Ahmad Khalifa wrote:
The problem seems that it is generating a relative path to its own
command expanded via PATH, which doesn't work because there is no /share >>> symlink but there is /usr/share/.
Perfectly reasonable method to support installing to /usr, /usr/local,
$HOME/.local, ...
I disagree. These paths should be taken from configure arguments and
compiled in, because distributions may change the layout of the package
-- e.g. dlopen()ing a shared library requires looking into the multi-
arch directory, and configuration files for packages in /usr are
routinely found in /etc, while configuration files for manually
installed packages below /usr/local can be in /usr/local/etc as well.
Hardcoding relative paths is going to be brittle, especially if the configuration system allows deviating from the default layout, and the
amount of hackery required to make both work together is not worth it.
AFAIK, the usr-merge was not about moving everything to usr/bin
(that's an implementation detail) but about making /bin and /usr/bin equivalent.
On 2025-05-07 14:40:01 +0200, Simon Josefsson wrote:
I think a reasonable conservative system policy is PATH=/usr/bin and
anything beyond that is something the user or system administrator have
to add. I think we should give up on /usr/games and move those
executables to /usr/bin, renaming any binaries that conflict.
I disagree. root should not have games in his path. This could also
annoy non-root users.
I think we should give up on /usr/games and move those
executables to /usr/bin, renaming any binaries that conflict.
I disagree. root should not have games in his path.
I personally think that games aren't particularly special in any way
that would warrant them being shipped in a separate directory so I
would welcome if /usr/games became an empty directory (i.e. we move
all binaries to /usr/bin).
On Wed, 07 May 2025 at 14:40:01 +0200, Simon Josefsson wrote:
I think we should give up on /usr/games and move those
executables to /usr/bin, renaming any binaries that conflict.
This seems somewhat off-topic for a discussion of FTBFS - I hope that packages don't assume that /usr/games is in the PATH at build time in
any case.
I think we should give up on /usr/games and move those
executables to /usr/bin, renaming any binaries that conflict.
This seems somewhat off-topic for a discussion of FTBFS - I hope that
packages don't assume that /usr/games is in the PATH at build time in
any case.
Is it a bug if they do? Buildd's have /usr/games in the default PATH so
I don't think we notice now.
My archive rebuild now uses PATH=/usr/bin so I will get breakage for any >package that FTBFS because of missing /usr/games in PATH. If this
causes too much problems, I'll probably modify it to use >PATH=/usr/bin:/usr/games unless there is some clarification if this is a
bug worth reporting.
Simon McVittie <[email protected]> writes:
I hope that
packages don't assume that /usr/games is in the PATH at build time in
any case.
Is it a bug if they do? Buildd's have /usr/games in the default PATH so
I don't think we notice now.
My archive rebuild now uses PATH=/usr/bin so I will get breakage for any >package that FTBFS because of missing /usr/games in PATH.
That's not clear. Different developers have different interpretations of what "packages must build successfully from source" means - as a minimum they need to be buildable on our official buildds, but the more differences from that we're willing tosupport, the more likely it is for users and developers to be able to rebuild a package successfully with changes of their choice. I think the rough consensus is "packages should build successfully on normal systems", and then we inevitably get into
El 7/5/25 a las 21:44, Simon McVittie escribi�:
That's not clear. Different developers have differentinterpretations of what "packages must build successfully from source"
means - as a minimum they need to be buildable on our official
buildds, but the more differences from that we're willing to support,
the more likely it is for users and developers to be able to rebuild a package successfully with changes of their choice. I think the rough consensus is "packages should build successfully on normal systems",
and then we inevitably get into arguments about whether a particular
system is or isn't normal.
No, I don't think that's the consensus. Policy says "must", not "should".
You could probably say that the "must" only applies to "normal systems", but by using both "should" and "normal" in your characterization of "consensus", you are already deviating two steps from what Policy says. If you think Policy
does not really represent the consensus, you should probably propose an amendment.
You could probably say that the "must" only applies to "normal systems", but >> by using both "should" and "normal" in your characterization of "consensus", >> you are already deviating two steps from what Policy says. If you think Policy
does not really represent the consensus, you should probably propose an amendment.
But does Policy say anything about the PATH variable content when
building packages?
Vincent Lefevre <[email protected]> writes:
On 2025-05-07 14:40:01 +0200, Simon Josefsson wrote:
I think a reasonable conservative system policy is PATH=/usr/bin and
anything beyond that is something the user or system administrator have
to add. I think we should give up on /usr/games and move those
executables to /usr/bin, renaming any binaries that conflict.
I disagree. root should not have games in his path. This could also
annoy non-root users.
That is a good point. Hmm. There is a lot more in /usr/bin that I
wouldn't want root to have in PATH either, so I'm not sure I agree that
the /usr/games exception gives root sufficient protection. Given that
it is permissable to have naming conflicts as in /usr/bin/foo and /usr/games/foo, I would prefer the situation where everything under /usr/games was moved to /usr/bin and renamed on naming conflicts. Then
root doesn't have to consider the possibility that invoking 'foo' may
somehow end up running /usr/games/foo instead of /usr/bin/foo depending
on PATH confusion.
On 2025-05-07 18:18:25 +0200, Simon Josefsson wrote:
Vincent Lefevre <[email protected]> writes:
On 2025-05-07 14:40:01 +0200, Simon Josefsson wrote:
I think a reasonable conservative system policy is PATH=/usr/bin and
anything beyond that is something the user or system administrator have >> >> to add. I think we should give up on /usr/games and move those
executables to /usr/bin, renaming any binaries that conflict.
I disagree. root should not have games in his path. This could also
annoy non-root users.
That is a good point. Hmm. There is a lot more in /usr/bin that I
wouldn't want root to have in PATH either, so I'm not sure I agree that
the /usr/games exception gives root sufficient protection. Given that
it is permissable to have naming conflicts as in /usr/bin/foo and
/usr/games/foo, I would prefer the situation where everything under
/usr/games was moved to /usr/bin and renamed on naming conflicts. Then
root doesn't have to consider the possibility that invoking 'foo' may
somehow end up running /usr/games/foo instead of /usr/bin/foo depending
on PATH confusion.
Note that this is not just for protection, but also for command
completion. Having many executables makes completion less useful.
Non-root users may currently drop /usr/games from their path.
I challenge that may be pre-mature optimization:
jas@kaka:~$ ls /usr/bin/|wc -l
4675
jas@kaka:~$ ls /usr/games/|wc -l
21
jas@kaka:~$
On 2025-05-08 03:08:17 +0200, Simon Josefsson wrote:
I challenge that may be pre-mature optimization:
jas@kaka:~$ ls /usr/bin/|wc -l
4675
jas@kaka:~$ ls /usr/games/|wc -l
21
jas@kaka:~$
Indeed. I thought that there were a lot more in /usr/games.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1104784
There are packages that invoke Gradle during package builds that will
FTBFS until that bug is fixed.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 10:09:09 |
| Calls: | 12,100 |
| Files: | 15,003 |
| Messages: | 6,517,975 |