Bug 205574

Summary: [PATCH]usermount tool fails to format floppy as ext2
Product: Red Hat Enterprise Linux 4 Reporter: Sandeep K. Shandilya <sandeep_k_shandilya>
Component: usermodeAssignee: Martin Bacovsky <mbacovsk>
Status: CLOSED ERRATA QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: jfeeney, rhentosh, wwlinuxengineering
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0296 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-01 17:19:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch to usermount to fix mount and format issues with ext2/3
none
A new patch with the review comments taken care off. none

Description Sandeep K. Shandilya 2006-09-07 12:37:56 UTC
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 12:37:57 UTC
Created attachment 135742 [details]
patch to usermount to fix mount and format issues with ext2/3

Comment 2 Bastien Nocera 2006-09-20 09:45:28 UTC
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 10:45:42 UTC
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 06:39:14 UTC
Created attachment 138404 [details]
A new patch with the review comments taken care off.

Comment 5 Sandeep K. Shandilya 2006-11-23 05:23:18 UTC
Please review I have attached a new patch with the previous review comments
incorporated?

Comment 6 RHEL Program Management 2006-11-30 15:07:45 UTC
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 23:52:00 UTC
All ACKS received, Patch provided by Dell. RH engineering please review and add
to 4.5.

Comment 12 Red Hat Bugzilla 2007-01-22 12:20:42 UTC
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 23:27:11 UTC
Fixed in usermode-1.74-2.

Comment 14 Samuel Benjamin 2007-02-14 23:28:26 UTC
Please remove RELEASE_PENDING and get into 4.5 mainstream release.

Comment 15 Martin Bacovsky 2007-02-16 14:51:45 UTC
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 22:03:50 UTC
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 17:19:04 UTC
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