RFR [8025886] replace == and [[ bash extensions
Ivan Gerasimov
ivan.gerasimov at oracle.com
Wed Nov 20 08:34:17 PST 2013
Hello all!
Any chance to have this simple fix approved?
The proposal is to get rid of == and [[ bash extensions, as this is the
only place they are used in jdk regtests and sh-shell is not happy with
them.
Thanks in advance,
Ivan Gerasimov
--- a/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh
+++ b/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh
@@ -34,12 +34,13 @@
OS=`uname -s`
UMASK=`umask`
-if [[ $OS == CYGWIN_NT* ]] ; then
+case $OS in
+CYGWIN_NT*)
OS="Windows_NT"
if [ -z "$SystemRoot" ] ; then
- SystemRoot=$SYSTEMROOT
+ SystemRoot=$SYSTEMROOT
fi
-fi
+esac
case $OS in
SunOS | Linux | Darwin)
On 09.10.2013 0:34, Ivan Gerasimov wrote:
> Thanks, Dmitry!
>
> I assume I still need an approval from the Reviewer.
>
> Sincerely yours,
> Ivan
>
> On 05.10.2013 21:30, Dmitry Samersoff wrote:
>> Ivan,
>>
>> Looks good for me.
>>
>> -Dmitry
>>
>> On 2013-10-05 17:04, Ivan Gerasimov wrote:
>>> Dmitry, thanks for suggestion!
>>>
>>> Yes, == comparison isn't the only sh-incompatible thing in the script.
>>> Sh may be unhappy with [[ as well.
>>> So I replaced it with case as you suggested.
>>> Grep shows that it was the only place where [[ and == were used in
>>> regtests, so it would be good to make things consistent.
>>>
>>> Please find a new patch below.
>>>
>>> Sincerely yours,
>>> Ivan
>>>
>>> ---
>>> a/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh
>>> +++
>>> b/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh
>>> @@ -34,12 +34,13 @@
>>> OS=`uname -s`
>>> UMASK=`umask`
>>>
>>> -if [[ $OS == CYGWIN_NT* ]] ; then
>>> +case $OS in
>>> +CYGWIN_NT*)
>>> OS="Windows_NT"
>>> if [ -z "$SystemRoot" ] ; then
>>> - SystemRoot=$SYSTEMROOT
>>> + SystemRoot=$SYSTEMROOT
>>> fi
>>> -fi
>>> +esac
>>>
>>> case $OS in
>>> SunOS | Linux | Darwin)
>>>
>>>
>>>
>>> On 04.10.2013 15:34, Dmitry Samersoff wrote:
>>>> Ivan,
>>>>
>>>> If you need shell pattern match CYGWIN_NT*
>>>> it's better to use
>>>>
>>>> case
>>>>
>>>> but not
>>>>
>>>> if
>>>>
>>>> -Dmitry
>>>>
>>>>
>>
>
>
>
More information about the serviceability-dev
mailing list