Commit 513e3d0
authored
patch: -D argument validation
* When patching a file with -D option (aka --ifdef), "-Did" and "-D id" usages are accepted
* I found that an empty string argument is sometimes ignored, and sometimes raises an error
* The OpenBSD version raises an error if the argument to -D is not a valid identifier, i.e. starts with alpha followed by alphanumeric & underscore
* Add validation in this version; as a benefit the invalid empty string usage is rejected
* test1: perl patch -D'' ---> already caught by Getopt::Long
* test2: perl patch -D '' file ---> now errors; previously ignored
* test3: perl patch -DValid_id0 file ---> ifdef name accepted as before
* test4: perl patch -D 'd/e;f~ine#' file ---> now errors; previously accepted1 parent 7bbdcbd commit 513e3d0
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| |||
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| 103 | + | |
96 | 104 | | |
97 | 105 | | |
98 | 106 | | |
| |||
0 commit comments