On Fri, Jan 13, 2017 at 10:04:34AM -0500, Sam Hartman wrote: > >>>>> "Josh" == Josh Triplett <j...@joshtriplett.org> writes: > > Josh> As another technical alternative, which I haven't seen > Josh> mentioned elsewhere in this thread or related bug reports: > Josh> when I need to override a packaged binary or file temporarily > Josh> for debugging purposes, without forgetting to restore it > Josh> later, I tend to use "mount --bind /my/replacement > Josh> /usr/bin/foo". For instance, for local testing while > Josh> developing dh-cargo, which required a newer version of Cargo > Josh> than packaged in Debian at the time, I built a local version > Josh> of Cargo and did "mount --bind ~/src/cargo/target/debug/cargo > Josh> /usr/bin/cargo". That allowed me to easily test-build > Josh> packages before the availability of a Debian package of a > Josh> sufficiently new Cargo. > > O, cool, that's really need. > > And as a throw-back to an alternate Plan9 history, you could presumably > unshare your mount namespace and even do that for a subset of the > processes on a system, getting almost all the benefits of PATH.
Yes. Years ago, when Debian transitioned /bin/sh from bash to dash, Marco d'Itri posted a sample workaround for any scripts assuming bash, which involved unsharing the mount namespace, bind-mounting /bin/bash over /bin/sh, and then exec'ing a program.