jmmv / pkg_comp

Automates the build of pkgsrc binary packages in a sandbox
BSD 3-Clause "New" or "Revised" License
15 stars 3 forks source link

Don't find pkgsrc bash. It won't be in the sandbox. #29

Open schmonz opened 2 years ago

schmonz commented 2 years ago

This isn't mergeable as is, so don't worry that I don't have a signed contributor agreement. :-) But it's probably close enough for you to commit something that solves the problem.

The problem: on a platform where /bin/sh doesn't suffice for pkgsrc bootstrap and pkg_comp tries to find a bash, it's possible-to-likely that the host system has all of these properties:

  1. pkgsrc has been bootstrapped (presumably that's how we got pkgtools/pkg_comp installed)
  2. pkgsrc paths are early in $PATH, so that pkgsrc tools are found before system-provided ones
  3. shells/bash has been installed

In such cases, pkg_comp currently detects and chooses e.g. /usr/pkg/bin/bash as ${bootstrap_sh}. At some point early in the bootstrap, some build or other fails (one of the libnbcompat I think) because it's trying to run /usr/pkg/bin/bash, which is not available in the sandbox.

My change is a portion of what I'll commit to pkgsrc shortly (unless you recommend I don't): it removes pkgsrc paths from the $PATH that's in effect for which bash, so only a non-pkgsrc bash will be found. I've tested that this (in conjunction with the obvious SUBST) fixes the bootstrap on such platforms.

schmonz commented 2 years ago

I've committed this locally to pkgsrc.