All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Conrad <mconrad@intellitree.com>
To: util-linux@vger.kernel.org
Subject: blkid -o value
Date: Tue, 27 Mar 2012 13:26:14 -0400	[thread overview]
Message-ID: <4F71F836.4000103@intellitree.com> (raw)

Hi, I've just had a semi-serious problem related to blkid's "-o value" 
format.

When I first discovered that output format, I assumed that it would be a 
stable script-friendly output format intended for people who don't want 
to parse the name/value pairs.  The fields appeared to be
   LABEL
   UUID
   TYPE
and I wrote a script assuming the third one was TYPE.

However, suddenly the output has changed to be
   LABEL
   UUID
   SEC_TYPE <-- "ext2"
   TYPE <-- "ext3"

which caused my script to mount a ext3 partition as ext2, killing the 
journal.

Looking at the code, it appears that it iterates over some list coming 
from libblkid and prints a line with the value only if the value 
exists.  So it appears that there was never any intention of it being a 
stable output.

I would request that either the order of fields become stable by 
printing empty lines for missing fields (and documented), or the "-o 
value" be done away with, since I can't see any reason anyone would want 
random output in a script-friendly format, and the fact that it exists 
is likely to lead people astray.

Thoughts?  Comments?

-Mike Conrad

             reply	other threads:[~2012-03-27 17:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 17:26 Michael Conrad [this message]
2012-03-27 17:31 ` blkid -o value Ted Ts'o
2012-03-27 17:52   ` Michael Conrad
2012-03-27 18:43     ` Ted Ts'o
2012-03-28  9:00       ` Karel Zak
2012-03-28 21:03         ` Michael Conrad
2012-03-28  7:34 ` Karel Zak

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=4F71F836.4000103@intellitree.com \
    --to=mconrad@intellitree.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.