[Bugs] [Bug 1190877] New: Options incorrectly parsed
bugzilla at redhat.com
bugzilla at redhat.com
Mon Feb 9 20:38:01 UTC 2015
https://bugzilla.redhat.com/show_bug.cgi?id=1190877
Bug ID: 1190877
Summary: Options incorrectly parsed
Product: GlusterFS
Version: 3.6.1
Component: fuse
Assignee: bugs at gluster.org
Reporter: mdl123 at verizon.net
CC: bugs at gluster.org, gluster-bugs at redhat.com
Description of problem:
mount.glusterfs fails to correctly parse autofs mount options
Version-Release number of selected component (if applicable):
v3.6.2
How reproducible:
Invoke mount.glusterfs with -n -o $mountoptions
e.g. mount $host:volume /mnt/volume -n -o acl
Steps to Reproduce:
1.
2.
3.
Actual results:
volume is mounted without acls enabled (depending upon $mountoptions, the mount
may fail silently instead).
Expected results:
Mount with acls enabled
Additional info:
The issue is in mount.glusterfs parsing the line using getopts: under the -n
and -o cases, there are "shift" statements. These confuse getopts as getopts
expects the argument list unchanged unless $OPTIND is also chagned - after
parsing "-n", $OPTIND = 2, $1='-n', $2='-o', $3='acl', but the shift removes
$1, causing $1='-o' and $2='acl'. The next call to getopts returns garbage as
getopts tries to parse 'acl', not '-o'. The patch below fixes the issue:
commit ede617d738c38a0c45275dadcfefa414574dfac0
Author: Mark Levedahl <mark.levedahl at mdnt.com>
Date: Mon Feb 9 13:15:50 2015 -0500
mount.glusterfs - remove "shift" statements
getopts takes care of the command line arguments, adding "shift"
in the loop causes getopt to skip when it should not.
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in
b/xlators/mount/fuse/utils/mount.glusterfs.in
index 68d452c..924b98f 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -556,10 +556,8 @@ main ()
case "${opt}" in
o)
parse_options ${OPTARG};
- shift 2;
;;
n)
- shift 1;
;;
V)
${cmd_line} -V;
@@ -575,6 +573,10 @@ main ()
;;
esac
done
+ if test $OPTIND -gt 1
+ then
+ shift $((OPTIND - 1))
+ fi
if [ "x${uname_s}" = "xNetBSD" ] ; then
volfile_loc=$1
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
More information about the Bugs
mailing list