Bug 508905 - mkfs -F causes failure (wrong commandline handling)
mkfs -F causes failure (wrong commandline handling)
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e2fsprogs (Show other bugs)
5.3
All Linux
low Severity medium
: rc
: ---
Assigned To: Eric Sandeen
BaseOS QE - Apps
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-30 09:29 EDT by Karel Volný
Modified: 2010-03-19 10:20 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-04 10:49:35 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Karel Volný 2009-06-30 09:29:13 EDT
Description of problem:
I was trying to create filesystem within an image file non-interactively. Reading man mkfs.ext3:

-F     Force mke2fs to run, even if the specified device is not a block special device, or appears to be mounted.

But I haven't read the mkfs page at first and thus I didn't notice that I have to add the option after specifying the filesystem type. The resulting error message is quite interesting ...

Version-Release number of selected component (if applicable):
util-linux-2.13-0.50.el5

How reproducible:
always

Steps to Reproduce:
1. dd if=/dev/zero of=image count=4K
2. mkfs -F -t ext3 image
  
Actual results:
mke2fs 1.39 (29-May-2006)
mkfs.ext2: invalid blocks count - image

Expected results:
mke2fs 1.39 (29-May-2006)
Unrecognized option "-F"
Usage: mkfs [-V] [-t fstype] [fs-options] device [size]

Additional info:
using correct options order works as expected:

.qa.[root@ppcp-5s-m1 tps]# mkfs -t ext3 -F image
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
256 inodes, 2048 blocks
102 blocks (4.98%) reserved for the super user
First data block=1
Maximum filesystem blocks=2097152
1 block group
8192 blocks per group, 8192 fragments per group
256 inodes per group

Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Comment 1 Karel Zak 2009-11-04 16:16:52 EST
I think that

   mkfs -F -t ext3 image

is interpreted correctly, it means *all options* are interpreted as fs-specific and the default mkfs.ext2 is executed. Don't forget that

  mkfs [-V] [-t fstype] [fs-options] device [size]

means that -V and -t are optional.
Comment 2 Karel Volný 2010-03-04 07:57:57 EST
(In reply to comment #1)
> I think that
> 
>    mkfs -F -t ext3 image
> 
> is interpreted correctly, it means *all options* are interpreted as fs-specific
> and the default mkfs.ext2 is executed. Don't forget that
> 
>   mkfs [-V] [-t fstype] [fs-options] device [size]
> 
> means that -V and -t are optional.    

um, sorry, but I can't understand how does this explain the reason why the parameter "image" is interpreted as "blocks count" instead of "device"

RHEL 5 says:

.qa.[root@i386-5s-3-m1 tps]# dd if=/dev/zero of=image count=4K
4096+0 records in
4096+0 records out
2097152 bytes (2.1 MB) copied, 0.461783 seconds, 4.5 MB/s
.qa.[root@i386-5s-3-m1 tps]# mkfs -F -t ext3 image
mke2fs 1.39 (29-May-2006)
mkfs.ext2: invalid blocks count - image

Fedora 12 says:

[root@dhcp-lab-151 tmp]# dd if=/dev/zero of=image count=4K
4096+0 records in
4096+0 records out
2097152 bytes (2.1 MB) copied, 0.0257721 s, 81.4 MB/s
[root@dhcp-lab-151 tmp]# mkfs -F -t ext3 image
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
256 inodes, 2048 blocks
102 blocks (4.98%) reserved for the super user
First data block=1
Maximum filesystem blocks=2097152
1 block group
8192 blocks per group, 8192 fragments per group
256 inodes per group

Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Comment 3 Karel Zak 2010-03-04 10:18:51 EST
(In reply to comment #2)
> um, sorry, but I can't understand how does this explain the reason why the
> parameter "image" is interpreted as "blocks count" instead of "device"

This bug is reported against mkfs (!= mkfs.ext2) and you said:

  mkfs -F -t ext3 image

  Expected results:
  mke2fs 1.39 (29-May-2006)
  Unrecognized option "-F"
  Usage: mkfs [-V] [-t fstype] [fs-options] device [size]

and in the comment #1 I'm trying to explain to you that there is not a bug in mkfs, because all options was correctly interpreted by *mkfs* and your idea from "Expected results:" is wrong.

Anyway, the option "-t" is deprecated and undocumented (on RHEL5). And this option has a different meaning on RHEL5 and on Fedora.

The most important is that this "-t" does not expect any argument (on RHEL5). 

It means that the "ext3" argument from you example is *on RHE5* used as a device name and "image" as a block count :-) You have to use -T <fstype> there.

F-12 supports "-t <fstype>" and "-T <usage_type>".

For more details see mkfs.ext2 man page on RHEL5 and F-12.

I see only one problem (in mkfs.ext2), the undocumented "-t" option on RHEL5 should be disabled in the code or documented in the man page. .. so reassigning to e2fsprogs.
Comment 4 Eric Sandeen 2010-03-04 10:49:35 EST
I agree, I don't think the original report is a bug.  From the mkfs manpage:

       mkfs [-V] [-t fstype] [fs-options] filesys [blocks]

clearly the fs-options must go after the type specification, and -F is not an option to mkfs.  Garbage In, Garbage Out.  :)

I'm going to close this NOTABUG, if it's critical that we update the manpage for -t <fstype> in rhel5, let's use a new bug for that.
Comment 5 Karel Volný 2010-03-19 10:06:00 EDT
(In reply to comment #3)
...
> and in the comment #1 I'm trying to explain to you that there is not a bug in
> mkfs, because all options was correctly interpreted by *mkfs* and your idea
> from "Expected results:" is wrong.

ah, now I get it, I apologize - for some reason I've read "all" like "all but -t ext3" and then missed the point

(In reply to comment #4)
> Garbage In, Garbage Out.  :)

we are not talking about trashcan but about software ... garbage in, proper error message out

> I'm going to close this NOTABUG, if it's critical that we update the manpage
> for -t <fstype> in rhel5, let's use a new bug for that.    

I really don't understand why not to continue with this one, once we got to the source of the problem

do you need to improve the number of closed bugs in statistics? - ok, here you are, Bug #575115
Comment 6 Eric Sandeen 2010-03-19 10:20:49 EDT
No, I don't care about bug count, but this bug said "wrong commandline handling" etc, and that was not an accurate description of the problem; IMHO this was an invalid bug.   It's clearer to start fresh IMHO.

However I just closed that bug NOTABUG as well; undocumented deprecated options actually do not seem like anything that needs fixing.

The real problem here was an incorrect invocation of mkfs, everything behaved as expected, although the error message took some deciphering.

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