Bug 135293 - dosfsck -> Error-Message: "File system has n1 clusters but only space for n2 FAT entries"; n1 > n2 .
Summary: dosfsck -> Error-Message: "File system has n1 clusters but only space for n2 ...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: dosfstools
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-10-11 19:41 UTC by Thomas Bruecker
Modified: 2010-06-08 10:27 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-06-08 10:26:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Thomas Bruecker 2004-10-11 19:41:21 UTC
Description of problem:

  applies to dosfstools/dosfsck , dosfstools-2.8-6. ~i386, ~src

 in file "dosfstools-2.8-6.src.rpm/...tar.gz/
           dosfstools-2.8/dosfsck/boot.c", ~line# 272,
  function " void read_boot(DOS_FS *fs) ", declaration of variables,
    actual: unsigned        total_sectors;
            unsigned short  logical_sector_size, fat_length, sectors;
    should be (AAA): unsigned        fat_length, total_sectors;
                     unsigned short  logical_sector_size, sectors;

    because at ~line# 284: 
      fat_length = CF_LE_W(b.fat_length) ?
                   CF_LE_W(b.fat_length) : CF_LE_L(b.fat32_length);
      ( CF_LE_L expands as "((__u32))" in for i386 cpus )
      the b.fat32_length [ type(b.fat32_length) = __u32 ] is truncated
      to a 16bit-number if type(fat_length) = "unsigned short".

      in my concrete example, an actual fat_length = 131'710(decimal)
      is truncated towards fat_length = 2'638, which leads to the
      error message under summary.

Version-Release number of selected component (if applicable):
  dosfstools-2.8-6

How reproducible:
  Sometimes, but not always.
  for my concrete example ( fat_length = 131'710 ) the error
  reproduces always.

Steps to Reproduce:
 1. you must have an msdos-filesystem with fat32 and enough clusters
    ( >= ? [see line# 384ff of .../boot.c for calculation;
                                             fat_length >= 65'536.] ).
  
Actual results: ---


Expected results: ---


Additional info:
  after changing the source code of .../boot.c as described under
 "should be (AAA)" the error does no longer appear.

Comment 1 Thomas Bruecker 2004-10-12 20:23:47 UTC
Thomas Bruecker, 12oct2004: "Steps to Reproduce, 1." ... should be
                             ~line# 344ff (instead of ...384ff):
                    fs->fat_size = fat_length*logical_sector_size;...

sorry!


Comment 2 Thomas Bruecker 2004-10-14 00:16:32 UTC
About memory usage of (debugged?) dosfsck:
-----------------------------------------

( if you are going to test it on filesystems with "many" clusters.)

* the example filesystem (dev/hdd7):
  from CHKDSK ( Windows 98 [Version 4.10.2222] ):
    "[...]

    Volume [...] created 08-26-2002 2:52p
    Volume Serial Number is 50DE-F456

        8,557,407 kilobytes total disk space
        1,499,915 kilobytes free

              512 bytes in each allocation unit
       17,114,815 total allocation units on disk
        2,999,830 available allocation units on disk

    [...]"

* too less memory:
  * "dosfsck /dev/hdd7" aborts silently(!) or (depends on version of
    glibc ?) with "malloc:Cannot allocate memory" .
  * "dosfsck -v /dev/hdd7" aborts with "malloc:Cannot allocate
                                                             memory" .

* enough memory:
  "enough" told by "cat /proc/meminfo":
    "       total:    used:    free:  shared: buffers:  cached:
    Mem:   96993280   [...]
    Swap: 668426240   [...]
    [...]"
  ( suppose: enough only for kernel and dosfsck )

  ( watching swap usage during "dosfsck -v /dev/hdd7":
                                approx. max 382980 * 1024 bytes. )
				
  * "dosfsck /dev/hdd7" terminates correctly with the message:
    "/dev/hdd7: 37914 files, 14114985/17114815 clusters" .

( I hope it's helpful. -- If not, just delete it! )


Comment 3 Jaroslav Škarvada 2010-06-08 10:26:49 UTC
Last released version in RHEL-3 is dosfstools-2.8-10.

This bug was fixed in RHEL-4 in dosfstools-2.8-15 and in all later versions.


Note You need to log in before you can comment on or make changes to this bug.