Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Greg Wooledge
On Tue, Aug 17, 2021 at 06:03:36PM +0300, Ilkka Virta wrote:
> I have this in the configure script:
> 
> if test $ac_compiler_gnu = yes; then
>   GCC=yes
> else
>   GCC=
> fi
> 
> I don't know which part of autoconf exactly generates it.

It comes from the AC_PROG_CC macro.  On my system, this brings in text
from /usr/share/autoconf/autoconf/c.m4 in which this block of Bourne
shell code is seen verbatim.

> As far as I can see, that's actually already fixed in the devel branch:
> https://git.savannah.gnu.org/cgit/bash.git/tree/configure.ac?h=devel#n417
> and
> https://git.savannah.gnu.org/cgit/bash.git/tree/CWRU/CWRU.chlog?h=devel#n1503

Dropping Bourne shell compatibility.  I can live with that, if Chet can. ;-)



Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Ilkka Virta
On Tue, Aug 17, 2021 at 5:40 PM Greg Wooledge  wrote:

> I'm still wondering what issue the OP is actually seeing.  If they claim
> that changing ${GCC+-stuff} to ${GCC:+-stuff} in some file fixes things,
> and if they also claim that *something* is setting the GCC variable to
> the empty string rather than unsetting it, then perhaps it's not a
> syntactic error at all, but rather a logical error.
>

I have this in the configure script:

if test $ac_compiler_gnu = yes; then
  GCC=yes
else
  GCC=
fi

I don't know which part of autoconf exactly generates it. They also
mentioned it in this message:
https://lists.gnu.org/archive/html/bug-readline/2021-08/msg2.html


> Either the thing that's setting GCC to the empty string ought to be
> changed to unset GCC, or else the ${GCC+-stuff} check ought to be changed
> to ${GCC:+-stuff} (at the risk of breaking Bourne shell compatibility,
> if we care about that).
>

As far as I can see, that's actually already fixed in the devel branch:
https://git.savannah.gnu.org/cgit/bash.git/tree/configure.ac?h=devel#n417
and
https://git.savannah.gnu.org/cgit/bash.git/tree/CWRU/CWRU.chlog?h=devel#n1503


Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Greg Wooledge
On Tue, Aug 17, 2021 at 07:30:45AM -0700, L A Walsh wrote:
> The pairs are about 4 related operations.  If you let P = the oPerator
> then the odd lines are about ':P' and the even lines are about 'P' (no
> colon).
> The Pairs from 1-4 are about the operators: '-', '=', '?', '+'
> 
> Pair 4 shows effects of ':+' and '+'.
> 
> Isn't that what you are talking about?
> 
> Yeah -- w/o the ':' looks a bit 'off', but it has a separate meaning
> and has been around for a long time.
> 
> (I first encountered it when porting 1980's era scripts)

The form without the colon (':') is the original form, and comes from
the Bourne shell.  If you read sufficiently old literature, you'll see
*only* those forms mentioned.

The form with the colon was added by the first Korn shell, and became
widely adopted by other shells.  Eventually it became standardized
in POSIX.

So yes, all 8 forms are standardized by POSIX.

I'm still wondering what issue the OP is actually seeing.  If they claim
that changing ${GCC+-stuff} to ${GCC:+-stuff} in some file fixes things,
and if they also claim that *something* is setting the GCC variable to
the empty string rather than unsetting it, then perhaps it's not a
syntactic error at all, but rather a logical error.

Either the thing that's setting GCC to the empty string ought to be
changed to unset GCC, or else the ${GCC+-stuff} check ought to be changed
to ${GCC:+-stuff} (at the risk of breaking Bourne shell compatibility,
if we care about that).

But this is speculative until they tell us what the actual problem is.



Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread L A Walsh




On 2021/08/17 04:02, Osipov, Michael (LDA IT PLM) wrote:

Folks,

this is basically the same issue as I reported in readline: 
https://lists.gnu.org/archive/html/bug-readline/2021-08/msg0.html


The bad hunk seems not to be POSIX shell compliant.

I think your eyes are fooling you.  I looked at the link below, and it
has both ":+" and "+".
The table on that page has 8 lines after the title line, right?

If you would think of the 8 lines as 4 pairs, like:

lines   pair
1+2 1
3+4 2
5+6 3
7+8 4

The pairs are about 4 related operations.  If you let P = the oPerator
then the odd lines are about ':P' 
and the even lines are about 'P' (no colon).

The Pairs from 1-4 are about the operators: '-', '=', '?', '+'

Pair 4 shows effects of ':+' and '+'.

Isn't that what you are talking about? 


Yeah -- w/o the ':' looks a bit 'off', but it has a separate meaning
and has been around for a long time.

(I first encountered it when porting 1980's era scripts)





Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Greg Wooledge
On Tue, Aug 17, 2021 at 04:03:17PM +0200, Osipov, Michael (LDA IT PLM) wrote:
> Am 2021-08-17 um 15:53 schrieb Greg Wooledge:
> > What version of HP-UX?  What is the actual error you're getting?
> 
> Latest and greatest: 11.31 v3
> 
> > I only have access to certain older versions of HP-UX, but I don't
> > see what you're claiming.
> >
> > # exec /bin/sh
> > # uname -a
> > HP-UX minea B.11.11 U 9000/785 4239047153 unlimited-user license
> > # GCC=gcc
> > # echo "[${GCC+-foo}]"
> > [-foo]
> > # unset GCC
> > # echo "[${GCC+-foo}]"
> > []
> > #
> This is *not* the same as in the configure script. It does not unset the
> variable, but sets to empty.

# exec /bin/sh
# uname -a
HP-UX minea B.11.11 U 9000/785 4239047153 unlimited-user license
# GCC=gcc
# echo "[${GCC+-foo}]"
[-foo]
# unset GCC
# echo "[${GCC+-foo}]"
[]
# GCC=
# echo "[${GCC+-foo}]"
[-foo]
#

What error are you seeing?



Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Osipov, Michael (LDA IT PLM)

Am 2021-08-17 um 15:53 schrieb Greg Wooledge:
> On Tue, Aug 17, 2021 at 01:02:06PM +0200, Osipov, Michael (LDA IT 
PLM) wrote:

>> this is basically the same issue as I reported in readline:
>> 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.gnu.org%2Farchive%2Fhtml%2Fbug-readline%2F2021-08%2Fmsg0.htmldata=04%7C01%7C9d76b566-97f1-4355-9dbf-6dcc0e8868d3%40ad011.siemens.com%7Cdd721486d960498e334208d961866c31%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637648052231708973%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000sdata=WbUfO3CqZD3MIiGEk9aZXGanP6ehE2qLM6buLxQ5l98%3Dreserved=0

>
> As Chet said in that message, you have misinterpreted the POSIX
> documentation.
>
>> The bad hunk seems not to be POSIX shell compliant. Both vars are 
set for me
>> on HP-UX because the expansion is incomplete. According to [1] it 
has to be

>> $(GCC:+..} and not $(GCC+..}. I have changed ./configure locally and it
>> works with /bin/sh.
>
> What version of HP-UX?  What is the actual error you're getting?

Latest and greatest: 11.31 v3

> I only have access to certain older versions of HP-UX, but I don't
> see what you're claiming.
>
> # exec /bin/sh
> # uname -a
> HP-UX minea B.11.11 U 9000/785 4239047153 unlimited-user license
> # GCC=gcc
> # echo "[${GCC+-foo}]"
> [-foo]
> # unset GCC
> # echo "[${GCC+-foo}]"
> []
> #
This is *not* the same as in the configure script. It does not unset the 
variable, but sets to empty.




Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Chet Ramey
On 8/17/21 7:02 AM, Osipov, Michael (LDA IT PLM) wrote:
> Folks,
> 
> this is basically the same issue as I reported in readline:
> https://lists.gnu.org/archive/html/bug-readline/2021-08/msg0.html
> 
> The bad hunk seems not to be POSIX shell compliant. 

It is valid POSIX shell code.

https://lists.gnu.org/archive/html/bug-readline/2021-08/msg1.html


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Greg Wooledge
On Tue, Aug 17, 2021 at 01:02:06PM +0200, Osipov, Michael (LDA IT PLM) wrote:
> this is basically the same issue as I reported in readline:
> https://lists.gnu.org/archive/html/bug-readline/2021-08/msg0.html

As Chet said in that message, you have misinterpreted the POSIX
documentation.

> The bad hunk seems not to be POSIX shell compliant. Both vars are set for me
> on HP-UX because the expansion is incomplete. According to [1] it has to be
> $(GCC:+..} and not $(GCC+..}. I have changed ./configure locally and it
> works with /bin/sh.

What version of HP-UX?  What is the actual error you're getting?

I only have access to certain older versions of HP-UX, but I don't
see what you're claiming.

# exec /bin/sh
# uname -a
HP-UX minea B.11.11 U 9000/785 4239047153 unlimited-user license
# GCC=gcc
# echo "[${GCC+-foo}]"
[-foo]
# unset GCC
# echo "[${GCC+-foo}]"
[]
#

>From your email, my first guess was that you thought there was a parsing
ambiguity when the +- characters appeared together, but I cannot reproduce
any problem.  Please give more detail.

(P.S. you also have typos in your email.  You've got an open left paren
which is "matched" by a closing right curly brace.  If you actually
edited some file and introduced that typo, that might account for whatever
error you're seeing.  If on the other hand there really is a mismatched
paren-brace error in one of bash's source code files, that would be a
real bug.)



bash-5.1.8 does not compile anymore on HP-UX due to invalid shell syntax

2021-08-17 Thread Osipov, Michael (LDA IT PLM)

Folks,

this is basically the same issue as I reported in readline: 
https://lists.gnu.org/archive/html/bug-readline/2021-08/msg0.html


The bad hunk seems not to be POSIX shell compliant. Both vars are set 
for me on HP-UX because the expansion is incomplete. According to [1] it 
has to be $(GCC:+..} and not $(GCC+..}. I have changed ./configure 
locally and it works with /bin/sh.


I assume that this should also work on any other POSIX compliant shell.

Michael

[1] 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02