Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909736 - sys-apps/portage-3.0.30.1_prefix uses bash from /bin unconditionally, even when it doesn't work or exist
Summary: sys-apps/portage-3.0.30.1_prefix uses bash from /bin unconditionally, even wh...
Status: UNCONFIRMED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-05 15:14 UTC by jonys
Modified: 2023-08-11 16:30 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jonys 2023-07-05 15:14:28 UTC
The Prefix-enabled Portage tries to invoke Bash as "/bin/bash", even though it just bootstrapped its own new version into PREFIX.

Reproducible: Always

Steps to Reproduce:
1. Try to bootstrap Prefix.
2. At the start of stage2, the bootstrap-prefix.sh script runs `emerge sys-devel/gnuconfig`.
Actual Results:  
If `/bin/bash` doesn't exist, the command fails and prints:
```
Failed to validate a sane '/dev'.
bash process substitution doesn't work; this may be an indication of a broken '/dev/fd'.
```

The message is misleading, the actual culprit is that `portage.process.spawn_bash()` doesn't work – it failed while testing process substitution, but any other command would have failed as well. The test had STDERR redirected to /dev/null, but when running it in Python REPL without the redirection, it prints a message starting with `[Errno 2] No such file or directory: b'/bin/bash'`.

The problematic part is `BASH_BINARY` in lib/portage/const.py, which is always defined as "/bin/bash". It should be patched to point to somewhere in the PREFIX.

Expected Results:  
Emerge should invoke the bootstrapped Bash from the prefix. When the BASH_BINARY variable is manually edited to point there, Portage works.

The problem was discovered on HP-UX 11.11 @ HP-PA, but it doesn't seem to be platform dependent.
Comment 1 jonys 2023-07-09 07:16:00 UTC
A hardcoded path to `bash` is also present in `ecompress` and `estrip`, resulting in `/opt/gentoo/tmp/usr/lib/portage/bin/ecompress: cannot execute: required file not found` errors when emerging files.