Project

General

Profile

Bug #2153

No check on first command line argument being an option

Added by Berk Hess over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
core library
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

All GROMACS programs do not check if the first argument after the binary name starts with a dash. Any non-dash arguments are ignored until one with a dash is encountered.
This is especially an issue when cut-and-pasting from PDFs where all arguments can be ignored.

Associated revisions

Revision 5577aadf (diff)
Added by Mark Abraham almost 2 years ago

Handle erroneous command line args better

Some gmx modules need to be able to accept non-option arguments, and
some should not. Introduced enough functionality to support such
behaviour, while giving useful error messages in cases where the
command line is merely missing hyphens (which can happen e.g. when
people copy-paste from inconveniently built PDF files for tutorials).
Increased test coverage of relevant cases.

Removed some useless command-line argument strings from test cases
that never needed them.

Also tested some behaviours of handling string options, and renamed
some test input strings to reflect the intent.

Fixes #2153

Change-Id: Icec02ea86a57a8b129a621121518036b9f032078

History

#1 Updated by Gerrit Code Review Bot over 2 years ago

Gerrit received a related patchset '1' for Issue #2153.
Uploader: Berk Hess ()
Change-Id: gromacs~release-2016~I7fbd83dc32e39b498f78211c2fd03ac54a9c6a95
Gerrit URL: https://gerrit.gromacs.org/6582

#2 Updated by Szilárd Páll over 2 years ago

Looks like the change pushed up 2 months ago won't work, a rebase/retrigger reminded me that the unit tests also rely on this bug-feature, so there will have to be a whitelisting special-case for those or some other solution to address the invalid 1st argument case.

#3 Updated by Mark Abraham about 2 years ago

  • Target version changed from 2016.4 to 2016.5

#4 Updated by Szilárd Páll about 2 years ago

Any ideas how to fix this?

#5 Updated by Berk Hess about 2 years ago

I would really like to have a check for this, but I don't know enough about these parts of the code to do it.

#6 Updated by Erik Lindahl almost 2 years ago

  • Target version changed from 2016.5 to future

Not critical science bug, so the target should at least not be 2016 anymore.

#7 Updated by Mark Abraham almost 2 years ago

Things that still have to work appropriately after the fix:

gmx xyz
gmx help trjconv
gmx help xyz
gmx -hidden help mdrun
gmx -hidden mdrun -h
gmx mdrun -h -hidden
gmx tune_pme -ntomp 3
gmx -nocopyright grompp

Things that didn't work (well enough):

gmx grompp f
gmx grompp f -c file.gro
gmx grompp -c file.gro f

The third one is still not fixed by the change I will upload shortly - there's currently no way for the parser to find out whether an option has seen enough values.

Berk, did I cover the cases we saw during that tutorial at KTH?

#8 Updated by Mark Abraham almost 2 years ago

  • Status changed from In Progress to Fix uploaded
  • Assignee set to Mark Abraham
  • Target version changed from future to 2018

#9 Updated by Gerrit Code Review Bot almost 2 years ago

Gerrit received a related patchset '1' for Issue #2153.
Uploader: Mark Abraham ()
Change-Id: gromacs~release-2018~Icec02ea86a57a8b129a621121518036b9f032078
Gerrit URL: https://gerrit.gromacs.org/7425

#10 Updated by Mark Abraham almost 2 years ago

  • Status changed from Fix uploaded to Closed

Also available in: Atom PDF