Ema has submitted this change and it was merged.

Change subject: Fix bashisms
......................................................................


Fix bashisms

This commit fixes a few possible bashisms reported by checkbashisms. In
most situations we were relying on bash-specific behavior, in others on
dash-specific ones.

When in doubt, switch back the script to using bash explicitly.

Bug: T95064
Change-Id: Ifc841a52be47ca33ca8737a383ac6f7e2ed718c4
---
M modules/admin/files/home/otto/.liquidprompt/test.sh
M modules/apache/files/apache-status
M modules/mirrors/files/check_apt_mirror
M modules/mysql/templates/mysql.init.erb
M modules/puppetmaster/files/motd/99-obsolete
M modules/quarry/files/celeryd
M modules/shinken/files/init
7 files changed, 11 insertions(+), 9 deletions(-)

Approvals:
  Ema: Verified; Looks good to me, approved



diff --git a/modules/admin/files/home/otto/.liquidprompt/test.sh 
b/modules/admin/files/home/otto/.liquidprompt/test.sh
index 1e8ed86..1694000 100755
--- a/modules/admin/files/home/otto/.liquidprompt/test.sh
+++ b/modules/admin/files/home/otto/.liquidprompt/test.sh
@@ -1,4 +1,6 @@
-#!/bin/sh
+#!/bin/bash
+# We've replaced /bin/sh with /bin/bash given that this script does not work
+# properly when /bin/sh is a symlink to /bin/dash. See T95064. -- ema
 
 
 print_ok()
diff --git a/modules/apache/files/apache-status 
b/modules/apache/files/apache-status
index 492e4e6..3d6e87a 100755
--- a/modules/apache/files/apache-status
+++ b/modules/apache/files/apache-status
@@ -3,4 +3,4 @@
 RESET="$(/usr/bin/tput sgr0)"
 file="/tmp/apache_status.$(/bin/hostname).$(/bin/date +%s).txt"
 /usr/bin/links -dump http://127.0.0.1/server-status -width 80 | tee "$file"
-echo "\nOutput saved to ${WHITE}${file}${RESET}."
+printf "\nOutput saved to ${WHITE}${file}${RESET}.\n"
diff --git a/modules/mirrors/files/check_apt_mirror 
b/modules/mirrors/files/check_apt_mirror
index 48634d3..b17ba20 100755
--- a/modules/mirrors/files/check_apt_mirror
+++ b/modules/mirrors/files/check_apt_mirror
@@ -9,8 +9,8 @@
        exit 1
 fi
 
-HOSTNAME=$(hostname -f)
-STAMP=${TO}/project/trace/${HOSTNAME}
+FQDN=$(hostname -f)
+STAMP=${TO}/project/trace/${FQDN}
 WARN=6
 CRITICAL=12
 
diff --git a/modules/mysql/templates/mysql.init.erb 
b/modules/mysql/templates/mysql.init.erb
index 8aef417..d1cfba9 100755
--- a/modules/mysql/templates/mysql.init.erb
+++ b/modules/mysql/templates/mysql.init.erb
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
 # This file is public domain and comes with NO WARRANTY of any kind
 
diff --git a/modules/puppetmaster/files/motd/99-obsolete 
b/modules/puppetmaster/files/motd/99-obsolete
index 2188783..e3ff246 100755
--- a/modules/puppetmaster/files/motd/99-obsolete
+++ b/modules/puppetmaster/files/motd/99-obsolete
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 echo
-echo "\033[1;31m"
+printf "\033[1;31m\n"
 echo "This system is no longer an active puppetmaster."
 echo "Everything you did here should now be done on puppetmaster1001."
-echo "\033[0m"
+printf "\033[0m\n"
 echo
diff --git a/modules/quarry/files/celeryd b/modules/quarry/files/celeryd
index 0fe704f..b1b8c0b 100644
--- a/modules/quarry/files/celeryd
+++ b/modules/quarry/files/celeryd
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 # ============================================
 #  celeryd - Starts the Celery worker daemon.
 # ============================================
diff --git a/modules/shinken/files/init b/modules/shinken/files/init
index f8effea..5e88474 100755
--- a/modules/shinken/files/init
+++ b/modules/shinken/files/init
@@ -325,7 +325,7 @@
     }
     if [ ! -z "$pid" ]; then
         kill "$pid"
-        sleep 0.5
+        /bin/sleep 0.5
         ## TODO: instead of 'sleep 1': wait up to when pid file is removed 
(with timeout)?
         for i in 1 2 3
         do

-- 
To view, visit https://gerrit.wikimedia.org/r/316529
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc841a52be47ca33ca8737a383ac6f7e2ed718c4
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Alex Monk <a...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Jcrespo <jcre...@wikimedia.org>
Gerrit-Reviewer: Ottomata <o...@wikimedia.org>
Gerrit-Reviewer: Volans <rcocci...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to