All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: Xenomai-core@domain.hid
Subject: Re: [Xenomai-core] [Fwd: Bug#471871: xenomai-runtime: bashism in	/bin/sh script]
Date: Mon, 24 Mar 2008 14:51:55 +0100	[thread overview]
Message-ID: <18407.45563.134939.963369@domain.hid> (raw)
In-Reply-To: <47E4196F.2070303@domain.hid>

[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 145 bytes --]

Jan Kiszka wrote:
 > Maybe someone with idle cycles left could have a look at this.

Ok. Here comes an (untested) patch.

-- 


					    Gilles.

[-- Attachment #2: xeno-sh-scripts.diff --]
[-- Type: text/plain, Size: 4291 bytes --]

Index: scripts/xeno-info
===================================================================
--- scripts/xeno-info	(revision 3623)
+++ scripts/xeno-info	(working copy)
@@ -74,7 +74,7 @@ ldd -v > /dev/null 2>&1 && ldd -v || ldd
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'
 fi
 
-ls -l /usr/lib/lib{g,stdc}++.so  2>/dev/null | awk -F. \
+ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so  2>/dev/null | awk -F. \
        '{print "Linux C++ Library      " $4"."$5"."$6}'
 
 if test 0 -eq $withBusybox ; then 
Index: scripts/xeno-load.in
===================================================================
--- scripts/xeno-load.in	(revision 3623)
+++ scripts/xeno-load.in	(working copy)
@@ -127,7 +127,7 @@ children_pids=""
 cleanup () {
 
     if test \! "x$children_pids" = x; then
-       $sudo kill -SIGINT $children_pids >& /dev/null
+       $sudo kill -SIGINT $children_pids > /dev/null 2>&1
        children_pids=""
        sleep 1
     fi
Index: scripts/xeno-test.in
===================================================================
--- scripts/xeno-test.in	(revision 3623)
+++ scripts/xeno-test.in	(working copy)
@@ -60,9 +60,9 @@ pidFile=/var/lock/`basename $0.$$`.pids
 
 checkUtilities() {
   # Check for needed helper utilities
-  local neededApplets="awk basename cut date dd dirname egrep grep head
+  neededApplets="awk basename cut date dd dirname egrep grep head
 		       kill md5sum mount sleep test top uname zcat"
-  local foundAll=1
+  foundAll=1
   for  _j in $neededApplets
   do
     if test -z "`which $_j`"; then
@@ -74,11 +74,17 @@ checkUtilities() {
     echo "Please build busybox's ash with support for getopts"
     foundAll=0
   fi
-  if test $foundAll -eq 0 ; then exit 3 ; fi
+  if test $foundAll -eq 0 ; then 
+      needApplets=""
+      foundAll=""
+      exit 3
+  fi
+  needApplets=""
+  foundAll=""
 }
 
 checkHelpers() {
-  local foundAll=1
+  foundAll=1
   if test -z "`which script`" -a -n "$logging"; then
       echo "You will not be able to log (-L option) as script is missing"
       foundAll=0
@@ -91,7 +97,11 @@ checkHelpers() {
       echo "You will not be able to upload (-U option) as curl is missing"
       foundAll=0
   fi
-  if test $foundAll -eq 0 ; then exit 3 ; fi
+  if test $foundAll -eq 0 ; then 
+      foundAll=""
+      exit 3
+  fi
+  foundAll=""
 }
 
 loudly() {
@@ -111,7 +121,7 @@ dd_jobs=
 mkload() { dd if=$device of=/dev/null $* & }
 
 generate_loads() {
-    local jobsct=$1;
+    jobsct=$1;
     # if test -z "$1"; then echo Skipping generate_loads; return; fi
     shift 1
     if test 0 -eq $withBusybox ; then
@@ -120,13 +130,14 @@ generate_loads() {
 	trap cleanup_load EXIT	# under all exit conditions
     fi
     while test $jobsct -ge 1; do 
-        jobsct=$((jobsct-1)); 
+        jobsct=`expr $jobsct - 1`; 
         mkload
         dd_jobs="$dd_jobs $!" ;
     done
 
     echo dd workload started, pids $dd_jobs stored in $pidFile
     echo  $dd_jobs > $pidFile
+    jobsct=""
 }
 
 cleanup_load() {
@@ -159,7 +170,7 @@ boxinfo() { # static info, show once
     loudly md5sum /proc/cpuinfo	'# cpuinfo fingerprint'
 
     # how much of the config do we want ?
-    local filter=" grep -E '$whatconf'"
+    filter=" grep -E '$whatconf'"
     [ "$verbose" = 1 ] && filter=
     if test -f /proc/config.gz; then # get the config
          loudly zcat /proc/config.gz | $filter
@@ -170,6 +181,7 @@ boxinfo() { # static info, show once
 
     [ -d /proc/adeos ] && for f in /proc/adeos/*; do loudly cat $f; done
     [ -d /proc/ipipe ] && for f in /proc/ipipe/*; do loudly cat $f; done
+    filter=""
 }
 
 boxstatus() {     # get dynamic status
@@ -274,7 +286,7 @@ verbose=
 dateargs='+%y%m%d.%H%M%S'
 
 sendit() {
-    local file=$1
+    file=$1
     if test "$sendit" = 'm' ; then
 	echo "mailing $file to $email"
 	if test -n "$file" ; then
@@ -290,6 +302,7 @@ sendit() {
     else
 	echo "sendit unsupported option '$sendit'"
     fi
+    file=""
 }
 
 handle_options() {	# called for XENOTEST_OPTS, ARGV
@@ -379,7 +392,7 @@ if test "$logging" != "" ; then
     # restart inside a script invocation, passing appropriate args
     script -c "`dirname $0`/xeno-test $loadpass $latpass $*" $wfile
     res="$?"
-    if test "$res" == "0" ; then
+    if test "$res" = "0" ; then
 	sendit $wfile
     fi
 else

  parent reply	other threads:[~2008-03-24 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-21 20:24 [Xenomai-core] [Fwd: Bug#471871: xenomai-runtime: bashism in /bin/sh script] Jan Kiszka
2008-03-22 15:54 ` Roland Stigge
2008-03-23 16:45   ` Gilles Chanteperdrix
2008-03-24 13:51 ` Gilles Chanteperdrix [this message]
2008-03-24 14:14 ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18407.45563.134939.963369@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=Xenomai-core@domain.hid \
    --cc=jan.kiszka@domain.hid \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.