help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is there any way to change what /bin/sh is inside `guix shell [--contain


From: Zack Weinberg
Subject: Is there any way to change what /bin/sh is inside `guix shell [--container]` ?
Date: Mon, 13 Mar 2023 16:16:41 -0400
User-agent: Cyrus-JMAP/3.9.0-alpha0-221-gec32977366-fm-20230306.001-gec329773

I'm doing experiments with using `guix shell --container` for isolated, 
reproducible build environments.  I've noticed that no matter how I set up the 
container, `/bin/sh` points to a full-fat bash, even if the full bash package 
was not included in the container profile.  For instance

```
guix shell --container bash-minimal coreutils -- sh -c 'ls -l $(command -v sh) 
/bin/sh'
lrwxrwxrwx 1 zack  users    61 Mar 13 20:07 /bin/sh -> 
/gnu/store/d99ykvj3axzzidygsmdmzxah4lvxd6hw-bash-5.1.8/bin/sh
lrwxrwxrwx 1 65534 overflow 69 Jan  1  1970 
/gnu/store/jc86p6d0i5b3aly5lx5lhb1xa35f2xk8-profile/bin/sh -> 
/gnu/store/chfwin3a4qp1znnpsjbmydr2jbzk0d6y-bash-minimal-5.1.8/bin/sh

$ guix shell --container busybox -- sh -c 'ls -l $(command -v sh) /bin/sh'
lrwxrwxrwx    1 65534    overflow         7 Jan  1  1970 
/gnu/store/96l76flyg617l23c5p32ysjbc72ywjgd-profile/bin/sh -> busybox
lrwxrwxrwx    1 zack       users           61 Mar 13 20:05 /bin/sh -> 
/gnu/store/d99ykvj3axzzidygsmdmzxah4lvxd6hw-bash-5.1.8/bin/sh
```

Is there any way to change or override this behavior?  What I want is for 
/bin/sh inside the container to be the same as $GUIX_ENVIRONMENT/bin/sh inside 
the container.

(If you're about to ask me, "but what if the container profile doesn't include 
a shell at all?", my response will be "in that case /bin/sh should not exist!"  
I can think of several reasons why I might do that on purpose.  Yes, I realize 
that system(3) won't work in such an environment -- that may in fact be (one of 
the) goals.)

zw



reply via email to

[Prev in Thread] Current Thread [Next in Thread]