wrap-program with non-colon separtor produces incorrect bash substitutions

  • Done
  • quality assurance status badge
Details
2 participants
  • Jelle Licht
  • Ludovic Courtès
Owner
unassigned
Submitted by
Jelle Licht
Severity
normal

Debbugs page

Jelle Licht wrote 7 years ago
(name . Bug-guix@gnu org)(address . bug-guix@gnu.org)
878t5w8yol.fsf@fsfe.org
Hi all,

While working to package some lua-related stuff, I need to deal with the
LUA_PATH environment variable. This variable uses `;' as a separator, and
as such, I wanted to wrap one of my programs

Toggle snippet (6 lines)
...
(wrap-program (string-append out "/bin/fennel")
`("LUA_PATH" ";" prefix (,path)))
...

... which gives me the following snippet for the fennel script:

Toggle snippet (3 lines)
export LUA_PATH="/gnu/store/3yjzvzwczi37snccrxbw7xsmbns1qc7a-fennel-1-1.f2a3d3b/share/lua/5.3/?.lua${LUA_PATH;+;}$LUA_PATH"

... which is not a correct bash substitution. I _think_ the first `;' in
`{LUA_PATH;+;}' needs to be a colon instead, at least if `wrap-program'
is only used to generate bash-compliant wrappers.

It seems this can be (easily?) fixed around guix/build/utils.scm:1055,
but any changes I made there had me starting to build bash and other
things from scratch.
Ludovic Courtès wrote 7 years ago
(name . Jelle Licht)(address . jlicht@fsfe.org)(address . 32293@debbugs.gnu.org)
87a7pik4k4.fsf@gnu.org
Hello Jelle!

Jelle Licht <jlicht@fsfe.org> skribis:

Toggle quote (22 lines)
> While working to package some lua-related stuff, I need to deal with the
> LUA_PATH environment variable. This variable uses `;' as a separator, and
> as such, I wanted to wrap one of my programs
>
> ...
> (wrap-program (string-append out "/bin/fennel")
> `("LUA_PATH" ";" prefix (,path)))
> ...
>
>
> ... which gives me the following snippet for the fennel script:
>
> export LUA_PATH="/gnu/store/3yjzvzwczi37snccrxbw7xsmbns1qc7a-fennel-1-1.f2a3d3b/share/lua/5.3/?.lua${LUA_PATH;+;}$LUA_PATH"
>
> ... which is not a correct bash substitution. I _think_ the first `;' in
> `{LUA_PATH;+;}' needs to be a colon instead, at least if `wrap-program'
> is only used to generate bash-compliant wrappers.
>
> It seems this can be (easily?) fixed around guix/build/utils.scm:1055,
> but any changes I made there had me starting to build bash and other
> things from scratch.

It’s indeed where the bug lies. Changing that file involves a full
rebuild (because every package build process uses it), but that’s OK:
you can test the ‘wrap-program’ procedure independently (at the REPL,
for example), and then we can push this change to ‘core-updates’.

We need to check whether ‘core-updates’ still accepts full-rebuild
changes at this stage, though.

Thanks,
Ludo’.
Jelle Licht wrote 7 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)
87o9dx6psw.fsf@fsfe.org
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (34 lines)
> Hello Jelle!
>
> Jelle Licht <jlicht@fsfe.org> skribis:
>
>> While working to package some lua-related stuff, I need to deal with the
>> LUA_PATH environment variable. This variable uses `;' as a separator, and
>> as such, I wanted to wrap one of my programs
>>
>> ...
>> (wrap-program (string-append out "/bin/fennel")
>> `("LUA_PATH" ";" prefix (,path)))
>> ...
>>
>>
>> ... which gives me the following snippet for the fennel script:
>>
>> export LUA_PATH="/gnu/store/3yjzvzwczi37snccrxbw7xsmbns1qc7a-fennel-1-1.f2a3d3b/share/lua/5.3/?.lua${LUA_PATH;+;}$LUA_PATH"
>>
>> ... which is not a correct bash substitution. I _think_ the first `;' in
>> `{LUA_PATH;+;}' needs to be a colon instead, at least if `wrap-program'
>> is only used to generate bash-compliant wrappers.
>>
>> It seems this can be (easily?) fixed around guix/build/utils.scm:1055,
>> but any changes I made there had me starting to build bash and other
>> things from scratch.
>
> It’s indeed where the bug lies. Changing that file involves a full
> rebuild (because every package build process uses it), but that’s OK:
> you can test the ‘wrap-program’ procedure independently (at the REPL,
> for example), and then we can push this change to ‘core-updates’.
>
> We need to check whether ‘core-updates’ still accepts full-rebuild
> changes at this stage, though.

I pushed this on core-updates as e6c4e41102.

Toggle quote (3 lines)
>
> Thanks,
> Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 32293@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 32293
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help