From: Stanislav Brabec <sbrabec@suse.cz>
To: util-linux@vger.kernel.org
Subject: libblkid: check for ext* is deeply broken
Date: Tue, 08 Apr 2014 23:52:38 +0200 [thread overview]
Message-ID: <1396993958.14732.144.camel@oct.suse.cz> (raw)
I am digging into an incorrect detection of ext* filesystems in blkid
2.24.1.
The result of blkid is totally illogical. You cannot write any simple
function that will parse the result. Both prioritizing of TYPE over
SEC_TYPE and vice versa fail for some cases.
ext2 with ext4 module unloaded:
SEC_TYPE="ext2" TYPE="ext4"
ext3 with ext4 module unloaded:
SEC_TYPE="ext2" TYPE="ext3"
ext4 with ext4 module unloaded:
TYPE="ext4"
ext2 with ext4 module loaded:
TYPE="ext2"
ext3 with ext4 module loaded:
SEC_TYPE="ext2" TYPE="ext3"
ext4 with ext4 module loaded:
TYPE="ext4"
I even don't know, what was intended to be returned on system that
supports ext2 via ext4:
SEC_TYPE="ext2" TYPE="ext4"
or
TYPE="ext2"?
If the first one, all system_supports_ext?() have to be rewritten to
detect loaded ext4 module supporting ext2.
If the second one, system_supports_ext4_ext2() should be moved inside
system_supports?() calls.
In both cases, expressions using these calls have to be rewritten.
Details:
It seems, that the code attempts to be intelligent and detect the best
possible support for the particular file system.
But check as they are written are broken, return inconsistent results
and cannot be fixed to be consistent:
check_for_modules("ext2") correctly returns that module named "ext2"
does not exist (only "ext4" does).
But at least on a new Linux kernel version I am working on
fs_proc_check("ext2") returns success whenever ext4 module is loaded.
It is because /proc/filesystems include "ext2", even if the module is
named "ext4".
It causes system_supports_ext?() being inconsistent between calls with
"ext4" module loaded and "ext4" module unloaded.
It implies, that all subsequent logic expressions in probe_ext* are
inconsistent and makes no sense as well. Additionally, I guess that some
of these checks are incorrect per self. (As long as only one
probe_ext?() returns success, then blkid returns at least something.)
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
next reply other threads:[~2014-04-08 21:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-08 21:52 Stanislav Brabec [this message]
2014-04-09 7:43 ` libblkid: check for ext* is deeply broken 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=1396993958.14732.144.camel@oct.suse.cz \
--to=sbrabec@suse.cz \
--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