ng0 <n...@we.make.ritual.n0.is> writes:

> Ricardo Wurmus <rek...@elephly.net> writes:

>> +       (modify-phases %standard-phases
>> +         (add-after 'unpack 'fix-configure-script
>> +           (lambda _
>> +             ;; The configure script is very intolerant to unknown 
>> arguments,
>> +             ;; such as "CONFIG_SHELL".
>> +             (substitute* "configure"
>> +               (("\\*\\) break ;;" line)
>> +                (string-append "[A-Z]*) shift ;;\n"
>> +                               line)))
>
> I'm curious what this substitute does. Could you explain it?

Sure.  We match the line

    *) break ;;

in the configure script and save it as “line”.  This line is the
alternative case in the options parser.  Any option starting with a dash
is processed while any other option leads to “break”.  This means that
upon encountering “CONFIG_SHELL=…” the configure script aborts and
doesn’t even get to setting the prefix.

So what I’m doing is to add an additional case:

    [A-Z]*) shift ;;

which is then followed by the original catch-all case (which leads to
“break”).  The additional case applies whenever an option begins with a
capital letter.  In that case it just throws away the option (“shift”).
“shift” reduces a list by dropping the current element.  This means that
in the next iteration the next list element will be processed.
Eventually this would lead to “break”, thus exiting the loop.

It’s not the prettiest fix, but it works.  It would be nicer if upstream
didn’t do “while true” and relied on “break” to exit the loop.  If they
instead went through the whole list of arguments, ignoring anything they
don’t recognize and only processing those that they expect.  Maybe worth
opening a bug report.

~~ Ricardo


Reply via email to