Opened 11 years ago

Closed 11 years ago

#6484 closed patch (fixed)

mythtv-setup: Allow --help options without an X server

Reported by: sphery <mtdean@…> Owned by: Janne Grunau
Priority: minor Milestone: 0.22
Component: MythTV - Channel Scanner Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The attached patch uses some of the new code added with the command-line channel scanner to allow running mythtv-setup --help without a valid DISPLAY by setting use_display to false for -h, --help, and --usage .

Note that the patch modifies the early-command-line-checking loop that was already there. The original for loop was designed to loop over one less than the total number of arguments (because it was originally used for -geometry and -display, which both require values/an argument following the switch). Therefore, I modified the loop test (removing the + 1) such that it now loops over all arguments (no longer requiring a trailing value before parsing the option). I then added the appropriate bounds checks for the -geometry and -display parsing code.

Though some of the --scan* arguments actually require a value, I did not perform any "additional value" bounds checks in the early parsing for --scan* simply because if --scan* is set to always require values, --scan-list, --scan-save-only, --scan-non-interactive (which do not require values) fail on a system without a DISPLAY with:

mythtv-setup: cannot connect to X server

and a command like:

mythtv-setup --scan

would fail with the same error, rather than the desired:

You must enter a valid cardid to scan. Valid cards:

1: <whatever>

Also, the "late" command-line checking code for all the --scan* arguments properly checks boundaries before grabbing the value associated with the argument, so it makes more sense to always parse the --scan* arguments in the early loop.

Thanks to lcase on IRC for letting me know that --help could only be used with a valid X display.

Attachments (1)

mythtv-6484-mythtv-setup-do_not_use_display_for_help.patch (1.3 KB) - added by sphery <mtdean@…> 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by sphery <mtdean@…>

comment:1 Changed 11 years ago by Matthew Wire <devel@…>

See also #6160 for patches which modify --help with mythwelcome, mythfrontend and mythbackend

comment:2 Changed 11 years ago by Janne Grunau

Milestone: unknown0.22
Owner: changed from danielk to Janne Grunau
Status: newaccepted

comment:3 Changed 11 years ago by Janne Grunau

Resolution: fixed
Status: acceptedclosed

fixed in [20476]

Note: See TracTickets for help on using tickets.