unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* patch-shebang and Rust - Change on core-updates?
@ 2020-01-20 19:28 Danny Milosavljevic
  2020-01-20 23:24 ` Andreas Rottmann
  2020-01-25 17:26 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Danny Milosavljevic @ 2020-01-20 19:28 UTC (permalink / raw)
  To: guix-devel

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

Hi,

Rust uses #![...] for something that is definitely not a shebang
(file-wide feature tests).

Currently, our patch-shebang[1] emits a lot of warnings because of those.

Should we change patch-shebang to ignore lines starting with "#![" ?

If so, how?  There's some get-char* magic that I don't understand.

The easiest way would be to add peek-char after the two calls to get-char*,
but not sure if that would work.

Alternatively, we could adapt the regexp.

>(define patch-shebang
>  (let ((shebang-rx (make-regexp "^[[:blank:]]*([[:graph:]]+)[[:blank:]]*([[:graph:]]*)(.*)$")))

The [[:graph:]]+ would have to change to something like 

  [[:graph-without-opening-bracket:]][[:graph:]]+

[1] ./guix/build/utils.scm patch-shebang

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: patch-shebang and Rust - Change on core-updates?
  2020-01-20 19:28 patch-shebang and Rust - Change on core-updates? Danny Milosavljevic
@ 2020-01-20 23:24 ` Andreas Rottmann
  2020-01-25 17:26 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Rottmann @ 2020-01-20 23:24 UTC (permalink / raw)
  To: guix-devel


[ Note that this is my first post on this list, and I'm posting via
  gmane, so if I'm messing something up, please let me know, either
  on-list, or in private, whichever you deem more appropriate ]

Danny Milosavljevic <dannym@scratchpost.org> writes:

> Hi,
>
> Rust uses #![...] for something that is definitely not a shebang
> (file-wide feature tests).
>
Just some background info regarding Rust syntax:

These are attributes applied to the enclosing file, common examples
including #![feature(...)] to enable nightly-only features,
#![deny(unsafe_code)], to deny the use of `unsafe` in the codebase
(crate), and more. As those need to be placed before any actual code,
and it is common for Rust files to not have preceding comments,
encountering those at the very start of the file, where a shebang could
occur, is indeed bound to be (and stay) a common occurence.

> Currently, our patch-shebang[1] emits a lot of warnings because of those.
>
> Should we change patch-shebang to ignore lines starting with "#![" ?
>
Note that Rust is not the only language that has a construct conflicting
with the sheebang pattern as described, e.g. #!r6rs or #!case-fold in
Scheme; there might be others as well. Wouldn't "#!/" work to detect
sheebangs reliably? Are there legitimate sheebangs that do not use an
absolute file name?

Regards, Rotty

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

* Re: patch-shebang and Rust - Change on core-updates?
  2020-01-20 19:28 patch-shebang and Rust - Change on core-updates? Danny Milosavljevic
  2020-01-20 23:24 ` Andreas Rottmann
@ 2020-01-25 17:26 ` Ludovic Courtès
  2020-02-17 15:55   ` Danny Milosavljevic
  1 sibling, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2020-01-25 17:26 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Hi,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> Rust uses #![...] for something that is definitely not a shebang
> (file-wide feature tests).
>
> Currently, our patch-shebang[1] emits a lot of warnings because of those.
>
> Should we change patch-shebang to ignore lines starting with "#![" ?
>
> If so, how?  There's some get-char* magic that I don't understand.
>
> The easiest way would be to add peek-char after the two calls to get-char*,
> but not sure if that would work.
>
> Alternatively, we could adapt the regexp.
>
>>(define patch-shebang
>>  (let ((shebang-rx (make-regexp "^[[:blank:]]*([[:graph:]]+)[[:blank:]]*([[:graph:]]*)(.*)$")))
>
> The [[:graph:]]+ would have to change to something like 
>
>   [[:graph-without-opening-bracket:]][[:graph:]]+

Or rather: /[[:graph:]]+ ?

A real shebang has to be an absolute file name so it must start with a
slash.

If that works for you, I’d say it’s OK to do that on ‘core-updates’.

Thanks,
Ludo’.

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

* Re: patch-shebang and Rust - Change on core-updates?
  2020-01-25 17:26 ` Ludovic Courtès
@ 2020-02-17 15:55   ` Danny Milosavljevic
  0 siblings, 0 replies; 4+ messages in thread
From: Danny Milosavljevic @ 2020-02-17 15:55 UTC (permalink / raw)
  Cc: guix-devel

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

Hi,

okay, I've done that in guix in branch core-updates,
commit 88f85494491a0cd4d4262c97860f01e99c2bc313.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-02-17 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 19:28 patch-shebang and Rust - Change on core-updates? Danny Milosavljevic
2020-01-20 23:24 ` Andreas Rottmann
2020-01-25 17:26 ` Ludovic Courtès
2020-02-17 15:55   ` Danny Milosavljevic

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).