Bug 205574 - [PATCH]usermount tool fails to format floppy as ext2
[PATCH]usermount tool fails to format floppy as ext2
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: usermode (Show other bugs)
4.4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Martin Bacovsky
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-07 08:37 EDT by Sandeep K. Shandilya
Modified: 2007-11-16 20:14 EST (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2007-0296
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-01 13:19:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch to usermount to fix mount and format issues with ext2/3 (854 bytes, patch)
2006-09-07 08:37 EDT, Sandeep K. Shandilya
no flags Details | Diff
A new patch with the review comments taken care off. (1.04 KB, patch)
2006-10-13 02:39 EDT, Sandeep K. Shandilya
no flags Details | Diff

  None (edit)
Description Sandeep K. Shandilya 2006-09-07 08:37:56 EDT
Description of problem:
usermount tool fails to format removeable media floppy and zip drives with the
ext2/3 format. It also fails to mount the just formatted disk.

Version-Release number of selected component (if applicable):
usermount from usermode-1.74



How reproducible:
everytime

Steps to Reproduce:
1. Run tsermount application
2. insert a floppy in the disk drive
3. click on format and select ext2 in the dialog box
  
Actual results:
The command fails with the error message bad inode size.

Expected results:
The tool should format the floppy diskette (lay the ext2 filesystem on the diskette)

Additional info:
formatting the floppy with the vfat file system works. A patch to fix this has
been attached.
Comment 1 Sandeep K. Shandilya 2006-09-07 08:37:57 EDT
Created attachment 135742 [details]
patch to usermount to fix mount and format issues with ext2/3
Comment 2 Bastien Nocera 2006-09-20 05:45:28 EDT
Comment on attachment 135742 [details]
patch to usermount to fix mount and format issues with ext2/3

>--- usermode-1.74.orig/usermount.c	2004-09-24 06:50:22.000000000 -0400
>+++ usermode-1.74/usermount.c	2006-09-06 11:48:10.000000000 -0400
>@@ -435,12 +435,15 @@
> 		if (fstype == NULL) {
> 			fstype = info->fstype;
> 		}
>-		command[0] = PATH_MKFS;
>-		command[1] = "-t";
>-		command[2] = fstype;
>-		command[3] = "-I";
>-		command[4] = info->dev;
>-		command[5] = NULL;
>+		int index=0;

That should be declared at the top of the function.

>+		command[index++] = PATH_MKFS;
>+		command[index++] = "-t";
>+		command[index++] = fstype;
>+		if (0==strncmp(fstype,"vfat",4)) {
>+			command[index++]="-I";
>+		}

Please try to follow the coding style. That should read:
+		if (strncmp (fstype, "vfat", 4) == 0) {
+			command[index++] = "-I";
+		}

>@@ -452,7 +455,7 @@
> 			}
> 			if (WIFEXITED(status)) {
> 				if (WEXITSTATUS(status) == 0) {
>-					info->mounted = !info->mounted;
>+					info->mounted = 0;
> 				}
> 			}
> 		}

What's this change for?
Comment 3 Sandeep K. Shandilya 2006-09-26 06:45:42 EDT
The first comment will be taken care of I will resubmit the patch.

(In reply to comment #2)
> (From update of attachment 135742 [details] [edit])
> >--- usermode-1.74.orig/usermount.c	2004-09-24 06:50:22.000000000 -0400
> >+++ usermode-1.74/usermount.c	2006-09-06 11:48:10.000000000 -0400
> >@@ -435,12 +435,15 @@
> > 		if (fstype == NULL) {
> > 			fstype = info->fstype;
> > 		}
> >-		command[0] = PATH_MKFS;
> >-		command[1] = "-t";
> >-		command[2] = fstype;
> >-		command[3] = "-I";
> >-		command[4] = info->dev;
> >-		command[5] = NULL;
> >+		int index=0;
> 
> That should be declared at the top of the function.
I will resubmit the patch with index declared at the top.
> 
> >+		command[index++] = PATH_MKFS;
> >+		command[index++] = "-t";
> >+		command[index++] = fstype;
> >+		if (0==strncmp(fstype,"vfat",4)) {
> >+			command[index++]="-I";
> >+		}
> 
> Please try to follow the coding style. That should read:
> +		if (strncmp (fstype, "vfat", 4) == 0) {
> +			command[index++] = "-I";
> +		}

I think it is safer to have 0==(expr) than (expr)==0. If we miss out the second
'=' then, (expr)=0 which could lead to logical errors but 0=(expr) will give you
a compiler error and will not allow you to miss out the second '='.

> 
> >@@ -452,7 +455,7 @@
> > 			}
> > 			if (WIFEXITED(status)) {
> > 				if (WEXITSTATUS(status) == 0) {
> >-					info->mounted = !info->mounted;
> >+					info->mounted = 0;
> > 				}
> > 			}
> > 		}
> 
> What's this change for?
> 
After formatting media if you try to mount immediately then it fails with the
message '...... not mounted'
you run usermount without anything mounted then info->mounted=0. You run format
on that media then this will line will inncorrectly set the flag(!info->mounted)  .
Comment 4 Sandeep K. Shandilya 2006-10-13 02:39:14 EDT
Created attachment 138404 [details]
A new patch with the review comments taken care off.
Comment 5 Sandeep K. Shandilya 2006-11-23 00:23:18 EST
Please review I have attached a new patch with the previous review comments
incorporated?
Comment 6 RHEL Product and Program Management 2006-11-30 10:07:45 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 9 Samuel Benjamin 2007-01-10 18:52:00 EST
All ACKS received, Patch provided by Dell. RH engineering please review and add
to 4.5.
Comment 12 Red Hat Bugzilla 2007-01-22 07:20:42 EST
Bug report changed to RELEASE_PENDING status by Errata System.
Advisory RHBA-2007:9069-02 has been changed to HOLD status.
http://errata.devel.redhat.com/errata/showrequest.cgi?advisory=4722
Comment 13 Samuel Benjamin 2007-02-14 18:27:11 EST
Fixed in usermode-1.74-2.
Comment 14 Samuel Benjamin 2007-02-14 18:28:26 EST
Please remove RELEASE_PENDING and get into 4.5 mainstream release.
Comment 15 Martin Bacovsky 2007-02-16 09:51:45 EST
This will wait till official release of RHEL 4.5.0. This is completely in hands
of rel-eng.
Comment 16 Issue Tracker 2007-04-19 18:03:50 EDT
A fix for this issue has been included in RHEL4.5. Please test the Release
Candidate of RHEL4.5, which was released today to Partners, and let us know
if the problem is resolved. The Release Candidate can be downloaded from
here:

ftp://partners.redhat.com/af38ac4316ba20df2dec5f990913396d

Internal Status set to 'Waiting on Customer'
Status set to: Waiting on Client
Resolution set to: 'RHEL 4.5'

This event sent from IssueTracker by gcase 
 issue 101684
Comment 17 Red Hat Bugzilla 2007-05-01 13:19:04 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0296.html

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