Libtool's ltmain.sh should have its shebang preserved

  • Done
  • quality assurance status badge
Details
4 participants
  • Jack Hill
  • Ludovic Courtès
  • Marius Bakke
  • Miguel Ángel Arruga Vivas
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
important
Merged with
L
L
Ludovic Courtès wrote on 31 Dec 2016 00:34
Re: Seeking advice: preparing releases on GuixSD.
(name . Ricardo Wurmus)(address . rekado@elephly.net)
878tqx7zzj.fsf@gnu.org
Hi!

Ricardo Wurmus <rekado@elephly.net> skribis:

Toggle quote (8 lines)
> “ltmain.sh” is instantiated from a template by libtool. It originally
> contains a /bin/sh shebang, and I think it should not be patched when
> installed to
>
> /gnu/store/…-libtool-2.4.6/share/libtool/build-aux/ltmain.sh
>
> This seems like a bug to me.

Definitely:

Toggle snippet (4 lines)
$ head -1 $(find $(guix build libtool) -name ltmain.sh)
#!/gnu/store/qkw4zrwfybxww8f56nkb6hggxambk89b-bash-4.4.0/bin/sh

Opening a new bug now. This is with v0.12.0-176-ge087671.

Ludo’.
L
L
Ludovic Courtès wrote on 31 Jan 2017 22:01
control message for bug #25304
(address . control@debbugs.gnu.org)
8737fzeyfq.fsf@gnu.org
retitle 25304 Libtool's ltmain.sh should have its shebang preserved
L
L
Ludovic Courtès wrote on 31 Jan 2017 22:03
Re: bug#25304: Seeking advice: preparing releases on GuixSD.
(name . Ricardo Wurmus)(address . rekado@elephly.net)
87y3xrdjsd.fsf@gnu.org
ludo@gnu.org (Ludovic Courtès) skribis:

Toggle quote (17 lines)
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> “ltmain.sh” is instantiated from a template by libtool. It originally
>> contains a /bin/sh shebang, and I think it should not be patched when
>> installed to
>>
>> /gnu/store/…-libtool-2.4.6/share/libtool/build-aux/ltmain.sh
>>
>> This seems like a bug to me.
>
> Definitely:
>
> $ head -1 $(find $(guix build libtool) -name ltmain.sh)
> #!/gnu/store/qkw4zrwfybxww8f56nkb6hggxambk89b-bash-4.4.0/bin/sh
>
> Opening a new bug now. This is with v0.12.0-176-ge087671.

This was fixed by ng0 in 98341757c8c45fca8d2b53f9972f5c6a32cf2c95.

Ludo’.
Closed
L
L
Ludovic Courtès wrote on 21 Apr 2017 16:26
unarchive
(address . control@debbugs.gnu.org)
87shl125wh.fsf@gnu.org
unarchive 25304
thanks
L
L
Ludovic Courtès wrote on 21 Apr 2017 16:30
Libtool’s ltmain.sh still contains a /gnu/store shebang
(address . 25304@debbugs.gnu.org)
87mvb925po.fsf@gnu.org
Hi,

Commit 98341757c8c45fca8d2b53f9972f5c6a32cf2c95, which was meant to fix
this bug¹, actually failed to do so:

Toggle snippet (6 lines)
$ head -1 $(./pre-inst-env guix build libtool)/share/libtool/build-aux/ltmain.sh
#!/gnu/store/k7029k5va68lkapbzcycdzj7m5bjb4b8-bash-4.4.12/bin/sh
$ git describe
v0.12.0-3136-g7312c62d3

I think the problem is that we’re patching ltmain.in when we should
really be patching the final file, after the ‘patch-shebangs’ phase.

Ludo’.

J
J
Jack Hill wrote on 18 Mar 2020 21:31
Merging issues for not patching some shebang in examples
(address . control@debbugs.gnu.org)
alpine.DEB.2.20.2003181626290.19733@marsh.hcoop.net
reopen 25304
severity 25304 important
severity 25508 important
merge 25508 25304 26749
retitle 26749 mask files from shebang patcher (git, libtool and stagit)
J
J
Jack Hill wrote on 18 Mar 2020 21:37
Merge bugs related to masking files from shebang patcher
(address . control@debbugs.gnu.org)
alpine.DEB.2.20.2003181635570.19733@marsh.hcoop.net
unarchive 25304
reopen 25304
severity 25304 important
merge 25508 25304 26749
thanks
M
M
Miguel Ángel Arruga Vivas wrote on 13 Nov 2020 16:32
Re: bug#25304: Libtool’s ltmain.sh still contains a /gnu/store shebang
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 25304@debbugs.gnu.org)
87v9e9z30r.fsf@gmail.com
Hi,

I was looking through the lists because I have a patch that does exactly
what you describe here. I guess this goes to core updates, so this
version is on top of it. WDYT?

Happy hacking!
Miguel

ludo@gnu.org (Ludovic Courtès) writes:
Toggle quote (16 lines)
> Hi,
>
> Commit 98341757c8c45fca8d2b53f9972f5c6a32cf2c95, which was meant to fix
> this bug¹, actually failed to do so:
>
> $ head -1 $(./pre-inst-env guix build libtool)/share/libtool/build-aux/ltmain.sh
> #!/gnu/store/k7029k5va68lkapbzcycdzj7m5bjb4b8-bash-4.4.12/bin/sh
> $ git describe
> v0.12.0-3136-g7312c62d3
>
> I think the problem is that we’re patching ltmain.in when we should
> really be patching the final file, after the ‘patch-shebangs’ phase.
>
> Ludo’.
>
> ¹ <http://bugs.gnu.org/25304>
From 145273418d3131bcf3b73d416d19f641645cf3f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
<rosen644835@gmail.com>
Date: Fri, 13 Nov 2020 15:24:46 +0100
Subject: [PATCH] gnu: libtool: Restore shebangs on all libtoolize files.

* gnu/packages/autotools.scm (libtool)[restore-build-aux-shebang]: New
phase after install.
[restore-ltmain-shebang]: Remove phase, it is now performed by the phase
restore-build-aux-shebang.
---
gnu/packages/autotools.scm | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm
index 96f2925180..c9e1c9bcf1 100644
--- a/gnu/packages/autotools.scm
+++ b/gnu/packages/autotools.scm
@@ -444,11 +444,19 @@ Makefile, simplifying the entire process for the developer.")
(("/bin/sh")
(string-append bash "/bin/sh")))
#t)))
- (add-after 'patch-source-shebangs 'restore-ltmain-shebang
- (lambda* (#:key inputs #:allow-other-keys)
- (substitute* "build-aux/ltmain.in"
- (("^#!.*/bin/sh$") "#!/bin/sh"))
- #t)))))
+ ;; These files may be copied into source trees by libtoolize,
+ ;; therefore they must not point to store file names that would be
+ ;; leaked with tarballs generated by make dist.
+ (add-after 'install 'restore-build-aux-shebang
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (dir (string-append out "/share/libtool/build-aux")))
+ (for-each (lambda (file)
+ (format #t "restoring shebang on `~a'~%" file)
+ (substitute* file
+ (("^#!.*/bin/sh") "#!/bin/sh")))
+ (find-files dir ".*"))
+ #t))))))
(synopsis "Generic shared library support tools")
(description
--
2.29.2
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEiIeExBRZrMuD5+hMY0xuiXn6vsIFAl+upvQACgkQY0xuiXn6
vsJ6Xwv9FvnDwhtr63aPHozMYIOWtLuYZaj531dqkbC3vuZjGv9kM+i2qyRA0PPc
80aIWjB3viuQ5/4yLqD23fCNqkkgDKsFWGFPwKv9Lva1iaFurgskwIdsWDBQkp68
Jn0W+hJrMxqEg41PGXGOjnicVBb349M5ruuc65AtqboOFlx7/ETPcZouKd0oWUn4
89CZEIhjbcKf/DbXe1ouUrZMUKoEbpSU1rMVbtz+14fN2leqWfNFKVHNEnHTP3ho
VwMQvLwNwzKa2h4ynoDtjq4w/1Ewg/RzyExRRb2EJUFv37KMB4whE+Qj3TfGMaIa
5mY8N8tc6P8wmuQwr0Y5EE5gykJczjM55+1LsctCFDVTbAuJZZNfhmyQdUeDBJ3B
s7QwvYTAddFlEwgpPGUSgTTSb1VlGj95qg9YP2QQFTtT1D0jtIh6gE/LqEeOMHkp
aARwBxlEqqLJqQtWnJLQ1rh9Flg+KJYb0+MWC+3H4b+BLAJ7DckGHWHxl99AiYIm
B9fHHT7d
=Gnea
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 15 Nov 2020 12:08
(name . Miguel Ángel Arruga Vivas)(address . rosen644835@gmail.com)(address . 25304@debbugs.gnu.org)
87v9e6andh.fsf@gnu.org
Hi!

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

Toggle quote (4 lines)
> I was looking through the lists because I have a patch that does exactly
> what you describe here. I guess this goes to core updates, so this
> version is on top of it. WDYT?

Yes, looks like a change for ‘core-updates’.

Toggle quote (6 lines)
> From 145273418d3131bcf3b73d416d19f641645cf3f8 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
> <rosen644835@gmail.com>
> Date: Fri, 13 Nov 2020 15:24:46 +0100
> Subject: [PATCH] gnu: libtool: Restore shebangs on all libtoolize files.

You can add “Fixes https://bugs.gnu.org/25304.”

Toggle quote (5 lines)
> * gnu/packages/autotools.scm (libtool)[restore-build-aux-shebang]: New
> phase after install.
> [restore-ltmain-shebang]: Remove phase, it is now performed by the phase
> restore-build-aux-shebang.

LGTM, thanks for digging through old bugs!

Ludo’.
M
M
Miguel Ángel Arruga Vivas wrote on 16 Nov 2020 17:17
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 25304-done@debbugs.gnu.org)
871rgtxon2.fsf@gmail.com
Hi!

Ludovic Courtès <ludo@gnu.org> writes:
Toggle quote (27 lines)
> Hi!
>
> Miguel Ángel Arruga Vivas <rosen644835@gmail.com> skribis:
>
>> I was looking through the lists because I have a patch that does exactly
>> what you describe here. I guess this goes to core updates, so this
>> version is on top of it. WDYT?
>
> Yes, looks like a change for ‘core-updates’.
>
>> From 145273418d3131bcf3b73d416d19f641645cf3f8 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
>> <rosen644835@gmail.com>
>> Date: Fri, 13 Nov 2020 15:24:46 +0100
>> Subject: [PATCH] gnu: libtool: Restore shebangs on all libtoolize files.
>
> You can add “Fixes <https://bugs.gnu.org/25304>.”
>
>> * gnu/packages/autotools.scm (libtool)[restore-build-aux-shebang]: New
>> phase after install.
>> [restore-ltmain-shebang]: Remove phase, it is now performed by the phase
>> restore-build-aux-shebang.
>
> LGTM, thanks for digging through old bugs!
>
> Ludo’.

Pushed as 8d263ff254292c9e13a9848f90b52263da52d570 to core-updates with
that line added. Thanks for the quick review. :-)

Happy hacking!
Miguel
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEiIeExBRZrMuD5+hMY0xuiXn6vsIFAl+ypgIACgkQY0xuiXn6
vsIeDQwAqgWesDyQq/yKwp+5Tiw746kFAdlRPQDHPzYgTJls4wDGcFYBSfXcj9pA
W1sI6/wzYF7TmtZGCJlJHHOQNBrryoAhg8Q/r6TMMTESAiKJUNJt93Je8fZ8RVih
O8PqHUxCmLkBliSVUk0tQXsPEigd10uSGxqUBzRU9S15K547LhcqttPF80vkD/1F
CtqO2cAtBPje904nUjosRgZaOaSI9ceRLQD0+1+FNcowlDi90XGnf5KZlt1E3dhh
i36eTRe+vvwvql6m28Pkwg7BRmzzB6roDsUqHZUdR0n8JpOki8/pq4XXTSR2N6Xa
Jn9vc1LPqcY4com/N899M71z7Ad6zCGi4lYVNSjdlC1nj9jOQpipp18aKBeIbgkA
fSedbtDtkiyMmffkVz+fTmOwI7I1zn/TUUG0BWsYgxVg4IT0BAuBLcRmbQb3yyfm
8SDEHj0do2bSXIu8a3QTX+ubxOEc5op19pljBq7EqhsdppTT8z+QSnYiak83cT5L
53EzQ1Xt
=o+Gy
-----END PGP SIGNATURE-----

Closed
M
M
Miguel Ángel Arruga Vivas wrote on 16 Nov 2020 19:10
Re: bug#25508: Git hook shebangs should not be rewritten
(name . Leo Famulari)(address . leo@famulari.name)
87r1otw4ss.fsf@gmail.com
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
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.


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

Toggle diff (23 lines)
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
Leo Famulari <leo@famulari.name> writes:

Toggle quote (19 lines)
> 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'
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEiIeExBRZrMuD5+hMY0xuiXn6vsIFAl+ywLQACgkQY0xuiXn6
vsI5hQv+IfRGaTZ7A0Ulzdy54BxcVq/asGgJUcAG8HU/cZbxQDSjmbcWXoIomrI8
PyvVVmoFwm6RVFKvCZCFqFVIeKMzPZOjgWLV2gRLwBH1VR+oQG+1LT7WTULL8fGB
6ToYkKWqE3d7sZnE5J+jFjVclCXUVyzySIW0cCBT8jXei9sOTnO8+nby9/aBwMpT
+1sMz2qGZ4XR8arXPQnp1duDaBrqq4hPOcsMUH2NL86Widf3EkJ0F+CskU0z/Bi8
jufRuZcy9OfQXUHqoVOEvS9catdq9IAR4rGaYhRMHUiq796Bka232kATYkpTmjZz
pMFxyQNUkDQtRCVt8devE54Xliy6OTPD3w0RRn/3s78XKyCVCim2JQK0+40cDDHh
dnrUN1tkZ87ggHw1xth2NVdi4eKlKIqB4mAClH9QRyF2yW0EzGmjE27Lxbb3e9aM
+nSZHYo52VbKbUVGVkgmBwT9el9zGG/YcIbfO3oM71Pe18Xmmf7KropfvKgVhqaz
AAPVvykG
=3IH3
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 16 Nov 2020 19:42
Re: bug#25304: bug#25508: Git hook shebangs should not be rewritten
87h7pp9m99.fsf@gnu.org
Miguel Ángel Arruga Vivas <rosen644835@gmail.com> writes:

Toggle quote (4 lines)
> 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!).
-----BEGIN PGP SIGNATURE-----

iQFDBAEBCgAtFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl+yyBIPHG1hcml1c0Bn
bnUub3JnAAoJEKKgbfKjOlT63K4H/2TqeZuQEnTyDjzDyMHOTuuqaw1Ckbxep04O
9Bp9Dz00OX2qOrJLuviiSbN656G+gtA9phopvZiQhRQrkNt91S202zWQy96tPAHy
ikTNlONVqH1d8penErNSW7Ddzmi+IO16MxIvHSyme+wNo+zy3uirdO9LNEcSBr72
TI+YzkuKh3qFUbW7DMFKIKCdeRL4lwBE5pxdhXhsFLn/ecr9iFmHY9ZqI/C6OYIK
7Xi2sFt5vQu/MmP99N/mhqtURYz6AeRt6xQfMBj9HzXoTbYtoDgseVmfAvZfiQiq
7Q7NJnzBAjOGzmhlRcV8+Q0PrshOkfqzBZ4XSAgzQrZhQDYvOqk=
=1bUC
-----END PGP SIGNATURE-----

M
M
Miguel Ángel Arruga Vivas wrote on 16 Nov 2020 21:51
(name . Marius Bakke)(address . marius@gnu.org)
87ima5vxcw.fsf@gmail.com
Marius Bakke <marius@gnu.org> writes:

Toggle quote (9 lines)
> 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
?