[Bug 935480] Re: mkdosfs refuses to run on /dev/loop0p1

Jan Claeys ubuntu at janc.be
Sat Feb 16 19:02:36 UTC 2013


This looks like the same bug we are seeing in GParted:
https://bugzilla.gnome.org/show_bug.cgi?id=693955

This is caused by an incorrect test in mkdosfs whether a device is a
"hard disk":

    if (fstat(dev, &statbuf) < 0)
        die("unable to stat %s");
    if (!S_ISBLK(statbuf.st_mode)) {
        statbuf.st_rdev = 0;
        check = 0;
    } else
        /*
         * Ignore any 'full' fixed disk devices, if -I is not given.
         * On a MO-disk one doesn't need partitions.  The filesytem can go
         * directly to the whole disk.  Under other OSes this is known as
         * the 'superfloppy' format.  As I don't know how to find out if
         * this is a MO disk I introduce a -I (ignore) switch.  -Joey
         */
        if (!ignore_full_disk && ((statbuf.st_rdev & 0xff3f) == 0x0300 ||       /* hda, hdb */
                                  (statbuf.st_rdev & 0xff0f) == 0x0800 ||       /* sd */
                                  (statbuf.st_rdev & 0xff3f) == 0x0d00 ||       /* xd */
                                  (statbuf.st_rdev & 0xff3f) == 0x1600) /* hdc, hdd */
        )
        die("Device partition expected, not making filesystem on entire device '%s' (use -I to override)");


It makes certain apparently incorrect assumptions about how raw device numbers for full disks vs. partitions look like.
(It also doesn't use major()/minor() on the raw device number, which looks not very portable or future-proof to me...)

** Bug watch added: GNOME Bug Tracker #693955
   https://bugzilla.gnome.org/show_bug.cgi?id=693955

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dosfstools in Ubuntu.
https://bugs.launchpad.net/bugs/935480

Title:
  mkdosfs refuses to run on /dev/loop0p1

Status in “dosfstools” package in Ubuntu:
  New

Bug description:
  psusi at faldara:~$ sudo mkdosfs /dev/loop0p1
  mkdosfs 3.0.9 (31 Jan 2010)
  mkdosfs: Device partition expected, not making filesystem on entire device '/dev/loop0p1' (use -I to override)

  Obviously this is wrong since loop0p1 IS a partition.  Oddly, it does
  not complain on loop0p2.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dosfstools/+bug/935480/+subscriptions




More information about the foundations-bugs mailing list