Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debootstrap: fix up paths to {chroot,unshare}, small clean up #48754

Merged
merged 1 commit into from Oct 20, 2018
Merged

debootstrap: fix up paths to {chroot,unshare}, small clean up #48754

merged 1 commit into from Oct 20, 2018

Conversation

pbogdan
Copy link
Member

@pbogdan pbogdan commented Oct 20, 2018

Fixes #45915.

Motivation for this change

Not feeling strongly about the various clean ups; the minimal changes to make debootstrap work again are changing the $CHROOT_CMD variable and changing the script interpreter from sh to bash. Also the way the previous wrapper was implemented would retain references to gcc and various other build tools provided by stdenv.
Would be nice to have this in some form on 18.09 too as debootstrap on the release branch is also not functional ATM.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Haven't tested very extensively outside of building stable / unstable Debian chroot.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: debootstrap

Partial log (click to expand)

post-installation fixup
moving /nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109/man to /nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109/share/man
shrinking RPATHs of ELF executables and libraries in /nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109
gzipping man pages under /nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109/share/man/
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109/bin
patching script interpreter paths in /nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109
/nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109/bin/.debootstrap-wrapped: interpreter directive changed from "/bin/bash" to "/nix/store/dsyc1z7ck08ga7l0b1jcxx35wj69qcii-bash-4.4-p23/bin/bash"
checking for references to /build in /nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109...
/nix/store/kkw51rnzjizlc4nms6jbh5jys7q84g0h-debootstrap-1.0.109

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: debootstrap

Partial log (click to expand)

post-installation fixup
moving /nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109/man to /nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109/share/man
shrinking RPATHs of ELF executables and libraries in /nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109
gzipping man pages under /nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109/share/man/
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109/bin
patching script interpreter paths in /nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109
/nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109/bin/.debootstrap-wrapped: interpreter directive changed from "/bin/bash" to "/nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin/bash"
checking for references to /build in /nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109...
/nix/store/140ps4yjilb60bwmrdjqipkib3cjfg00-debootstrap-1.0.109

--replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
--replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${utillinux}/bin/unshare ' \
--replace /usr/bin/dpkg ${dpkg}/bin/dpkg \
--replace '#!/bin/sh' '#!/bin/bash' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not replace anyway?

Copy link
Member Author

@pbogdan pbogdan Oct 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interpreter gets patched, yes (if that's what you meant). The issue is that the script relies on some bash-isms which is why I change sh to bash here. I left a comment on the upstream commit here that perhaps makes more sense - https://salsa.debian.org/installer-team/debootstrap/commit/15b20e644b407602288402f97fc348b00921cc54#note_48468 LMK If not!
Sorry if I misunderstood the question and thanks for the merge! Would be nice to have some sort of a backport too. The version on the stable branch is a bit behind but not working so perhaps it would be fine to backport the package updates + this commit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting because debian also has dash as /bin/sh.

@Mic92 Mic92 merged commit d105cf5 into NixOS:master Oct 20, 2018
@Mic92
Copy link
Member

Mic92 commented Oct 21, 2018

backport:

[detached HEAD b76a837] debootstrap: 1.0.107 -> 1.0.108 (#46294)
Author: R. RyanTM ryantm-bot@ryantm.com
Date: Tue Sep 11 14:38:42 2018 -0700
1 file changed, 2 insertions(+), 2 deletions(-)
[detached HEAD 5b2a976] debootstrap: 1.0.108 -> 1.0.109
Author: R. RyanTM ryantm-bot@ryantm.com
Date: Thu Sep 20 16:41:18 2018 -0700
1 file changed, 2 insertions(+), 2 deletions(-)
[detached HEAD 1408671] debootstrap: fix up paths to {chroot,unshare}, small clean up
Author: Piotr Bogdan ppbogdan@gmail.com
Date: Fri Oct 19 23:24:21 2018 +0100
1 file changed, 67 insertions(+), 76 deletions(-)
rewrite pkgs/tools/misc/debootstrap/default.nix (66%)

@pbogdan pbogdan deleted the debootstrap branch December 3, 2019 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants