[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: playing with -s



"Michael W. Lucas" <mwlucas@michaelwlucas.com> wrote:

> # tarsnap -xf etctest -s /^etc/var\/dr\/etc/p
> tarsnap: Invalid replacement flag d
>
> How can I escape characters in -s? Or am I missing something?

This part of the code is taken directly from bsdtar, (as such,
the same thing happens with '-s' using 'tar' (on FreeBSD at
least), so you may get a better response talking to a more
general BSD list)

Though from a quick glance, it appears to me that if a '\' is
not followed by a special RE character, it is taken literally
rather than escaping the next character.

i.e. "xxx\(ab\)" and "xxx\\p" are parsed the same as in an
(old style) RE

but "xxx\p" is parsed the same as "xxx\\p", rather than the
RE equivalent of just "xxx<literal 'p'>" (or simply "xxxp"),
so similarly, "\/" would be parsed the same as "\\/" would be
expressed in the RE - so it appears not possible to escape any
character unless it's special to the RE format itself.

This seems an obvious oversight to me, so I must have
stupidly got it wrong or missed something.

Anyone any ideas?

Cheers, Jamie