(feel free to assign patch creation to me)
I ran into a situation where my quoted parameters (IF_STRING) were being truncated.
I traced it down to the now find all good characters logic.
Instinctively I made a patch, but then I realized this could introduce regressions.
Should I introduce a:
#define IF_STRING_PROPER (IF_STRING | 0x100)
or fix INPgetStr knowing that some esoteric code somewhere was relying bad behavior e.g.:
x=" " to become the empty stringx="fast" and x="fast mode" to become "fast"foo="fast,debug" to become foo=fast and debugThe scope of this is much wider than my experience... For now and locally I am using the IF_STRING_PROPER approach, but I am suspecting this is a rip the band-aid off moment.
Note: the test suite does not seem to have coverage for this and both patches do not change the test outcomes.
the current behavior seems to conflict the examples in the manual. But each of those examples seems to bypass INPgetStr.
But CIDER rootfile and IC.FILE examples would go through INPgetStr and filenames with offending characters will cause issues.
A valid bug report contains the description of a bug. Steps for reproduction and any needed inputs should be included.
My local patch is how I found it. I do not yet have test cases for rootfile and IC.FILE.
but the test cases are articulated above....
Most importantly, as I tried to say above - I dont have the historical knowledge to know if INPgetStr was designed on purpose to act so weirdly! If someone, with historical knowlege could answer that, then I can write test cases, and submit patch.
But if this is "as designed" then so be it.
Last edit: Jason Pyeron 5 days ago
to clarify the initial report:
Last edit: Jason Pyeron 5 days ago
Create 2 files, the first is from the manual section 14.7.2.1 page 499:
and then the same file, where rootfile is modified to use () in the name
then:
So I ask, is INPgetStr working as designed? That is was there a historical reason ' ', '\t', '(', ')', and ',' are terminators for strings? It seems too deliberate to be an accident.
I dont want to make a fix that breaks backwards compatability....
Thanks, that makes it clear. My guess is that it really is working as designed, and has been for 41 years. But there were likely no filenames in model specifications then. Now it's terrible!
Stopping on those "garbage" characters seems reasonable, as in some contexts they are punctuation. But once an opening quote is seen, everything up to a matching quote or the terminating null should be accepted, as should an escaped matching quote (\"). Otherwise, why parse quotes at all?