Re: Alpine: useless-if-before-free: Exec format error

2019-06-24 Thread Tim Rühsen
On 6/23/19 6:32 PM, Jim Meyering wrote: > On Wed, Jun 19, 2019 at 3:12 AM Bruno Haible wrote: > ... >> Done like this: >> >> 2019-06-19 Bruno Haible >> >> Reorder pieces of header in perl scripts. >> The desired order is >> - Prologue part 1 (2 lines with #!) >>

Re: Alpine: useless-if-before-free: Exec format error

2019-06-23 Thread Jim Meyering
On Wed, Jun 19, 2019 at 3:12 AM Bruno Haible wrote: ... > Done like this: > > 2019-06-19 Bruno Haible > > Reorder pieces of header in perl scripts. > The desired order is > - Prologue part 1 (2 lines with #!) > - Program short description > - Copyright an

Re: Alpine: useless-if-before-free: Exec format error

2019-06-19 Thread Bruno Haible
Paul Eggert wrote: > > Prologue part 1 (2 lines with #!) > > Program short description > > Copyright and license notice > > Written-by notice > > Program short description (optional) > > Program long description > > Prologue part 2 > > Time stamp > > Cod

Re: Alpine: useless-if-before-free: Exec format error

2019-06-17 Thread Paul Eggert
On 6/17/19 6:32 PM, Bruno Haible wrote: In some cases, it will be useful to repeat the Program short description, then (for those who start reading after the license notice). Like this: Prologue part 1 (2 lines with #!) Program short description Copyright and license notice W

Re: Alpine: useless-if-before-free: Exec format error

2019-06-17 Thread Bruno Haible
Paul Eggert wrote: > > How about if we reorder it to: > >Prologue part 1 (2 lines with #!) > >Copyright and license notice > >Written-by notice > >Program short description > >Program long description > >Prologue part 2 > >Time stamp > >Code > > That would be better

Re: Alpine: useless-if-before-free: Exec format error

2019-06-17 Thread Paul Eggert
On 6/16/19 6:12 AM, Bruno Haible wrote: How about if we reorder it to: Prologue part 1 (2 lines with #!) Copyright and license notice Written-by notice Program short description Program long description Prologue part 2 Time stamp Code That would be better, but I'd still

Re: Alpine: useless-if-before-free: Exec format error

2019-06-16 Thread Bruno Haible
Paul Eggert wrote: > Your suggestion to use a followup > comment with fancy highlighting characters is less useful to my eyes; > I'm used to the more-standard convention of a short comment first. So, what can we do? Moving the prologue's comment to another file would be bad. Comments should be

Re: Alpine: useless-if-before-free: Exec format error

2019-06-15 Thread Paul Eggert
On 6/15/19 1:14 PM, Bruno Haible wrote: I found that they got in the way of my understanding the code Do you mean, we should highlight the comment about the program itself? Partly that - the first comment of a script should be very brief (typically one line) and say what the script does; it s

Re: Alpine: useless-if-before-free: Exec format error

2019-06-15 Thread Bruno Haible
Hi Paul, > One quibble: those long comments are > probably more trouble than they're worth. I heavily disagree: This piece of code needs to consider - the distinction between POSIX:2017 and earlier versions, - execlp/execvp vs. execl/execv, - GuixSD vs. traditional file system layouts, -

Re: Alpine: useless-if-before-free: Exec format error

2019-06-15 Thread Paul Eggert
Thanks for looking into and fixing that. One quibble: those long comments are probably more trouble than they're worth. I found that they got in the way of my understanding the code, as my eyes glazed over when reading them. And when I finally forced myself to read one, I found that at least one

Re: Alpine: useless-if-before-free: Exec format error

2019-06-15 Thread Darshit Shah
* Bruno Haible [190615 13:07]: > 2019-06-15 Bruno Haible > > Fix scripts to have valid executable format on Alpine Linux. > Reported by Tim Rühsen . > Idea by Paul Eggert. > * build-aux/useless-if-before-free: Use a prologue that starts with > '#!/bin/sh'. >

Re: Alpine: useless-if-before-free: Exec format error

2019-06-15 Thread Bruno Haible
Paul Eggert wrote: > suggests something like the > following instead. This would avoid having separate shell scripts and .pl > files, > which would be a plus: > > #!/bin/sh > #! −*−perl−*− > eval 'exec perl −x −wS $0 ${1+"$@"}' > if 0; This

Re: Alpine: useless-if-before-free: Exec format error

2019-06-15 Thread Bruno Haible
I wrote: > So, the ENOEXEC error is a bug in musl. But POSIX does not specify that the > command interpreter for scripts without shebang is /bin/sh; therefore IMHO > it would be good not to make this assumption. Correction: say

Re: Alpine: useless-if-before-free: Exec format error

2019-06-15 Thread Paul Eggert
Bruno Haible wrote: - Add a shell script useless-if-before-free that merely does this: #!/bin/sh exec perl "$0".pl "$@" suggests something like the following instead. This would avoid having separate shell scripts and .pl files, w

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Bruno Haible
Paul Eggert wrote: > Perhaps we > should just prepend "#!/bin/sh" or "#!/usr/bin/env perl" (not sure > which) and let people on weird systems fix things by hand. "#!/usr/bin/env perl" does not work on GuixSD (where the only program that has a hardcoded file name is /bin/sh; there is no /usr and

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Paul Eggert
On 6/14/19 4:51 PM, Bruno Haible wrote: But POSIX does not specify that the command interpreter for scripts without shebang is /bin/sh; therefore IMHO it would be good not to make this assumption. Perhaps the code in those scripts was taken from an earlier version of the output of "perldoc per

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Bruno Haible
>Since xargs happens to use execvp(), the executable gets executed by "a >known command interpreter". This command interpreter might be sh, python, >emacs, or whatever. > > So, the *omission* of #! renders a script non-portable, when that script is > invoked like an executable. Anyway

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Bruno Haible
Eric Blake wrote: > Conversely, POSIX requires that execution by 'sh' is the expected > behavior when #! is missing, and that use of #! renders a script > non-portable: > > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_01 This paragraph specifies what happens wh

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Eric Blake
On 6/14/19 4:28 PM, Bruno Haible wrote: > Tim Rühsen wrote: >> Do you think it makes more sense to open a bug at busybox then ? > > I don't think so. Execution of scripts without shebang is considered > legacy. Quoting : > > "Note that, even in sys

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Bruno Haible
Tim Rühsen wrote: > Do you think it makes more sense to open a bug at busybox then ? I don't think so. Execution of scripts without shebang is considered legacy. Quoting : "Note that, even in systems with full kernel support for the #! magic number

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Tim Rühsen
On 14.06.19 19:50, Paul Eggert wrote: > On 6/14/19 10:04 AM, Tim Rühsen wrote: >> Adding a shebang to build-aux/useless-if-before-free fixes the issue. > > What shebang should that be, exactly? The current style is used in > several scripts (build-aux/announce-gen, build-aux/gitlog-to-changelog, >

Re: Alpine: useless-if-before-free: Exec format error

2019-06-14 Thread Paul Eggert
On 6/14/19 10:04 AM, Tim Rühsen wrote: Adding a shebang to build-aux/useless-if-before-free fixes the issue. What shebang should that be, exactly? The current style is used in several scripts (build-aux/announce-gen, build-aux/gitlog-to-changelog, build-aux/prefix-gnulib-mk, build-aux/update-