unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: Leo Famulari <leo@famulari.name>
Cc: 25304@debbugs.gnu.org, 25508@debbugs.gnu.org,
	John Darrington <jmd@gnu.org>
Subject: bug#25304: bug#25508: Git hook shebangs should not be rewritten
Date: Mon, 16 Nov 2020 19:10:59 +0100	[thread overview]
Message-ID: <87r1otw4ss.fsf@gmail.com> (raw)
In-Reply-To: <20170122232550.GB27876@jasmine> (Leo Famulari's message of "Sun,  22 Jan 2017 18:25:50 -0500")


[-- 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 --]

  reply	other threads:[~2020-11-16 18:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-11-16 18:42   ` bug#25304: " Marius Bakke
2020-11-16 20:51     ` Miguel Ángel Arruga Vivas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1otw4ss.fsf@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=25304@debbugs.gnu.org \
    --cc=25508@debbugs.gnu.org \
    --cc=jmd@gnu.org \
    --cc=leo@famulari.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).