WRF icon indicating copy to clipboard operation
WRF copied to clipboard

Bugfix: Correct string test in configure.

Open douglowe opened this issue 2 years ago • 9 comments

Correct string test in configure.

TYPE: bug fix

KEYWORDS: configure script

SOURCE: Will Hatheway @whatheway Douglas Lowe

DESCRIPTION OF CHANGES: Problem: Configure is returning an 'Unexpected Operator' error, which is messing up automated scripts for installing WRF.

Solution: The [ ] test on line 919 of the configure script should use =, not ==, for the string comparison - as this is a more portable syntax (see http://mywiki.wooledge.org/BashFAQ/031 for explanation of this).

LIST OF MODIFIED FILES: configure

TESTS CONDUCTED:

  1. Do mods fix problem? How can that be demonstrated, and was that test conducted?
  2. Are the Jenkins tests all passing?

RELEASE NOTE: Correction of string test in configure.

douglowe avatar May 07 '22 16:05 douglowe

@douglowe Can you let us know what type of system are you running the script on? There are other '==' instances in the configure script, is this one special in some way?

weiwangncar avatar May 07 '22 17:05 weiwangncar

Good morning,

I asked @douglowe to help me with this pull request because I am uncertain of the format to do one.

When using ubuntu 20.04.4, the WRF ./configure will toss an error message at line 919 when using configure options 34, 1.

The error message says unexpected operator at line 919.

On Sat, May 7, 2022 at 12:21 PM weiwangncar @.***> wrote:

@douglowe https://github.com/douglowe Can you let us know what type of system are you running the script on? There are other '==' instances in the configure script, is this one special in some way?

— Reply to this email directly, view it on GitHub https://github.com/wrf-model/WRF/pull/1735#issuecomment-1120244546, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATF3TC2TYJK6TJPNRZGPNI3VI2RARANCNFSM5VKTQI4A . You are receiving this because you were mentioned.Message ID: @.***>

ghost avatar May 07 '22 17:05 ghost

This is the error message.

Testing for NetCDF, C and Fortran compiler

This installation of NetCDF is 64-bit C compiler is 64-bit Fortran compiler is 64-bit It will build in 64-bit

NetCDF version: 4.8.1 Enabled NetCDF-4/HDF-5: yes NetCDF built with PnetCDF: no ./configure: 919: [: unexpected operator

While the ./configure and ./compile will finish running without issue the problem occurs at WPS ./configure. WPS ./configure will say that WRF was not compiled correctly. After modifying line 919 in my ./configure file this issue was resolved.

I believe it has to do with the fact that In a POSIX shell, the test operator for string equality is =:

$ sh -c '[ "a" = "a" ] && echo equal' equal

whereas

$ sh -c '[ "a" == "a" ] && echo equal' sh: 1: [: a: unexpected operator

== is a provided as a synonym for = in the bash shell. From the CONDITIONAL EXPRESSIONS section of man bash:

ghost avatar May 07 '22 17:05 ghost

The Jenkins tests have passed:

Test Type              | Expected  | Received |  Failed
= = = = = = = = = = = = = = = = = = = = = = = =  = = = =
Number of Tests        : 23           24
Number of Builds       : 60           58
Number of Simulations  : 158           156        0
Number of Comparisons  : 95           92        0

Failed Simulations are: 
None
Which comparisons are not bit-for-bit: 
None

weiwangncar avatar May 09 '22 16:05 weiwangncar

@whatheway Thanks for the explanation.

weiwangncar avatar May 09 '22 16:05 weiwangncar

@whatheway Thanks for the explanation.

You're welcome

ghost avatar May 17 '22 09:05 ghost

@mgduda Can you help review this PR? Thanks!

weiwangncar avatar Aug 02 '22 18:08 weiwangncar

target is master

dudhia avatar Aug 03 '22 16:08 dudhia

@whatheway Does this error cause configure script to abort?

weiwangncar avatar Aug 08 '22 17:08 weiwangncar

What's the status of this PR? The ghost account is my old account that got deleted.

HathewayWill avatar Dec 27 '22 00:12 HathewayWill

Also does it on Ubuntu 22.04.

System Libraries:

zlib 1.2.13 hdf5 1.13.2 netcdf-c 4.9.0 netcdf fortran 4.6.0 mpich 4.0.3 libpng 1.6.39 jasper 1.900.1

uname -a Linux workhorse-MS-7D91 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

HathewayWill avatar Dec 27 '22 00:12 HathewayWill

target is master

@weiwangncar @dudhia

What is the status?

HathewayWill avatar Dec 31 '22 12:12 HathewayWill

@weiwangncar @dudhia @mgduda

@whatheway Does this error cause configure script to abort?

Doesn't cause the script to abort.

Just raises a flag that there is an error.

Saw this issue raised in the forum a few times. Which is why I made a PR request.

HathewayWill avatar Dec 31 '22 12:12 HathewayWill

Would it be worth fixing this same issue on lines 186 and 318 in the configure script, too?

Apologies for the delay. I've made these edits too.

douglowe avatar Dec 31 '22 13:12 douglowe

@douglowe

https://github.com/wrf-model/WRF/pull/1735/files/4562042ee91aefd792a4e89f53a1565f6fdcfef6..0bd20c7b2b9e8f1a87d91f4d5ffeefa2b611bb57

Just noticed something,

you are pushing into 4.4.1 but the current release is 4.4.2

On Sat, Dec 31, 2022 at 7:26 AM Douglas Lowe @.***> wrote:

Would it be worth fixing this same issue on lines 186 https://github.com/wrf-model/WRF/blob/release-v4.4.1/configure#L186 and 318 https://github.com/wrf-model/WRF/blob/release-v4.4.1/configure#L318 in the configure script, too?

Apologies for the delay. I've made these edits too.

— Reply to this email directly, view it on GitHub https://github.com/wrf-model/WRF/pull/1735#issuecomment-1368215604, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4FUT5WTDPMKAUYLXDIJNNLWQAYBPANCNFSM5VKTQI4A . You are receiving this because you commented.Message ID: @.***>

HathewayWill avatar Dec 31 '22 13:12 HathewayWill

@douglowe @weiwangncar @dudhia @mgduda @HathewayWill

Without bug fix

NetCDF version: 4.9.0
Enabled NetCDF-4/HDF-5: yes
NetCDF built with PnetCDF: yes
./configure: 919: [: unexpected operator
 

With Bug Fix:

NetCDF version: 4.9.0
Enabled NetCDF-4/HDF-5: yes
NetCDF built with PnetCDF: yes
 

HathewayWill avatar Dec 31 '22 13:12 HathewayWill

@weiwangncar I've changed the base to release-v4.5. (I see that there's a release-v4.4.3 branch, but at this point are we expecting that there will be a v4.4.3 bugfix release before the v4.5 release?)

mgduda avatar Feb 07 '23 02:02 mgduda