sosreport / sos

A unified tool for collecting system logs and other debug information
http://sos.rtfd.org
GNU General Public License v2.0
512 stars 541 forks source link

--log-size=0 is silently ignored #2334

Closed pmoravec closed 3 years ago

pmoravec commented 3 years ago

Reproducer: have a huge /var/log/messages and call:

sos report -o logs --batch --build --log-size=0 -vvv

Then the zero value is lost during:

[sos.report:setup] executing 'sos report -o host --batch --build -vvv --log-size=0'
[sos.report:setup] using 'rhel' preset defaults ()
[sos.report:setup] effective options now: --batch --build --only-plugins host -vvv

and the default logsize limit is applied.

TurboTurtle commented 3 years ago

Oof, that's a rough one. Good find though.

This came about because in Component.apply_options_from_cmdline() was checking for if val. Well in almost all cases that's right, but for log-size=0 that (now obviously) won't fly. So we can change that to if val is not None, which is what should be the null value for anything coming from argparse.

I've opened #2335 for this, let's get some testing on this to make sure we're copacetic with the change.