﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
154	Troubleshooting with sh -x and Ubuntu, Replace ==  for stricter POSIX conformance with =	Scott Cummings	Bruno Cornec	"Would be academic except for these circumstances - 

1.  Ubuntu - which points sh to /bin/dash (https://wiki.ubuntu.com/DashAsBinSh) together with

2.  http://trac.mondorescue.org/wiki/TroubleShooting - Trouble-Shooting mindi

=== Using    sh -x /usr/sbin/mindi 2>&1  gives different results than mindi by itself. ===

example:

{{{
$ ./fragment
TMPMODPROBE_FLAG=Y
}}}

{{{
$ sh -x ./fragment  2>&1 
+ [ -d /etc/modprobe.d ]
+ cut -c1-3
+ uname -r
+ [ 2.6 == 2.6 ]
[: 1: ==: unexpected operator
+ echo TMPMODPROBE_FLAG=N
TMPMODPROBE_FLAG=N
}}}

(Yes, if one is observant one see the 'unexpected operator' message, but the script continues to run, so I was surprised by the result.)

{{{
$ cat fragment
#!/bin/bash 
# Test mindi fragment under debug - sh -x 
if [ -d ""/etc/modprobe.d"" ] && [ `uname -r | cut -c1-3` == ""2.6"" ] ; then
        echo TMPMODPROBE_FLAG=""Y""
else
        echo TMPMODPROBE_FLAG=""N""
fi
}}}

If the == is changed to = then the result is - 
{{{
$ sh -x ./fragment  2>&1 
+ [ -d /etc/modprobe.d ]
+ uname -r
+ cut -c1-3
+ [ 2.6 = 2.6 ]
+ echo TMPMODPROBE_FLAG=Y
TMPMODPROBE_FLAG=Y
}}}

----

Of course, this could be solved also by changing to -
{{{
$ bash -x ./fragment  2>&1 
+ '[' -d /etc/modprobe.d ']'
++ uname -r
++ cut -c1-3
+ '[' 2.6 == 2.6 ']'
+ echo TMPMODPROBE_FLAG=Y
TMPMODPROBE_FLAG=Y
}}}
So maybe the troubleshooting tip should have   '''bash''' -x /usr/sbin/mindi 2>&1 ?

Regards,

Scott"	defect	closed	normal	2.2.3	mindi	2.2.2	minor	fixed		
