ca02b0e |
Wed Sep 27 01:23:58 2017 -0700 |
Andy Chu |
|
Solution that is safe against adversarial input.
Use NUL bytes as delimiters, and also grep for NUL beforehand.
|
112ba20 |
Thu Sep 21 09:48:12 2017 -0700 |
Andy Chu |
|
An example of handling multiline output from git.
This solution doesn't assume:
- That every field is a single line
- That there is only one field with spaces
- Anything else about the input format, other than it doesn't contain
0x01 and 0x02 bytes. (The encoding should therefore be ASCII/utf-8.)
It also has the nice property that you can change your format string
arbitrarily while not worrying about the escaping function. I don't
want to rewrite the escaping function every time I change the format
string. Solutions that require that are fragile.
|
4c353d1 |
Wed Sep 20 00:44:45 2017 -0700 |
Andy Chu |
|
Simplify, and add a git-specific solution.
|
a089617 |
Tue Sep 19 11:23:33 2017 -0700 |
Andy Chu |
|
Modify example:
- Use bash $'' because it's not specific to git. It can be used with
other tools too.
- 0x01 and 0x02 so as not to confuse the issue of NUL in bash strings
|
7fa3cba |
Tue Sep 19 00:00:30 2017 -0700 |
Andy Chu |
|
Inline the function for readability
|