visuald
visuald copied to clipboard
Fix Issue 21897 Semicolon inside quotes in path variable causes range violation in pipedmd
https://issues.dlang.org/show_bug.cgi?id=21897
If anyone can point out how I can add some tests for this case, please do so - it isn't immediately obvious.
Not sure if it is worth the trouble, but ';' is a valid path character and is searched if it is specified in PATH with quotes. To mimick this behavior PATH should not be split simply by ;
as done above the patch. This would also avoid the trouble with mismatched quotes in the report.
Skipping empty paths is fine (I guess this avoids the RangeError), but removing just a pair of quotes should be slightly more correct.
If anyone can point out how I can add some tests for this case, please do so - it isn't immediately obvious.
Sorry, there are no tests for pipedmd ATM.
To mimick this behavior PATH should not be split simply by ; as done above the patch. This would also avoid the trouble with mismatched quotes in the report.
What would you suggest instead of splitting the path by ;
? Splitting by ";
?
Skipping empty paths is fine (I guess this avoids the RangeError), but removing just a pair of quotes should be slightly more correct.
I'm not clear on what you mean by this. Can you give an example?
What would you suggest instead of splitting the path by
;
? Splitting by";
?
I think that the splitting by ';' must not occur between matching quotes. To avoid that PATH has to be parsed manually.
I'm not clear on what you mean by this. Can you give an example?
I meant that quotes should only be removed as a pair at the beginning and the end of a path, e.g. for "c:\a\b"
, but not for "c:\a\b
. Given the rule above that matching quotes are searched for anyway, it only makes a difference for the last quote without a match, and this actually seems to be removed by cmd. So strip
is fine indeed. Actually, all quotes should be removed from the resulting path p
.
I have implemented proper path splitting here now: https://github.com/rainers/visuald/commit/c62c2cfd96c0e6cb944e4752fe7d78c041189b56