Bug 518190 - mke2fs -t option in RHEL5 differs vs upstream, leading to confusion
Summary: mke2fs -t option in RHEL5 differs vs upstream, leading to confusion
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e2fsprogs
Version: 5.5
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-08-19 12:18 UTC by Richard W.M. Jones
Modified: 2011-02-01 19:05 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-01 19:05:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
mke2fs.c.t-option.patch (408 bytes, patch)
2009-08-19 12:18 UTC, Richard W.M. Jones
no flags Details | Diff
mke2fs-check-device-exists.patch (413 bytes, patch)
2009-08-19 16:06 UTC, Richard W.M. Jones
no flags Details | Diff

Description Richard W.M. Jones 2009-08-19 12:18:28 UTC
Created attachment 357927 [details]
mke2fs.c.t-option.patch

The -t option takes a parameter, but mke2fs in RHEL 5.4 Beta
ignores it because of a small bug in the optstring.

I'll cut straight to the patch.

Comment 1 Eric Sandeen 2009-08-19 14:58:29 UTC
(In reply to comment #0)

> The -t option takes a parameter, but mke2fs in RHEL 5.4 Beta
> ignores it because of a small bug in the optstring.

mke2fs in rhel5 does not really accept the -t option much ;) and when it does, it takes no parameter:

                case 'c':       /* Check for bad blocks */
                case 't':       /* deprecated */
                        cflag++;
                        break;

In this older version of mke2fs, -t is equivalent to -c, which is "check for bad blocks."  It's not doc'd in the manpage, though unfortunately it does show up in the usage():

        fprintf(stderr, _("Usage: %s [-c|-t|-l filename] [-b block-size] "
        "[-f fragment-size]\n\t[-i bytes-per-inode] [-j] [-J journal-options]"
        " [-N number-of-inodes]\n\t[-m reserved-blocks-percentage] "
        "[-o creator-os] [-g blocks-per-group]\n\t[-L volume-label] "
        "[-M last-mounted-directory] [-O feature[,...]]\n\t"
        "[-r fs-revision] [-R options] [-qvSV] device [blocks-count]\n"),

You may be thinking of the "-t fs-type" option which was added in later upstream e2fsprogs, which may be unfortunately confusing...

-Eric

Comment 2 Richard W.M. Jones 2009-08-19 16:06:00 UTC
Created attachment 357957 [details]
mke2fs-check-device-exists.patch

I should probably say why we hit this.  We had a Fedora script
which did something along the lines of:

  /sbin/mke2fs -t ext3 /dev/hdx1

When we tried porting it to RHEL it gaves the rather obscure
error:

  mke2fs: invalid blocks count - /dev/hdx1

It took us quite a long time to work out what was going on,
including running mke2fs from RHEL under a debugger, when we
found this issue.

(Try a search for http://www.google.co.uk/search?q=mke2fs+invalid+blocks
and you'll see lots of people confused by this error
message).

The nature of the script meant it wasn't particularly easy
to solve this ("ext3" came from user input).  However since
filing the bug we discovered e4fsprogs / mke4fs on RHEL 5
so that is sufficient for us for now.

Anyhow, may I suggest the attached patch which makes the
error message clearer.

Comment 3 Eric Sandeen 2009-08-19 16:23:51 UTC
Sigh, yep, recycling the option was unfortunate.

Please be aware that mke4fs in rhel5 is still tech preview though, if that affects your planned usage at all.

Hrm some of those google-able instances seem to be another (related) problem, with the mkfs binary itself; "mkfs -c -t ext3" passes the -t through:

execve("/sbin/mkfs.ext2", ["mkfs.ext2", "-c", "-t", "ext3", "fsfile"]

while "mkfs -t ext3" does not:

execve("/sbin/mkfs.ext3", ["mkfs.ext3", "fsfile"]

Grumble.

Better error reporting would be good, and appropriate for upstream as well I suppose.

Thanks,
-Eric

Comment 4 RHEL Program Management 2009-11-06 19:07:05 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 5 Eric Sandeen 2011-02-01 19:05:18 UTC
I think we just live with this one.  It properly errors out with incorrect invocation either way:

# misc/mke2fs -t ext3 fsfile 

before:
mke2fs: invalid blocks count - fsfile

after:
ext3: No such file or directory

Especially given that '-t' isn't even documented (since it's deprecated) I'm not sure that offers any more clues as to what's gone wrong.

After such a usage error, I expect the user would consult the man page and find out that they should not be using "-t"

If you feel strongly otherwise, please reopen...

-Eric


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