util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* small bug in mkfs.cramfs + patch
@ 2011-11-17 17:03 Arnaud Mouiche
  2011-11-23 13:12 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaud Mouiche @ 2011-11-17 17:03 UTC (permalink / raw)
  To: util-linux

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
(

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: small bug in mkfs.cramfs + patch
  2011-11-17 17:03 small bug in mkfs.cramfs + patch Arnaud Mouiche
@ 2011-11-23 13:12 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2011-11-23 13:12 UTC (permalink / raw)
  To: Arnaud Mouiche; +Cc: util-linux

On Thu, Nov 17, 2011 at 06:03:04PM +0100, Arnaud Mouiche wrote:
>         $ 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  

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-23 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 17:03 small bug in mkfs.cramfs + patch Arnaud Mouiche
2011-11-23 13:12 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).