should string options with required argument accept --other-option as argument, or issue an error?
Submitted by Amir Caspi
Link to original bug (#577713)
Description
Please describe the problem: If gnome-terminal is started with any command-line option set but without a value given for that option, it can fail badly if the missing-value option is not the last option specified (see examples below). This is normally not a problem except when started with gnome-session, which then fails silently leading to no terminals opened whatsoever.
This is really half of a bug, in that gnome-terminal should fail gracefully when a command-line option is missing its value, but gnome-session should also be setting the command-line options properly. I'm opening a separate bug for gnome-session.
Steps to reproduce: Method 1: On the command line: gnome-terminal --title --working-directory /tmp
Method 2: On the command line: gnome-terminal --title --working-directory=/tmp
Actual results: Method 1: Error: Invalid argument: "/tmp"
Method 2: gnome-terminal opens in the default working directory with title set to "--working-directory=/tmp"
Expected results: Either method: gnome-terminal should open with a blank (or default) title and in working directory /tmp.
Does this happen every time? Yes
Other information: Although the gnome-terminal usage ("gnome-terminal --help") says that all options must be followed by an equal sign (e.g. --title="Some Title" --working-directory="/tmp"), gnome-terminal actually allows the equal sign to be omitted (e.g. --title "Some Title" --working-directory /tmp) and works just fine. However, because of this, if the value for an option is missing for anything except the very last option, gnome-terminal will fail to function as expected (or will fail, period) as it attempts to interpret the next option as the value for the previous option (e.g. in Method 1, gnome-terminal attempts to set the title to "--working-directory" and then treats "/tmp" as an unrecognized option; in Method 2, gnome-terminal sets the title inappropriately to the next option/value pair).
If gnome-terminal allows option/value pairs to omit the equal sign, it should fail gracefully when a value is missing (i.e. recognize that the value is missing and ignore that option). Otherwise, gnome-terminal should strictly require the equal sign between option/value pairs.
While this is not normally a problem for interactive sessions (people won't set empty options deliberately), this is a problem when gnome-terminal is started from scripts, e.g. by gnome-session. This is a particular problem with gnome-session (see bug linked below) as gnome-terminal will then fail silently and gnome-session will fail to open any terminal windows.