GNU bug report logs - #61094
[PATCH] doc: Document 'shebang' for 'guix shell'.

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Fri, 27 Jan 2023 11:13:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61094 in the body.
You can then email your comments to 61094 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#61094; Package guix-patches. (Fri, 27 Jan 2023 11:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 27 Jan 2023 11:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH] doc: Document 'shebang' for 'guix shell'.
Date: Fri, 27 Jan 2023 12:12:37 +0100
* doc/guix.texi (Invoking guix shell): Add a note mentioning how to use
'shebang'.
---
 doc/guix.texi | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 2b1ad77ba5..acda01c8e6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@*
 Copyright @copyright{} 2019 Alex Griffin@*
 Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le Vaillant@*
 Copyright @copyright{} 2020 Liliana Marie Prikler@*
-Copyright @copyright{} 2019, 2020, 2021, 2022 Simon Tournier@*
+Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@*
 Copyright @copyright{} 2020 Wiktor Żelazny@*
 Copyright @copyright{} 2020 Damien Cassou@*
 Copyright @copyright{} 2020 Jakub Kądziołka@*
@@ -5923,6 +5923,19 @@ building or downloading any missing package, and runs the
 guix shell python python-numpy -- python3
 @end example
 
+@quotation Note
+@cindex shebang
+@command{guix shell} can be used as @emph{shebang}.  Consider the
+previous example as an executable Python script, the @emph{shebang}
+reads,
+
+@example
+#!/usr/bin/env -S guix shell python python-nympy -- python3
+@end example
+
+All the @var{options} or convenience of @command{guix shell} apply.
+@end quotation
+
 Development environments can be created as in the example below, which
 spawns an interactive shell containing all the dependencies and
 environment variables needed to work on Inkscape:

base-commit: 8e1cca32b938cef0812ce042c6c2e8bccb326ec7
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#61094; Package guix-patches. (Fri, 03 Feb 2023 22:55:01 GMT) Full text and rfc822 format available.

Message #8 received at 61094 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Simon Tournier <zimon.toutoune <at> gmail.com>, 61094 <at> debbugs.gnu.org
Subject: Re: [PATCH] doc: Document 'shebang' for 'guix shell'.
Date: Fri, 03 Feb 2023 23:54:38 +0100
Am Freitag, dem 27.01.2023 um 12:12 +0100 schrieb Simon Tournier:
> * doc/guix.texi (Invoking guix shell): Add a note mentioning how to
> use
> 'shebang'.
> ---
>  doc/guix.texi | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 2b1ad77ba5..acda01c8e6 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@*
>  Copyright @copyright{} 2019 Alex Griffin@*
>  Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le
> Vaillant@*
>  Copyright @copyright{} 2020 Liliana Marie Prikler@*
> -Copyright @copyright{} 2019, 2020, 2021, 2022 Simon Tournier@*
> +Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@*
>  Copyright @copyright{} 2020 Wiktor Żelazny@*
>  Copyright @copyright{} 2020 Damien Cassou@*
>  Copyright @copyright{} 2020 Jakub Kądziołka@*
> @@ -5923,6 +5923,19 @@ building or downloading any missing package,
> and runs the
>  guix shell python python-numpy -- python3
>  @end example
>  
> +@quotation Note
> +@cindex shebang
> +@command{guix shell} can be used as @emph{shebang}.  Consider the
> +previous example as an executable Python script, the @emph{shebang}
> +reads,
> +
> +@example
> +#!/usr/bin/env -S guix shell python python-nympy -- python3
> +@end example
> +
> +All the @var{options} or convenience of @command{guix shell} apply.
> +@end quotation
> +
Is this really guix running as a shell or is it actually a feature of
env?  In either case, it's worth documenting, but we should try to stay
factually correct.

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#61094; Package guix-patches. (Tue, 07 Feb 2023 12:00:02 GMT) Full text and rfc822 format available.

Message #11 received at 61094 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 61094 <at> debbugs.gnu.org
Subject: Re: [bug#61094] [PATCH] doc: Document 'shebang' for 'guix shell'.
Date: Tue, 07 Feb 2023 12:48:54 +0100
Hi,

On Fri, 03 Feb 2023 at 23:54, Liliana Marie Prikler <liliana.prikler <at> gmail.com> wrote:

>> +@quotation Note
>> +@cindex shebang
>> +@command{guix shell} can be used as @emph{shebang}.  Consider the
>> +previous example as an executable Python script, the @emph{shebang}
>> +reads,
>> +
>> +@example
>> +#!/usr/bin/env -S guix shell python python-nympy -- python3
>> +@end example
>> +
>> +All the @var{options} or convenience of @command{guix shell} apply.
>> +@end quotation
>> +
>
> Is this really guix running as a shell or is it actually a feature of
> env?  In either case, it's worth documenting, but we should try to stay
> factually correct.

Well, I am not sure to understand the question.  It is a feature of env
which allows to run “guix shell” which provides python3 as “shell”.

From my understanding, all written seems factually correct.  Maybe I am
missing something and I would be happy to be corrected if I am doing
wrong. :-)

Cheers,
simon




Information forwarded to guix-patches <at> gnu.org:
bug#61094; Package guix-patches. (Thu, 09 Feb 2023 16:08:01 GMT) Full text and rfc822 format available.

Message #14 received at 61094 <at> debbugs.gnu.org (full text, mbox):

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 61094 <at> debbugs.gnu.org
Subject: Re: bug#61094: [PATCH] doc: Document 'shebang' for 'guix shell'.
Date: Thu, 09 Feb 2023 11:07:19 -0500
Hello,

>>> +@example
>>> +#!/usr/bin/env -S guix shell python python-nympy -- python3
>>> +@end example

Apparently, according to POSIX you're only allowed one argument on the
'#!' line after the path of the executable.  I haven't confirmed this
myself but it is in the guile manual, section 4.3.2 "The Meta Switch".

One argument does seem quite limiting though so I wonder if anyone
actually imposes that limit.


Morgan




Information forwarded to guix-patches <at> gnu.org:
bug#61094; Package guix-patches. (Thu, 16 Mar 2023 11:10:02 GMT) Full text and rfc822 format available.

Message #17 received at 61094 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Cc: 61094 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com>,
 zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: bug#61094: [PATCH] doc: Document 'shebang' for 'guix shell'.
Date: Thu, 16 Mar 2023 12:09:11 +0100
Hi,

Morgan Smith <Morgan.J.Smith <at> outlook.com> skribis:

>>>> +@example
>>>> +#!/usr/bin/env -S guix shell python python-nympy -- python3
>>>> +@end example
>
> Apparently, according to POSIX you're only allowed one argument on the
> '#!' line after the path of the executable.  I haven't confirmed this
> myself but it is in the guile manual, section 4.3.2 "The Meta Switch".
>
> One argument does seem quite limiting though so I wonder if anyone
> actually imposes that limit.

Yes, and ‘env -S’ is used to work around that limitation by splitting
that one argument.  It’s a GNU extension, which is fine in this context.

Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 16 Mar 2023 11:23:02 GMT) Full text and rfc822 format available.

Notification sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
bug acknowledged by developer. (Thu, 16 Mar 2023 11:23:02 GMT) Full text and rfc822 format available.

Message #22 received at 61094-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 61094-done <at> debbugs.gnu.org
Subject: Re: bug#61094: [PATCH] doc: Document 'shebang' for 'guix shell'.
Date: Thu, 16 Mar 2023 12:21:59 +0100
[Message part 1 (text/plain, inline)]
Hi Simon,

Simon Tournier <zimon.toutoune <at> gmail.com> skribis:

> * doc/guix.texi (Invoking guix shell): Add a note mentioning how to use
> 'shebang'.

Applied with the changes below.  

Thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/doc/guix.texi b/doc/guix.texi
index 9c1fc04265..aa98d7df4b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5940,16 +5940,19 @@ guix shell python python-numpy -- python3
 @end example
 
 @quotation Note
-@cindex shebang
-@command{guix shell} can be used as @emph{shebang}.  Consider the
-previous example as an executable Python script, the @emph{shebang}
-reads,
+@cindex shebang, for @command{guix shell}
+@command{guix shell} can be also be used as a script interpreter, also
+known as @dfn{shebang}.  Here is an example self-contained Python script
+making use of this feature:
 
 @example
-#!/usr/bin/env -S guix shell python python-nympy -- python3
+#!/usr/bin/env -S guix shell python python-numpy -- python3
+import numpy
+print("This is numpy", numpy.version.version)
 @end example
 
-All the @var{options} or convenience of @command{guix shell} apply.
+You may pass any @command{guix shell} option, but there's one caveat:
+the Linux kernel has a limit of 127 bytes on shebang length.
 @end quotation
 
 Development environments can be created as in the example below, which

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 13 Apr 2023 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.