3 ms·
I view this as a long and detailed demonstration of Dan Bernstein's point #5 in http://cr.yp.to/qmail/guarantee.html http://cr.yp.to/qmail/guarantee.html: Don't
by btilly 14y ago
I view this as a long and detailed demonstration of Dan Bernstein's point #5 in http://cr.yp.to/qmail/guarantee.html http://cr.yp.to/qmail/guarantee.html: Don't Parse!
All of these problems arise because we're passing around text that needs to be parsed. Programmers don't know the parsing rules, And they vary by utility. The end result is that it is very easy to make something work, and very hard to make it work correctly.
As was noted by fffggg, most of these problems disappear as soon as you switch to a language that lets you stick the filenames in strings and never again tries to parse them. All of the major scripting languages will do.
But not all, just most. The exception being the UTF-8 issue. It does not solve printability of strings with unknown (and perhaps no valid) encoding. Furthermore scripting languages often will want to try to interpret external bytes coming back from the filesystem as a string, and may have trouble if file names are not some recognized encoding.
- sedachv 14y agoAnd if djb hasn't managed to convince you to stop parsing, watch this presentation from Meredith Patterson at last year's CCC: http://www.youtube.com/watch?v=v8F8BqSa-XY http://www.youtube.com/watch?v=v8F8BqSa-XY