simfactory's option parser terminates option values on ";"

Issue #1112 closed
Roland Haas created an issue

I have (on my local machine horizon.tapir.caltech.edu):

rhaas@horizon:/mnt/data/rhaas/postdoc/gr/ET_trunk$ tail -n2  simfactory/etc/defs.local.ini
[horizon.tapir.caltech.edu]
user            = rhaas3 ; missing

and get

rhaas@horizon:/mnt/data/rhaas/postdoc/gr/ET_trunk$ sim print-mdb-entry horizon.tapir.caltech.edu | grep rhaas
sourcebasedir   = /mnt/data/rhaas/postdoc/gr
basedir         = /home/rhaas/data/postdoc/runs
user            = rhaas3
email           = rhaas

ie. the option parser truncates the option value for "user" at the ";" character (seem to treat it as a comment marger like "#").

This makes it impossible to have a ";" eg. in the envsetup command. I tried escaping the ";" with backslashes and double quotes. No luck. In my specific case I wanted to do:

hash module && module purge ; bash ...

ie clear all module information if the module command exists (I have a workaround for this particular application).

Keyword:

Comments (10)

  1. Erik Schnetter
    • removed comment

    Yes, both # and ; are treated as comment characters. We can change this -- see pyini.py, function Parse.

    Traditionally, semicolons indicate the begin of a comment in ini files. However, it may be that this semicolon needs to be at the beginning of a line to do so, which we currently don't enforce.

  2. Roland Haas reporter
    • removed comment

    Beginning of the line would work for me. Or the possibility of escaping the semicolon. Not being able to enter it at all makes certain bash command lines awkward.

    I attach a a patch. Additionally we might also consider allowing for '#' to be escaped (if we ever find ourself in a situation where one needs '#' as part of an option value), eg. http://stackoverflow.com/questions/1706198/python-how-to-ignore-comment-lines-when-reading-in-a-file

  3. Erik Schnetter
    • removed comment

    This patch just removes ";" as comment character. The ini file format actually specifies that only ";" is a comment character, if it is the first character in a line. Do we really want to deviate from the standard here?

  4. Roland Haas reporter
    • removed comment

    There is a separate check for comment characters at the beginning of the line in line 655 of the source code (pyini.py). I am not touching that :-)

  5. Log in to comment