Re: [fluka-discuss]: fff line 119 warning fix

From: Serban Udrea <s.udrea_at_gsi.de>
Date: Fri, 22 Mar 2019 16:32:23 +0100

On 3/22/19 1:59 PM, Alfredo Ferrari wrote:
> ... evidently even bash has different subflavours, with the standard fff with
>
> [[ "$TARGET_MACHINE" = "Linux" ] && [ "$FLUFOR" = "g77" ]]
>
> pceet030:flutil > ./fff usbrea.f
> usbrea:
>   lnnbln:
>...

Hello again,

This is very strange from my point of view. To my understanding, according to
bash's help docs the above syntax is illegal. I tested it on three different
systems: my usual workhorse with Slackware 14.2 and bash 4.3.48, my new laptop
with Slackware -current and bash 5.0.0, and a Debian 8.11 (Jessie) system from the
Linux-pool at GSI with bash version 4.3.30 and I get the same error.

Moreover, within my FLUKA installation as well as within all the archives (tar.gz
or rpm) presently available from fluka.org the fff file has the following line 119:

if [[ "$TARGET_MACHINE" = "Linux" && "$FLUFOR" = "g77" ]] ; then

This is different from the reported one (the two inner square brackets are
missing), gives no error with all bash versions I tested and conforms, as much as
I understand it, to bash's help docs. Thus I am wondering why Angel has a
different line in fff and what fff did Alfredo use?!

However, while on my Slackware boxes /bin/sh also is a link to bash -- this
actually is supposed to influence bash's behaviour(*) -- on the mentioned Debian
system /bin/sh is a link to dash which doesn't recognize '[[' as valid:

[[ "$TARGET_MACHINE" = "Linux" ] && [ "$FLUFOR" = "g77" ]]
dash: 2: [[: not found

It looks like Angel indeed has /bin/sh linked to dash.

Finally, the expression

[ "$TARGET_MACHINE" = "Linux" -a "$FLUFOR" = "g77" ]

works both with bash and dash (invoked directly or through /bin/sh), according to
my tests. Maybe you test it also on your systems too and if it works the
developers may think about using it.

Best regards,
Serban

(*) From the man page:
"If bash is invoked with the name sh, it tries to mimic the startup behavior of
historical versions of sh as closely as possible, while conforming to the POSIX
standard as well."

-- 
Dr. Serban Udrea
Researcher
p-Linac/p-Bar-Target
Phone: +49 6159 71 3356
Fax: +49 6159 71 3099
S.Udrea_at_gsi.de
GSI Helmholtzzentrum für Schwerionenforschung GmbH
Planckstraße 1, 64291 Darmstadt, Germany, www.gsi.de
Commercial Register / Handelsregister: Amtsgericht Darmstadt, HRB 1528
Managing Directors / Geschäftsführung:
Professor Dr. Paolo Giubellino, Ursula Weyrich, Jörg Blaurock
Chairman of the Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
State Secretary / Staatssekretär Dr. Georg Schütte
__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Fri Mar 22 2019 - 17:41:02 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 22 2019 - 17:41:03 CET