On 2017-09-01 16:55, Patrick Matthäi wrote:
Am 01.09.2017 um 11:40 schrieb Niels de Vos:
On Fri, Sep 01, 2017 at 09:36:16AM +0200, Patrick Matthäi wrote:
Hi,

how should it be fixed for glusterfs now? Better shell code without
bashishm or do you want /bin/bash as shebang?
Do you have a preference? I do not know how much work is it is to
rewrite the mount.glusterfs script to remove all the Bashisms.

Apart from string indexing(which was caught here) sample run with `shellcheck` only complains about the usage of 'local' built-in which is undefined for POSIX sh.

At least in the Debian builds you may want to patch it to /bin/bash for the time
being.

I would prefer a patch, so that it works without bash. Luckily the bug
reporter just wrote a patch :)
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=873878#10

The patch looks good to me. I have attached the patch to this thread for a quick look.

If you would merge it, I also would add it to the repository.

Can we get this patch get converted into a official change on review.gluster.org so that it can be officially reviewed and subsequently merged.

I have attached two other patches for 3.12.x, too.


Opinions welcome :) Thanks,
Niels



-------- Weitergeleitete Nachricht --------
Betreff:        Bug#873878: glusterfs-client: mount.glusterfs needs bash as
/bin/sh
Weitersenden-Datum:     Thu, 31 Aug 2017 20:21:01 +0000
Weitersenden-Von:       Michael Lundkvist <brels.deb...@solske.net>
Weitersenden-An:        debian-bugs-d...@lists.debian.org
Weitersenden-CC:        Patrick Matthäi <pmatth...@debian.org>
Datum:  Thu, 31 Aug 2017 21:46:18 +0200
Von:    Michael Lundkvist <brels.deb...@solske.net>
Antwort an:     Michael Lundkvist <brels.deb...@solske.net>,
873...@bugs.debian.org
An:     Debian Bug Tracking System <sub...@bugs.debian.org>



Package: glusterfs-client
Version: 3.12.0-1
Severity: serious
Tags: upstream
Justification: Policy 10.4

Version 3.12 of Glusterfs adds code in /sbin/mount.glusterfs that depends on bash.

With dash as /bin/sh, I get the following error message when trying to mount a glusterfs volume:
/sbin/mount.glusterfs: 667: /sbin/mount.glusterfs: Bad substitution
Line 667 is:
    667             [ ${volume_str:0:1} = '/' ] && {

Modifying mount.glusterfs to use /bin/bash makes it possible to mount again.

/Micke


-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.12.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages glusterfs-client depends on:
ii  fuse              2.9.7-1
ii  glusterfs-common  3.12.0-1
ii  libc6             2.24-17
ii  libssl1.1         1.1.0f-5
ii  python            2.7.13-2

glusterfs-client recommends no packages.

glusterfs-client suggests no packages.

-- no debconf information

_______________________________________________
packaging mailing list
packaging@gluster.org
http://lists.gluster.org/mailman/listinfo/packaging

_______________________________________________
packaging mailing list
packaging@gluster.org
http://lists.gluster.org/mailman/listinfo/packaging
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 216d03c41..51792c479 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -673,8 +673,9 @@ main ()
         [ -n "$volume_str" ] && {
             volume_id=$volume_str
             volume_str_temp=$volume_str
-            [ ${volume_str:0:1} = '/' ] && {
-                volume_str_temp=${volume_str:1}
+	    first_char=$(echo "$volume_str" | cut -c 1)
+            [ ${first_char} = '/' ] && {
+                volume_str_temp=$(echo "$volume_str" | cut -c 2-)
             }
             [ $(echo $volume_str_temp | grep -c "/") -eq 1 ] && {
                 volume_id=$(echo "$volume_str_temp" | cut -f1 -d '/');
_______________________________________________
packaging mailing list
packaging@gluster.org
http://lists.gluster.org/mailman/listinfo/packaging

Reply via email to