all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* git-annex: problematic shebangs in .git/hooks/pre-commit?
@ 2018-08-23 16:02 Kyle Meyer
  2018-08-23 16:44 ` Timothy Sample
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2018-08-23 16:02 UTC (permalink / raw)
  To: guix-devel

Hello,

Thanks for packaging git-annex, Tim!  I'm excited to see it in Guix.

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/bin/sh
    # automatically configured by git-annex
    git annex pre-commit .

But won't this break if that particular bash-mininimal is garbage collected?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-annex: problematic shebangs in .git/hooks/pre-commit?
  2018-08-23 16:02 git-annex: problematic shebangs in .git/hooks/pre-commit? Kyle Meyer
@ 2018-08-23 16:44 ` Timothy Sample
  2018-08-23 17:05   ` Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Timothy Sample @ 2018-08-23 16:44 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: guix-devel

Hi Kyle,

Kyle Meyer <kyle@kyleam.com> writes:

> Hello,
>
> Thanks for packaging git-annex, Tim!  I'm excited to see it in Guix.

You’re welcome!

> 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/bin/sh
>     # automatically configured by git-annex
>     git annex pre-commit .
>
> But won't this break if that particular bash-mininimal is garbage collected?

My understanding is that since git-annex contains a reference to
bash-minimal, the garbage collector will leave it alone.  Indeed,
running “guix gc --references /gnu/store/…-git-annex-20180626” 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.


-- Tim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-annex: problematic shebangs in .git/hooks/pre-commit?
  2018-08-23 16:44 ` Timothy Sample
@ 2018-08-23 17:05   ` Kyle Meyer
  2018-08-23 20:07     ` Timothy Sample
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2018-08-23 17:05 UTC (permalink / raw)
  To: Timothy Sample; +Cc: guix-devel

Timothy Sample <samplet@ngyro.com> 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/bin/sh
>>     # automatically configured by git-annex
>>     git annex pre-commit .
>>
>> But won't this break if that particular bash-mininimal is garbage collected?
>
> My understanding is that since git-annex contains a reference to
> bash-minimal, the garbage collector will leave it alone.  Indeed,
> running “guix gc --references /gnu/store/…-git-annex-20180626” 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-annex: problematic shebangs in .git/hooks/pre-commit?
  2018-08-23 17:05   ` Kyle Meyer
@ 2018-08-23 20:07     ` Timothy Sample
  2019-01-29 23:14       ` Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Timothy Sample @ 2018-08-23 20:07 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: guix-devel

Hi Kyle,

Kyle Meyer <kyle@kyleam.com> writes:

> Timothy Sample <samplet@ngyro.com> 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/bin/sh
>>>     # automatically configured by git-annex
>>>     git annex pre-commit .
>>>
>>> But won't this break if that particular bash-mininimal is garbage
>>> collected?
>>
>> My understanding is that since git-annex contains a reference to
>> bash-minimal, the garbage collector will leave it alone.  Indeed,
>> running “guix gc --references /gnu/store/…-git-annex-20180626” 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.

Ah yes!  That could be a problem indeed.  Good catch.  Following the
example of autoconf, it seems it should just be left alone.  I will fix
it shortly.  (Right now git-annex doesn’t even build, so I will fix that
first!)

Thanks!


-- Tim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-annex: problematic shebangs in .git/hooks/pre-commit?
  2018-08-23 20:07     ` Timothy Sample
@ 2019-01-29 23:14       ` Kyle Meyer
  2019-02-03 19:47         ` Timothy Sample
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2019-01-29 23:14 UTC (permalink / raw)
  To: Timothy Sample; +Cc: guix-devel

Timothy Sample <samplet@ngyro.com> writes:

> Kyle Meyer <kyle@kyleam.com> writes:

[...]

>> 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.
>
> Ah yes!  That could be a problem indeed.  Good catch.  Following the
> example of autoconf, it seems it should just be left alone.

Revisiting this, I tried to simply remove the patch-shell phase (diff
below).  That worked as intended when I tested manually, but it caused
many test failures with messages like

    fatal: cannot run .git/hooks/pre-commit: No such file or directory

Although the error message isn't too clear, this happens because
/bin/sh, now used in the hook shebangs, isn't available to the tests
executed in the build environment.

Any suggestions on how to deal with this?

---
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index dc2abb0c71..56fe6f5e7a 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -2236,11 +2236,6 @@ (define-public git-annex
        '("--flags=-Android -Assistant -Pairing -S3 -Webapp -WebDAV")
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'patch-shell
-           (lambda _
-             (substitute* "Utility/Shell.hs"
-               (("/bin/sh") (which "sh")))
-             #t))
          (add-before 'configure 'factor-setup
            (lambda _
              ;; Factor out necessary build logic from the provided

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: git-annex: problematic shebangs in .git/hooks/pre-commit?
  2019-01-29 23:14       ` Kyle Meyer
@ 2019-02-03 19:47         ` Timothy Sample
  0 siblings, 0 replies; 6+ messages in thread
From: Timothy Sample @ 2019-02-03 19:47 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: guix-devel

Hi Kyle,

Kyle Meyer <kyle@kyleam.com> writes:

> Timothy Sample <samplet@ngyro.com> writes:
>
>> Kyle Meyer <kyle@kyleam.com> writes:
>
> [...]
>
>>> 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.
>>
>> Ah yes!  That could be a problem indeed.  Good catch.  Following the
>> example of autoconf, it seems it should just be left alone.
>
> Revisiting this, I tried to simply remove the patch-shell phase (diff
> below).  That worked as intended when I tested manually, but it caused
> many test failures with messages like
>
>     fatal: cannot run .git/hooks/pre-commit: No such file or directory
>
> Although the error message isn't too clear, this happens because
> /bin/sh, now used in the hook shebangs, isn't available to the tests
> executed in the build environment.

Thanks for giving this a try!

> Any suggestions on how to deal with this?

I am travelling at the moment, so I can’t dig into it properly.  I
crossed my fingers and tried symlinking /bin/sh to bash, but did not
have permission to make the /bin directory.  (I guessed the build user
would be able to do this from within the build environment, but
apparently not.)  It would be ideal to set up the build environment like
this, but I’m not sure how.

> ---
> diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
> index dc2abb0c71..56fe6f5e7a 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -2236,11 +2236,6 @@ (define-public git-annex
>         '("--flags=-Android -Assistant -Pairing -S3 -Webapp -WebDAV")
>         #:phases
>         (modify-phases %standard-phases
> -         (add-before 'configure 'patch-shell
> -           (lambda _
> -             (substitute* "Utility/Shell.hs"
> -               (("/bin/sh") (which "sh")))
> -             #t))
>           (add-before 'configure 'factor-setup
>             (lambda _
>               ;; Factor out necessary build logic from the provided


-- Tim

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-03 19:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 16:02 git-annex: problematic shebangs in .git/hooks/pre-commit? Kyle Meyer
2018-08-23 16:44 ` Timothy Sample
2018-08-23 17:05   ` Kyle Meyer
2018-08-23 20:07     ` Timothy Sample
2019-01-29 23:14       ` Kyle Meyer
2019-02-03 19:47         ` Timothy Sample

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.