WRF
WRF copied to clipboard
Bugfix: Correct string test in configure.
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:
- Do mods fix problem? How can that be demonstrated, and was that test conducted?
- Are the Jenkins tests all passing?
RELEASE NOTE: Correction of string test in configure.
@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?
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: @.***>
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:
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
@whatheway Thanks for the explanation.
@whatheway Thanks for the explanation.
You're welcome
@mgduda Can you help review this PR? Thanks!
target is master
@whatheway Does this error cause configure script to abort?
What's the status of this PR? The ghost account is my old account that got deleted.
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
target is master
@weiwangncar @dudhia
What is the status?
@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.
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
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: @.***>
@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
@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?)