[Toybox] [PATCH] find: support -printf \0 octal escapes and \c.

enh enh at google.com
Tue Sep 3 10:08:49 PDT 2019


On Mon, Sep 2, 2019 at 3:51 PM Rob Landley <rob at landley.net> wrote:
>
> On 9/2/19 4:19 PM, enh wrote:
> > On Sun, Sep 1, 2019 at 6:18 PM Rob Landley <rob at landley.net> wrote:
> > (as an aside, i still haven't understood \c. i've never seen it used
> > in practice, and the examples i've seen are all of the form "x\cy"
> > which would be better written as just "x".)
>
> I think it's so echo "$ONE$TWO" can have $ONE end with something that prevents
> $TWO from mattering? Dunno.
>
> >> Yay tests,
> >
> > one concern i have here is that we're copying the cigarette burns
> > (https://www.wired.com/1995/09/tognazzini/).
>
> I'd send you a link to the Babylon 5 bit where G'Kar's book was copied exactly
> including Girabaldi's coffee stain, but I'm not digging enough to find it on
> youtube just now.
>
> > does anyone actually benefit from all these slightly different
> > behaviors? is anything relying on it? (different behaviors for invalid
> > octal escapes, say, seems somewhat likely to matter in practice. "find
> > doesn't support \x", though, seems very unlikely to me. especially
> > because GNU considers that an error.)
>
> This is why I wait for people to complain before opening various cans of worms,
> _but_ once I'm implementing something I try to do it right. (I.E. if I'm gonna
> support \0, do it as a side effect of octal.)

(that's what my patch does, btw.)

> And if I _can_ implement things using common code (such as collating the 3
> implementations here), and this winds up implementing extra features, I'm not
> going to spend code _disabling_ the extra features. (That's why just about every
> toybox command line numerical input supports units.)

i agree in general, i'm just not sure for this specific case to what
extent (if any) folks are relying on where exactly an escape ends.
(and we already have multiple interpretations of "\xdv", for example.)
i'm much less worried about cases where the prevailing implementations
consider something an error.

we could always try unifying everything and then we'd have specific
motivating cases for anything we needed to undo. (i did wonder about
having a flags argument to unescape_buf. that would cover this.)

> Rob



More information about the Toybox mailing list