From: "Pádraig Brady" <P@draigBrady.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: suggestion to avoid erroneous lines in findmnt/lslocks/...
Date: Mon, 06 Aug 2012 15:44:21 +0100 [thread overview]
Message-ID: <501FD845.50001@draigBrady.com> (raw)
In-Reply-To: <20120806111059.GB24621@x2.net.home>
On 08/06/2012 12:10 PM, Karel Zak wrote:
> On Mon, Aug 06, 2012 at 10:15:33AM +0200, Karel Zak wrote:
>> I'll fix it to use iscntrl() and \x?? hex (to be consistent our
>> another outputs).
>
> Fixed:
>
> - mount(8) uses '?' like coreutils for control chars (note that
> listing mode in mount(8) is in maintenance mode, use findmnt(8) if
> you want something better)
>
> - \x<code> is used in findmnt, lsblk, partx, ... for control and non-printable
> chars
>
> - in the raw and export (NAME=data) output are also replaced already existing
> \x<code> sequences (aaa\x20bbb --> aaa\x5cx20bbb).
>
> This is not used in the default output to keep it human readable (\x?? is
> pretty common in /dev/disk/by-*).
>
>
> I have also fixed the way how lib/tt.c counts cells, it's possible
> that old findmnt, lsblk, ... versions have a problem with some languages
> (e.g JP) where more than one cell is necessary to print one multibyte.
Cool.
I did a quick test...
$ echo $LANG
en_US.utf8
$ mkdir tst && cd tst
$ truncate -s10M img
$ mkfs.ext2 -F img
$ mkdir ascii "$(printf 'co\ntrol')" 'back\slash' 'es\x63aped' "$(printf 'nonútf8' | iconv -t iso-8859-15)" '日一二三四五六'
$ for mnt in ascii "$(printf 'co\ntrol')" 'back\slash' 'es\x63aped' "$(printf 'nonútf8' | iconv -t iso-8859-15)" '日一二三四五六'; do
> sudo mount img "$mnt"
> ~/git/util-linux/findmnt -l /dev/loop1
> ~/git/util-linux/findmnt -rn /dev/loop1 | cut -d' ' -f1
> sleep 1
> sudo umount /dev/loop1
> done
TARGET SOURCE FSTYPE OPTIONS
/home/padraig/tst/ascii /dev/loop1 ext2 rw,relatime,seclabel,errors=continue
/home/padraig/tst/ascii
TARGET SOURCE FSTYPE OPTIONS
/home/padraig/tst/co\x0atrol /dev/loop1 ext2 rw,relatime,seclabel,errors=continue
/home/padraig/tst/co\x0atrol
TARGET SOURCE FSTYPE OPTIONS
/home/padraig/tst/back\slash /dev/loop1 ext2 rw,relatime,seclabel,errors=continue
/home/padraig/tst/back\slash
TARGET SOURCE FSTYPE OPTIONS
/home/padraig/tst/es\x63aped /dev/loop1 ext2 rw,relatime,seclabel,errors=continue
/home/padraig/tst/es\x5cx63aped
TARGET SOURCE FSTYPE OPTIONS
/dev/loop1 ext2 rw,relatime,seclabel,errors=continue
/home/padraig/tst/non\xfffffffatf8
TARGET SOURCE FSTYPE OPTIONS
/home/padraig/tst/日一二三四五六 /dev/loop1 ext2 rw,relatime,seclabel,errors=continue
/home/padraig/tst/\xffffffe6\xffffff97...
So two questions.
1. Should the back\slash case be back\x5cslash in both cases?
2. The nonútf8 one produces an errant new line.
Also in this case could you fall back to using \x escapes for the whole string?
cheers,
Pádraig.
next prev parent reply other threads:[~2012-08-06 14:44 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 [this message]
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
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=501FD845.50001@draigBrady.com \
--to=p@draigbrady.com \
--cc=kzak@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.