[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8091: fiemap_capable_ misbehaves in a chroot

From: Pádraig Brady
Subject: bug#8091: fiemap_capable_ misbehaves in a chroot
Date: Mon, 21 Feb 2011 15:16:28 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100227 Thunderbird/3.0.3

On 21/02/11 13:04, Adam Sampson wrote:
> Hi,
> A minor bug in the testsuite in coreutils 8.10...
> I package software in a chroot. At the moment, my chroot doesn't contain
> an mtab file, which means df can't tell what type the filesystem is:

Going forward /etc/mtab is going to be linked to /proc/mounts
so this should be less of an issue.

> $ df -T /
> Filesystem    Type   1K-blocks      Used Available Use% Mounted on
> -                -   288370908  90872412 194568804  32% /
> The fiemap_capable_ function in tests/init.cfg uses df to tell whether
> the filesystem it's running on supports fiemap, by asking it to only
> list filesystems that it knows are fiemap-capable using -t. However, the
> selected_fstype function in df.c will always include filesystems that it
> doesn't know the type of, even when -t is specified:
> $ df -T -t blahfs /
> Filesystem    Type   1K-blocks      Used Available Use% Mounted on
> -                -   288370908  90872400 194568816  32% /
> The result is that fiemap_capable_ assumes my chrooted filesystem
> supports fiemap when it doesn't, so the tests that use it fail.

That is already addressed with:

> I'm not sure at this point whether df -t is doing the wrong thing or
> fiemap_capable_ is using it incorrectly. Any thoughts?

We may adjust what df does in future when it can't get the fs list.
Perhaps we could resort to statfs(), though that has its own
ambiguities, like ext[234] all having the same type.
Hmm, that reminds me that we probably want to:

diff --git a/src/stat.c b/src/stat.c
index f26dced..5458e48 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -273,7 +273,7 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
     case S_MAGIC_EXT: /* 0x137D */
       return "ext";
     case S_MAGIC_EXT2: /* 0xEF53 */
-      return "ext2/ext3";
+      return "ext2/ext3/ext4";
     case S_MAGIC_EXT2_OLD: /* 0xEF51 */
       return "ext2";
     case S_MAGIC_FAT: /* 0x4006 */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]