All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
To: util-linux@vger.kernel.org
Subject: small bug in mkfs.cramfs + patch
Date: Thu, 17 Nov 2011 18:03:04 +0100	[thread overview]
Message-ID: <4EC53E48.5010008@invoxia.com> (raw)

Hi all.

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)
Regards,
Arnaud


diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c
index 4ffa908..30f6b4b 100644
--- a/disk-utils/mkfs.cramfs.c
+++ b/disk-utils/mkfs.cramfs.c
@@ -843,6 +843,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;
@@ -858,9 +861,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
(

             reply	other threads:[~2011-11-17 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 17:03 Arnaud Mouiche [this message]
2011-11-23 13:12 ` small bug in mkfs.cramfs + patch 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=4EC53E48.5010008@invoxia.com \
    --to=arnaud.mouiche@invoxia.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.