[Scons-users] Prevent users from shooting them in the foot when adding FLAGS

Bill Deegan bill at baddogconsulting.com
Thu Nov 16 11:55:40 EST 2017


The issue with waiting to sanitize until you are in/running the Action is
that the variables may being expanded there and far away from when they are
set incorrectly.
Better to have SCons die immediately rather than run (possibly for a while)
before dying with an error about invalid action..

Note that when I say env variables I'm not talking about shell environment
variables, but about Environment() variables which are generally what is
expanded to create the command lines.
-Bill

On Thu, Nov 16, 2017 at 8:00 AM, Javier Llopis <javier at llopis.me> wrote:

> IMHO, rather than (or perhaps in addition to) messing with the env vars,
> it might be better to try and sanitise the command lines before issuing the
> command (Action.py ??).
> J
>
>
> ------------------------------
> *From*: "Bill Deegan" <bill at baddogconsulting.com>
> *Sent*: 15 November 2017 19:56
> *To*: "SCons users mailing list" <scons-users at scons.org>
> *Subject*: Re: [Scons-users] Prevent users from shooting them in the foot
> when adding FLAGS
>
> Likley CLVar in src/engine/SCons/Utils.py and also Environment.py.
>
> Though as I said I'm working on a big rewrite.
> Also a more generic way might be better.
>
> Say being able to specify validators per Environment variable?
>
> -Bill
>
> On Wed, Nov 15, 2017 at 10:31 AM, Dan Čermák <dan.cermak at cgc-instruments.
> com> wrote:
>>
>> Hi Bill,
>>
>> if you could point me to the code which handles environment variables
>> I'll try to create a pull request.
>>
>>
>> Cheers,
>>
>> Dan
>>
>> Bill Deegan <bill at baddogconsulting.com> writes:
>>
>> > Dan,
>> >
>> > That must've been fun to find.. ;)
>> > Pull requests welcome.
>> > Though I'm reworking the storage/evaluation of environment variables
>> > currently which I plan to get into the 3.1 or 4.0 release (Next feature
>> > release, naming depends on whether I need to break compatibility with
>> > 3.0.1..)
>> >
>> > -Bill
>> >
>> > On Wed, Nov 15, 2017 at 7:15 AM, Dan Čermák <
>> dan.cermak at cgc-instruments.com>
>> > wrote:
>> >
>> >> Hi folks,
>> >>
>> >> I have today successfully shoot myself in the foot with SCons by
>> >> effectively doing the following:
>> >>
>> >> env.Append(CPPPATH=['/path/to/foo/bar\n'])
>> >>
>> >> The issue with this is that any build command gets terminated by the \n
>> >> prematurely, e.g. a gcc -I/path/to/foo/bar\n -c foo.c gets executed as:
>> >> gcc -I/path/to/foo/bar
>> >> which obviously fails, as gcc lacks any source files.
>> >>
>> >> This is of course a user error (in my case it was because I extracted
>> >> the CPPPATH from the invocation of an external program), however would
>> >> anything speak against printing a warning if a \n or \r\n appears in
>> any
>> >> of the variables passed to the Environment?
>> >>
>> >>
>> >> Cheers,
>> >>
>> >> Dan
>> >> _______________________________________________
>> >> Scons-users mailing list
>> >> Scons-users at scons.org
>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-users at scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20171116/435ec2dd/attachment.html>


More information about the Scons-users mailing list