]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
small bug in mkfs.cramfs + patch
authorArnaud Mouiche <arnaud.mouiche@invoxia.com>
Thu, 17 Nov 2011 17:03:04 +0000 (18:03 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 23 Nov 2011 12:29:32 +0000 (13:29 +0100)
mkfs.cramfs on version v2.17.2 has a small bug when dealing with very small
filesystems.  look at upstream code on git, and the issue is still here.
ex:

         $ cd /tmp
         $ mkdir content
         $ echo hello > content/a
         $ echo hello > content/b
         $ mkfs.cramfs content content.cramfs
         not enough space allocated for ROM image (4090 allocated, 4096 used)

Here is a patch for fixing (simply rounding to page size AFTER eleminating
doubles).

Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/mkfs.cramfs.c

index 519363419c4952f50310d68cbd8422dc4992ba81..e7a1de35d8e7a281d920143cbb4cbbe3c0770657 100644 (file)
@@ -794,6 +794,9 @@ int main(int argc, char **argv)
 
        root_entry->size = parse_directory(root_entry, dirname, &root_entry->child, &fslen_ub);
 
+       /* find duplicate files */
+       eliminate_doubles(root_entry,root_entry, &fslen_ub);
+
        /* always allocate a multiple of blksize bytes because that's
           what we're going to write later on */
        fslen_ub = ((fslen_ub - 1) | (blksize - 1)) + 1;
@@ -808,9 +811,6 @@ int main(int argc, char **argv)
                fslen_ub = fslen_max;
        }
 
-       /* find duplicate files */
-       eliminate_doubles(root_entry,root_entry, &fslen_ub);
-
        /* TODO: Why do we use a private/anonymous mapping here
           followed by a write below, instead of just a shared mapping
           and a couple of ftruncate calls?  Is it just to save us