From: Karel Zak <kzak@redhat.com>
To: "Pádraig Brady" <P@draigBrady.com>
Cc: util-linux@vger.kernel.org
Subject: Re: suggestion to avoid erroneous lines in findmnt/lslocks/...
Date: Mon, 13 Aug 2012 14:39:21 +0200 [thread overview]
Message-ID: <20120813123921.GB3533@x2.net.home> (raw)
In-Reply-To: <5021A665.9060305@draigBrady.com>
On Wed, Aug 08, 2012 at 12:36:05AM +0100, Pádraig Brady wrote:
> ck\slash is not \x<xdigit> sequence, so escape is unnecessary
> >
> > Note that \\server\path is pretty common for cifs and use \x5c
> > for all '\' will make the findmnt output unreadable in many cases.
> > IMHO is better to be "smart" and use escape sequences only when it's
> > really necessary.
>
> Better for humans, but awkward for scripts to parse.
> What I was thinking was perhaps --raw or -P would
> do unconditional escaping of '\' so unescaping can be
> done with just `printf %b`?
Good point. Fixed, all '\' will be replaced with \x5c.
> With the conditional escaping you'd have to do something like:
>
> unmangle() {
> printf '%b' $(
> sed '
> s/\\\([^x]\)/\\x5c\1/g;
> s/\\\(x[^0-9a-f]\)/\\x5c\1/g;
> s/\\\(x[0-9a-f][^0-9a-f]\)/\\x5c\1/g;
> '
> )
> }
ugly, I see, let's use printf '%b' without the sed stuff. Thanks.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2012-08-13 12:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-04 15:42 suggestion to avoid erroneous lines in findmnt/lslocks/ Pádraig Brady
2012-08-04 15:57 ` Dave Reisner
2012-08-05 2:02 ` Pádraig Brady
2012-08-06 8:15 ` Karel Zak
2012-08-06 11:10 ` Karel Zak
2012-08-06 14:44 ` Pádraig Brady
2012-08-07 8:09 ` Karel Zak
2012-08-07 11:35 ` Dave Reisner
2012-08-07 23:36 ` Pádraig Brady
2012-08-13 12:39 ` Karel Zak [this message]
2012-08-20 0:31 ` Pádraig Brady
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120813123921.GB3533@x2.net.home \
--to=kzak@redhat.com \
--cc=P@draigBrady.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).