From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: git-annex: problematic shebangs in .git/hooks/pre-commit? Date: Thu, 23 Aug 2018 13:05:09 -0400 Message-ID: <8736v5xbcq.fsf@kyleam.com> References: <876001xe9c.fsf@kyleam.com> <87wosh2ftj.fsf@ngyro.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fst2u-0002KQ-Be for guix-devel@gnu.org; Thu, 23 Aug 2018 13:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fst2q-0002tt-AY for guix-devel@gnu.org; Thu, 23 Aug 2018 13:05:20 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:58463) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fst2q-0002tA-1v for guix-devel@gnu.org; Thu, 23 Aug 2018 13:05:16 -0400 In-Reply-To: <87wosh2ftj.fsf@ngyro.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Timothy Sample Cc: guix-devel Timothy Sample writes: [...] >> I'm wondering whether the shebang patching in .git/hooks/pre-commit will >> cause a problem. Using the patched shellPath_portable, 'git annex init' >> generates a hook like this: >> >> % cat .git/hooks/pre-commit >> #!/gnu/store/rbrandv7anzjxqkr40d7fkanzssslk4b-bash-minimal-4.4.19/bi= n/sh >> # automatically configured by git-annex >> git annex pre-commit . >> >> But won't this break if that particular bash-mininimal is garbage collec= ted? > > My understanding is that since git-annex contains a reference to > bash-minimal, the garbage collector will leave it alone. Indeed, > running =E2=80=9Cguix gc --references /gnu/store/=E2=80=A6-git-annex-2018= 0626=E2=80=9D shows > that Guix knows that git-annex needs bash-minimal. As long as git-annex > is available (a prerequisite to the pre-commit hook working) > bash-minimal will be available. Hmm, I'm not convinced that *that* bash-minimal will be available. Perhaps I'm just missing something, but to spell out my concern a little more: I have /gnu/store/A/git-annex and /gnu/store/X/bash-minimal. I set up a repo with 'git annex init', and /gnu/store/X/bash-minimal/bin/sh is used in the shebang. Some time later I am using /gnu/store/B/git-annex, which references /gnu/store/Y/bash-minimal. That repo's hook still uses the X/bash-minimal/bin/sh. But if /gnu/store/X/bash-minimal is no longer referenced by any package, it could be garbage collected, leading to the hook failing.