all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25508: Git hook shebangs should not be rewritten
@ 2017-01-22 23:25 Leo Famulari
  2020-11-16 18:10 ` bug#25304: " Miguel Ángel Arruga Vivas
  0 siblings, 1 reply; 4+ messages in thread
From: Leo Famulari @ 2017-01-22 23:25 UTC (permalink / raw)
  To: 25508; +Cc: John Darrington

[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]

----- Forwarded message from John Darrington <john@darrington.wattle.id.au> -----

Date: Sun, 22 Jan 2017 14:01:24 +0100
From: John Darrington <john@darrington.wattle.id.au>
To: guix-devel@gnu.org
Subject: Not patching shebang in git hook samples ?
User-Agent: Mutt/1.5.23 (2014-03-12)

The git package ships with a number of sample hook files.  These are shell scripts and
therefore the #!/bin/sh line gets substituted at  build time.

However these files get installed into every git repostory that is created, and users
are invited to use them as templates for their own hooks.

This will be fine until both git and bash are updated.  Now the original bash is free
to be garbage collected.  If that happens, the path: 
#!/gnu/store/qkw4zrwfybxww8f56nkb6hggxambk89b-bash-4.4.0/bin/sh
will no longer exist.

I suggest what we turn off the shebang patching for the files in share/templates for git.

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.




----- End forwarded message -----

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#25304: bug#25508: Git hook shebangs should not be rewritten
  2017-01-22 23:25 bug#25508: Git hook shebangs should not be rewritten Leo Famulari
@ 2020-11-16 18:10 ` Miguel Ángel Arruga Vivas
  2020-11-16 18:42   ` Marius Bakke
  0 siblings, 1 reply; 4+ messages in thread
From: Miguel Ángel Arruga Vivas @ 2020-11-16 18:10 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 25304, 25508, John Darrington


[-- Attachment #1.1: Type: text/plain, Size: 243 bytes --]

Sorry, I've closed this with the libtool one.

The attached patch fixes this one too, should I push it to master (as
the last change for git) or to core-updates or staging (as it might seem
looking at the dependencies)?

Happy hacking!
Miguel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001.patch --]
[-- Type: text/x-patch, Size: 1643 bytes --]

From 9f0e9eea6d7c338fba234c2f8935ba76b1d94b2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Mon, 16 Nov 2020 19:06:40 +0100
Subject: [PATCH] gnu: git: Add phase to restore hooks shebang.

Fixes <https://bugs.gnu.org/25508>.

* gnu/packages/version-control.scm (git)[arguments]: New phase
restore-sample-hooks-shebang.
---
 gnu/packages/version-control.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 3e46a6162b..1842528ff6 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -391,6 +391,16 @@ as well as the classic centralized workflow.")
               (install-file "contrib/subtree/git-subtree.1"
                             (string-append subtree "/share/man/man1"))
               #t)))
+         (add-after 'install 'restore-sample-hooks-shebang
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (dir (string-append out "/share/git-core/templates/hooks")))
+               (for-each (lambda (file)
+                           (format #t "restoring shebang on `~a'~%" file)
+                           (substitute* file
+                             (("^#!.*/bin/sh") "#!/bin/sh")))
+                         (find-files dir ".*"))
+               #t)))
         (add-after 'install 'split
           (lambda* (#:key inputs outputs #:allow-other-keys)
             ;; Split the binaries to the various outputs.
-- 
2.29.2


[-- Attachment #1.3: Type: text/plain, Size: 913 bytes --]


Leo Famulari <leo@famulari.name> writes:

> From: John Darrington <john@darrington.wattle.id.au>
> Subject: Not patching shebang in git hook samples ?
> To: guix-devel@gnu.org
> Date: Sun, 22 Jan 2017 14:01:24 +0100 (3 years, 42 weeks, 4 days ago)
>
> The git package ships with a number of sample hook files.  These are shell scripts and
> therefore the #!/bin/sh line gets substituted at  build time.
>
> However these files get installed into every git repostory that is created, and users
> are invited to use them as templates for their own hooks.
>
> This will be fine until both git and bash are updated.  Now the original bash is free
> to be garbage collected.  If that happens, the path: 
> #!/gnu/store/qkw4zrwfybxww8f56nkb6hggxambk89b-bash-4.4.0/bin/sh
> will no longer exist.
>
> I suggest what we turn off the shebang patching for the files in share/templates for git.
>
> J'

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

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

* bug#25304: bug#25508: Git hook shebangs should not be rewritten
  2020-11-16 18:10 ` bug#25304: " Miguel Ángel Arruga Vivas
@ 2020-11-16 18:42   ` Marius Bakke
  2020-11-16 20:51     ` Miguel Ángel Arruga Vivas
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Bakke @ 2020-11-16 18:42 UTC (permalink / raw)
  To: Miguel Ángel Arruga Vivas, Leo Famulari
  Cc: 25304, 25508, John Darrington

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

Miguel Ángel Arruga Vivas <rosen644835@gmail.com> writes:

> The attached patch fixes this one too, should I push it to master (as
> the last change for git) or to core-updates or staging (as it might seem
> looking at the dependencies)?

LGTM.  Git (+ git-minimal) is below the 300 rebuild limit for 'master'
(and I try to keep it that way!).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

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

* bug#25304: bug#25508: Git hook shebangs should not be rewritten
  2020-11-16 18:42   ` Marius Bakke
@ 2020-11-16 20:51     ` Miguel Ángel Arruga Vivas
  0 siblings, 0 replies; 4+ messages in thread
From: Miguel Ángel Arruga Vivas @ 2020-11-16 20:51 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 25304, 25508, John Darrington

Marius Bakke <marius@gnu.org> writes:

> Miguel Ángel Arruga Vivas <rosen644835@gmail.com> writes:
>
>> The attached patch fixes this one too, should I push it to master (as
>> the last change for git) or to core-updates or staging (as it might seem
>> looking at the dependencies)?
>
> LGTM.  Git (+ git-minimal) is below the 300 rebuild limit for 'master'
> (and I try to keep it that way!).

Thanks for the info and the fast review, I wasn't sure if it was 109+242
or just 242.  I've pushed it to master as
46ce24fb2d8c9f7dce16c4c08919f0fc108dbfae.

Happy hacking!
Miguel




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

end of thread, other threads:[~2020-11-16 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-22 23:25 bug#25508: Git hook shebangs should not be rewritten Leo Famulari
2020-11-16 18:10 ` bug#25304: " Miguel Ángel Arruga Vivas
2020-11-16 18:42   ` Marius Bakke
2020-11-16 20:51     ` Miguel Ángel Arruga Vivas

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.