Bug 337961

Summary: gfs_grow /mountpoint/ does not work
Product: Red Hat Enterprise Linux 5 Reporter: Lutz Lange <llange>
Component: gfs-utilsAssignee: Chris Feist <cfeist>
Status: CLOSED ERRATA QA Contact: GFS Bugs <gfs-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 5.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0349 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 14:36:32 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:
Bug Depends On:    
Bug Blocks: 345501    
Attachments:
Description Flags
Patch to fix the problem none

Description Lutz Lange 2007-10-18 13:54:28 UTC
Description of problem:
# gfs_grow /mountpoint/ does not work 

Version-Release number of selected component (if applicable):
gfs-utils-0.1.11-3.el5

How reproducible:
# gfs_grow -Tv /gfsdata/
GFS Filesystem /gfsdata/ not found

[root@node-1 ~]# gfs_grow -Tv /gfsdata
FS: Mount Point: /gfsdata
FS: Device: /dev/gfs_vg/gfslv
FS: Options: rw,hostdata=jid=0:id=65538:first=1,acl
...
  
Expected results:
# gfs_growfs should not care about the last slash!

Comment 1 Robert Peterson 2007-10-22 15:54:01 UTC
Created attachment 234211 [details]
Patch to fix the problem

This patch takes care of not only trailing slashes but any extras.
For example, /mnt///roth_vg////roth_lv will be correctly interpreted
as /mnt/roth_vg/roth_lv

Comment 2 Robert Peterson 2007-10-22 15:55:11 UTC
Requesting ACK flags so I can ship the fix for RHEL5.2.


Comment 3 RHEL Program Management 2007-10-22 16:07:51 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 4 Robert Peterson 2007-10-23 14:31:31 UTC
My patch above uses function realpath(), as the gfs/gfs2 mount helper
mount.gfs2 already does.  However, the man page for realpath() says:
"Avoid  using  this function. It is broken by design...".
I also found web pages alluding to the use of realpath() being a
potential security risk.

Based on that, I started researching what other file systems do and
what alternatives exist.

I didn't find any viable alternative, which is surprising.

The nfs-utils package use realpath() as well as a few others.  Shocked,
I asked Steve Dickson about it, but as usual, he answered my ping but
ignored my question.

The util-linux package has coded their own myrealpath() function that's
not usable elsewhere.

File systems like ext3 and xfs don't use realpath().  Without spending
a lot of time on them, it looked like they broke paths down into
constituent tokens and used them in search tables.

Other file systems like msdos, hfs, and jfs don't seem to care.
They'll apparently let you shoot yourself in the foot if you specify
/dev////device in one place and /dev/device in another.  This is, for
example, when checking /etc/mtab to see if you're trying to do a mkfs
while the file system is mounted.

So catch-22:
I don't want to reinvent the wheel here and write my own, yet
I'm reluctant to use the original because of the warnings.
Still, we need something.


Comment 5 Lutz Lange 2007-10-24 07:22:41 UTC
I dont think we really need /dev///device to work. That counts as a typo where
i'm standing. What needs to work is /mountpoint/ where we have a / as last char.
I extensively use bash auto-completion so i get a slash as last char if i
specify the mountpoint. This mountpoint is not found in /etc/fstab ... 
Proposed fix : remove the last slash from the string it there is one. 

Comment 6 Robert Peterson 2007-10-25 21:32:57 UTC
Given the discussion on tech-list, and given that we already use
realpath() in other places, I'm going ahead with this patch as posted.
I committed the fix to the HEAD and RHEL5 branches for inclusion into
RHEL5.2.  Both HEAD and RHEL5 versions were tested on system roth-01.
Changing the status to modified.


Comment 9 errata-xmlrpc 2008-05-21 14:36:32 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-2008-0349.html