RFR [8025886] replace == and [[ bash extensions
Staffan Larsen
staffan.larsen at oracle.com
Wed Nov 20 09:18:59 PST 2013
Reviewed.
/Staffan
On 20 nov 2013, at 17:34, Ivan Gerasimov <ivan.gerasimov at oracle.com> wrote:
> 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