FS#20950 - pacman should refuse to run when it doesn't understand one of its arguments

Attached to Project: Pacman
Opened by Vincent Cappe (vcap) - Sunday, 26 September 2010, 12:12 GMT
Last edited by Allan McRae (Allan) - Tuesday, 15 October 2013, 03:03 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity High
Priority Normal
Reported Version 3.4.1
Due in Version 4.2.0
Due Date Undecided
Percent Complete 100%
Votes 15
Private No

Details

case in point: pacman -conf pacman-install.conf -Syc

First, it happily takes the -conf despite not understanding it (should be --config), and uses /etc/pacman.conf instead. This can get very nasty if the user is not paying attention (hence Severity: High).

Second, with '-Syc' (and '-Scy'), it only does the 'c' and not the 'y'. If some combinations of options are invalid, it should also refuse to run, or at least warn the user that some arguments are ignored.
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 15 October 2013, 03:03 GMT
Reason for closing:  Fixed
Additional comments about closing:  commits culminating in 2c11e5da
Comment by Xavier (shining) - Sunday, 26 September 2010, 14:40 GMT
There are many very nasty things that can happen if the user is not paying attention, so the priority is very low on this kind of issues.
It has long been known that pacman does not detect invalid combinations of flags, but no one cared enough to improve it.
Actually there are many more important problems or wanted features, and no one cares enough to code them either.
Comment by Dan McGee (toofishes) - Monday, 27 September 2010, 15:42 GMT
Patches welcome as usual. `-conf` is silly in that we always use GNU double-dash long options, and unfortunately each of those letters is a valid short option. I think the best approach here is a two-phase parse, where we first get the major operation and then only validate and use options for that major operation. The current code all lives in parseargs(), so some changing around of things there with getopt_long() calls should do the trick.
Comment by Xavier (shining) - Tuesday, 01 February 2011, 09:38 GMT
The two pass is done, but it just ensures that y and c are valid options inside -S, it doesn't check that -y and -c suboptions are not compatible.

At least 'pacman -conf pacman-install.conf -Syc' gives an error now but not a very verbose one so I don't even know what makes it fail.
Comment by Dylan S. (dysoco) - Monday, 20 August 2012, 01:34 GMT
I agree with this report.
I think is an option that does not harm, and should be easy enough to implement.

Loading...