[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1017869: nfs-utils: nfs-common and nfs-kernel-server initscripts are /bin/bash and shellcheck-dirty



Source: nfs-utils
Version: 1:1.3.4-6
Severity: minor
Tags: patch

Dear Maintainer,

See subject; also, neither of them use any bash extensions.

Please consider the patch, below, based on current Salsa HEAD;
this may also close #762939.

Best,
наб

-- System Information:
Debian Release: 11.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-16-amd64 (SMP w/24 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FIRMWARE_WORKAROUND, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages nfs-common depends on:
ii  adduser             3.118
ii  keyutils            1.6.1-2
ii  libc6               2.31-13+deb11u3
ii  libcap2             1:2.44-1
ii  libcom-err2         1.46.2-2
ii  libdevmapper1.02.1  2:1.02.175-2.1
ii  libevent-2.1-7      2.1.12-stable-1
ii  libgssapi-krb5-2    1.18.3-6+deb11u1
ii  libkeyutils1        1.6.1-2
ii  libkrb5-3           1.18.3-6+deb11u1
ii  libmount1           2.36.1-8+deb11u1
ii  libnfsidmap2        0.25-6
ii  libtirpc3           1.3.1-1+deb11u1
ii  libwrap0            7.6.q-31
ii  lsb-base            11.1.0
ii  rpcbind             1.2.5-9
ii  ucf                 3.0043

Versions of packages nfs-common recommends:
ii  python3  3.9.2-3

Versions of packages nfs-common suggests:
ii  open-iscsi  2.1.3-5
ii  watchdog    5.16-1+b1

Versions of packages nfs-kernel-server depends on:
ii  keyutils      1.6.1-2
ii  libblkid1     2.36.1-8+deb11u1
ii  libc6         2.31-13+deb11u3
ii  libcap2       1:2.44-1
ii  libsqlite3-0  3.34.1-3
ii  libtirpc3     1.3.1-1+deb11u1
ii  libwrap0      7.6.q-31
ii  lsb-base      11.1.0
ii  netbase       6.3
ii  nfs-common    1:1.3.4-6
ii  ucf           3.0043
diff --git a/debian/nfs-common.init b/debian/nfs-common.init
index 052de51a..df5d348e 100644
--- a/debian/nfs-common.init
+++ b/debian/nfs-common.init
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ### BEGIN INIT INFO
 # Provides:          nfs-common
@@ -38,11 +38,9 @@ fi
 AUTO_NEED_GSSD=no
 
 if [ -f /etc/fstab ]; then
-    exec 9<&0 </etc/fstab
-
-    while read DEV MTPT FSTYPE OPTS REST
+    while read -r DEV _ _ OPTS _
     do
-	case $DEV in
+	case "$DEV" in
 	    ''|\#*)
 		continue
 		;;
@@ -57,9 +55,7 @@ if [ -f /etc/fstab ]; then
 	    esac
 	done
 	IFS="$OLDIFS"
-    done
-
-    exec 0<&9 9<&-
+    done </etc/fstab
 fi
 
 case "$NEED_STATD" in
@@ -87,7 +83,7 @@ case "$NEED_GSSD" in
 esac
 
 do_modprobe() {
-    if [ -x /sbin/modprobe -a -f /proc/modules ]
+    if [ -x /sbin/modprobe ] && [ -f /proc/modules ]
     then
         modprobe -q "$1" || true
     fi
@@ -132,6 +128,7 @@ case "$1" in
 		   exit 0
 		fi
 	    fi
+	    # shellcheck disable=SC2086
 	    start-stop-daemon --start --oknodo --quiet \
 		--pidfile /run/rpc.statd.pid \
 	        --exec /sbin/rpc.statd -- $STATDOPTS
@@ -183,6 +180,7 @@ case "$1" in
 			exit 1
 		    fi
 
+		    # shellcheck disable=SC2086
 		    start-stop-daemon --start --oknodo --quiet \
 			    --exec /usr/sbin/rpc.gssd -- $RPCGSSDOPTS
 		    RET=$?
diff --git a/debian/nfs-kernel-server.init b/debian/nfs-kernel-server.init
index e0c51d6b..48cff95d 100644
--- a/debian/nfs-kernel-server.init
+++ b/debian/nfs-kernel-server.init
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ### BEGIN INIT INFO
 # Provides:          nfs-kernel-server
@@ -38,7 +38,7 @@ fi
 . /lib/lsb/init-functions
 
 do_modprobe() {
-    if [ -x /sbin/modprobe -a -f /proc/modules ]
+    if [ -x /sbin/modprobe ] && [ -f /proc/modules ]
     then
         modprobe -q "$1" || true
     fi
@@ -66,6 +66,7 @@ case "$1" in
 			export_files="$export_files $file"
 		fi
 	done
+	# shellcheck disable=SC2086
 	if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' $export_files
 	then
 		do_modprobe nfsd
@@ -111,7 +112,7 @@ case "$1" in
 		ClearAddr=
 		if [ -f /proc/net/rpc/auth.unix.ip/channel ]
 		then
-		    fgrep -qs 127.0.0.1 /proc/net/rpc/auth.unix.ip/content || {
+		    grep -F -qs 127.0.0.1 /proc/net/rpc/auth.unix.ip/content || {
 			echo "nfsd 127.0.0.1 2147483647 localhost" >/proc/net/rpc/auth.unix.ip/channel
 			ClearAddr=yes
 		    }

Attachment: signature.asc
Description: PGP signature


Reply to: