From 2a3ac1459f857f17e1c273c49a8df000b14fc8db Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 4 Dec 2015 16:17:03 -0600 Subject: [PATCH] Tom Marshall reported that blkid was handling ext2 wrong. Even though ext2 has a comment that it has to be at the start, I added swap to the start of the array (oops). The test suite was also wrong (it was matching the _incorrect_ output). --- tests/blkid.test | 4 ++-- toys/other/blkid.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/blkid.test b/tests/blkid.test index 3f676df8..25ba9d11 100755 --- a/tests/blkid.test +++ b/tests/blkid.test @@ -16,10 +16,10 @@ testing "blkid ext2" 'bzcat "$BDIR"/ext2.bz2 | blkid -' \ '-: LABEL="myext2" UUID="e59093ba-4135-4fdb-bcc4-f20beae4dfaf" TYPE="ext2"\n' \ "" "" testing "blkid ext3" 'bzcat "$BDIR"/ext3.bz2 | blkid -' \ - '-: LABEL="myext3" UUID="79d1c877-1a0f-4e7d-b21d-fc32ae3ef101" TYPE="ext2"\n' \ + '-: LABEL="myext3" UUID="79d1c877-1a0f-4e7d-b21d-fc32ae3ef101" TYPE="ext3"\n' \ "" "" testing "blkid ext4" 'bzcat "$BDIR"/ext4.bz2 | blkid -' \ - '-: LABEL="myext4" UUID="dc4b7c00-c0c0-4600-af7e-0335f09770fa" TYPE="ext2"\n' \ + '-: LABEL="myext4" UUID="dc4b7c00-c0c0-4600-af7e-0335f09770fa" TYPE="ext4"\n' \ "" "" testing "blkid f2fs" 'bzcat "$BDIR"/f2fs.bz2 | blkid -' \ '-: LABEL="" UUID="b53d3619-c204-4c0b-8504-36363578491c" TYPE="f2fs"\n' \ diff --git a/toys/other/blkid.c b/toys/other/blkid.c index 8d3e7707..4883b607 100644 --- a/toys/other/blkid.c +++ b/toys/other/blkid.c @@ -34,8 +34,8 @@ struct fstype { }; static const struct fstype fstypes[] = { - {"swap", 0x4341505350415753LL, 8, 4086, 1036, 15, 1052}, {"ext2", 0xEF53, 2, 1080, 1128, 16, 1144}, // keep this first for ext3/4 check + {"swap", 0x4341505350415753LL, 8, 4086, 1036, 15, 1052}, // NTFS label actually 8/16 0x4d80 but horrible: 16 bit wide characters via // codepage, something called a uuid that's only 8 bytes long... {"ntfs", 0x5346544e, 4, 3, 0x48+(8<<24), 0, 0}, -- 2.11.0