Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uwsgi_opt_set_int: use strtol() and warn on non-numeric data #2032

Merged
merged 2 commits into from
Jun 26, 2019

Conversation

awelzel
Copy link
Contributor

@awelzel awelzel commented Jun 23, 2019

[related to #2018 - when reading "After a lot of trouble shooting and digging through the uWSGI source" I thought maybe that can be more friendly]

This should not change the existing behavior of using 0 when
a non-numeric value is provided, but loudly logs:

$ uwsgi test.ini --processes 2x
[uWSGI] getting INI configuration from test.ini
[WARNING] non-numeric value "2x" for option "processes" - using 2 !
[WARNING] non-numeric value "true" for option "http-keepalive" - using 0 !
*** Starting uWSGI 2.1-dev-ade7d170 (64bit) on [Sun Jun 23 18:36:29 2019] ***
compiled with version: 8.3.0 on 23 June 2019 16:22:05
...

It might be saner to not even start with invalid options. However,
hypothetical setups with http-keepalive=off or http-keepalive=false may
then fail to start at all and people might get unahppy.

@awelzel
Copy link
Contributor Author

awelzel commented Jun 23, 2019

Related #1245 and #1637

@xrmx
Copy link
Collaborator

xrmx commented Jun 26, 2019

@awelzel could you please run make tests with your commit on top of #2035?

UPDATE: just rebase to master and travis will run them

This should not change the existing behavior of using 0 when
a non-numeric value is provided, but loudly logs:

    $ uwsgi test.ini --processes 2x
    [uWSGI] getting INI configuration from test.ini
    [WARNING] non-numeric value "2x" for option "processes" - using 2 !
    [WARNING] non-numeric value "true" for option "http-keepalive" - using 0 !
    *** Starting uWSGI 2.1-dev-ade7d170 (64bit) on [Sun Jun 23 18:36:29 2019] ***
    compiled with version: 8.3.0 on 23 June 2019 16:22:05
    ...

It might be saner to not even start with invalid options. However,
hypothetical setups with http-keepalive=off or http-keepalive=false may
then fail to start at all and people might get unahppy.
@awelzel
Copy link
Contributor Author

awelzel commented Jun 26, 2019

@xrmx - ha! thanks for writing the tests. I hadn't looked around - next time I'll add some, too.

It's rebased:

Running suite(s): uwsgi strings                                 
 uwsgi opt parsing
[WARNING] non-numeric value "true" for option "" - using 0 !
[WARNING] non-numeric value "false" for option "" - using 0 !         
100%: Checks: 2, Failures: 0, Errors: 0          

@awelzel
Copy link
Contributor Author

awelzel commented Jun 26, 2019

@xrmx - actually added a test for uwsgi_opt_set_int("", NULL, &result); which should correspond to optional_argument usage.

@xrmx xrmx merged commit eee8d77 into unbit:master Jun 26, 2019
@xrmx
Copy link
Collaborator

xrmx commented Jun 26, 2019

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants