FS#73998 - [busybox] is built with standalone shell

Attached to Project: Community Packages
Opened by Thomas Dy (stoichyu) - Tuesday, 01 March 2022, 08:46 GMT
Last edited by George Rawlinson (rawlinsong) - Tuesday, 31 May 2022, 03:30 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Caleb Maclennan (alerque)
George Rawlinson (rawlinsong)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Description:

community/busybox is built with standalone shell (CONFIG_FEATURE_SH_STANDALONE) which means that when using it as a shell, it will prioritize built-in busybox commands over PATH. This causes problems when used as /bin/sh in nix as build scripts do not expect to be provided with busybox versions of common build tools.

I'm not sure if the option was a conscious decision, it seems to have been set that way from the very first PKGBUILD in the repo. If we believe this is necessary, can we have a separate busybox-nix with the option turned off for use with nix?

Steps to reproduce:

1. Run `busybox sh`
2. Run `cp --version` and you get busybox cp, not the one in /usr/bin
This task depends upon

Closed by  George Rawlinson (rawlinsong)
Tuesday, 31 May 2022, 03:30 GMT
Reason for closing:  Implemented
Additional comments about closing:  Added nix-busybox.
Comment by Thomas Dy (stoichyu) - Tuesday, 01 March 2022, 09:08 GMT
As a workaround for the nix issue, it's possible to replace the provided busybox by adding

sandbox-paths = /bin/sh=/path/to/static/busybox

to nix.conf
Comment by Thomas Dy (stoichyu) - Thursday, 03 March 2022, 05:54 GMT
Oh sorry, the flag that cause the problem in question is CONFIG_FEATURE_PREFER_APPLETS, not the standalone shell one
Comment by Thomas Dy (stoichyu) - Thursday, 03 March 2022, 06:22 GMT
Ah, my mistake again, it is indeed CONFIG_FEATURE_SH_STANDALONE. There doesn't seem to be an option for "use built-in applets only if not in PATH" so it might be better to just have a separate package if the purpose of this busybox package is for use as a rescue shell (where you might not have a valid PATH)
Comment by Ivan Tham (pickfire) - Saturday, 05 March 2022, 06:34 GMT
In the meantime, I just rebuild busybox with the flag disabled, `CONFIG_FEATURE_SH_STANDALONE=n` and use that for nix, then it seemed to work fine now.
Comment by George Rawlinson (rawlinsong) - Tuesday, 31 May 2022, 02:12 GMT
Related issues:

* https://github.com/NixOS/nix/pull/6568
* https://github.com/MinaProtocol/mina/issues/11071

A last resort would be either to disable sandboxing in Nix, or creating nix-busybox package (install busybox to /usr/lib/nix), but I don't like either option.

We'll see what upstream come back with.

Loading...