Re: bizarre failures on NetBSD 9.3 x86_64

2023-05-12 Thread Bruno Haible
Dennis Clarke wrote:
> > The error messages "shift: can't shift that many" and
> > "test: ==: unexpected operator" indicate another shell problem.
> 
> I see that and have no idea why that happens.

In fact, it's already fixed in git as well. Since 2018-02-07 already.

> So maybe we need to
> test all this on a really strict POSIX type machine which will stomp all
> over anything not strictly portable. May be a waste of time. I have a
> friend with an IBM MainFrame in his life and those things are a
> nightmare for anything that is not strictly in compliance.

It is a myth to believe that a piece of software is particularly standards
compliant because there is the label "IBM" on it. It is actually quite the
opposite: The softwares that are most standards compliant are those which
have the largest user base (because those users report issues!); software
with a small user base (such as expensive software by companies like IBM
or Oracle) tend to have significantly more standards compliance issues.
That's my experience with gnulib, which you can verify by reading the
per-function documentation of many functions in the Gnulib manual [1][2][3].

Bruno

[1] https://www.gnu.org/software/gnulib/manual/html_node/posix_005fspawn.html
[2] https://www.gnu.org/software/gnulib/manual/html_node/thrd_005fjoin.html
[3] https://www.gnu.org/software/gnulib/manual/html_node/strtoimax.html






Re: bizarre failures on NetBSD 9.3 x86_64

2023-05-11 Thread Bug reports, suggestions, general discussion for GNU patch.

On 5/10/23 16:58, Bruno Haible wrote:

Dennis Clarke wrote:

bash-5.1$ echo $CONFIG_SHELL
/usr/pkg/bin/bash
bash-5.1$

Guess what ?


Testsuite summary for GNU patch 2.7.6

# TOTAL: 44
# PASS:  42
# SKIP:  0
# XFAIL: 2
# FAIL:  0
# XPASS: 0
# ERROR: 0


Gotta love the need for GNU bash for this to work. Makes no sense at all
for "patch".


Interesting. I came up with a workaround, by modifying test-lib.sh, and it
is in fact already committed in git:
https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commitdiff;h=7623b2dc0d1837ecfd58f32efc78e35834deeb38

But for me, then I get a test failure, see attached log file.

The error messages "shift: can't shift that many" and
"test: ==: unexpected operator" indicate another shell problem.


I see that and have no idea why that happens. On NetBSD 9.3 AMD64 the
solution seems to be that we need CONFIG_SHELL set to the bash shell.
That is not portable nor does it make sense but it works in that it
allows the testsuite to run cleanly. Which prooves to me that the binary
that was just compiled works fine. The testsuite is not the final
product for me ... I just want that gpatch binary!  So maybe we need to
test all this on a really strict POSIX type machine which will stomp all
over anything not strictly portable. May be a waste of time. I have a
friend with an IBM MainFrame in his life and those things are a
nightmare for anything that is not strictly in compliance. Might be
worth a look.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
Four decades in production systems.




Re: bizarre failures on NetBSD 9.3 x86_64

2023-05-10 Thread Bruno Haible
Dennis Clarke wrote:
> bash-5.1$ echo $CONFIG_SHELL
> /usr/pkg/bin/bash
> bash-5.1$
> 
> Guess what ?
> 
> 
> Testsuite summary for GNU patch 2.7.6
> 
> # TOTAL: 44
> # PASS:  42
> # SKIP:  0
> # XFAIL: 2
> # FAIL:  0
> # XPASS: 0
> # ERROR: 0
> 
> 
> Gotta love the need for GNU bash for this to work. Makes no sense at all
> for "patch".

Interesting. I came up with a workaround, by modifying test-lib.sh, and it
is in fact already committed in git:
https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commitdiff;h=7623b2dc0d1837ecfd58f32efc78e35834deeb38

But for me, then I get a test failure, see attached log file.

The error messages "shift: can't shift that many" and
"test: ==: unexpected operator" indicate another shell problem.

Bruno
===
   GNU patch 2.7.6: tests/test-suite.log
===

# TOTAL: 44
# PASS:  41
# SKIP:  0
# XFAIL: 2
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

XFAIL: context-format
=

* patch < ab.diff -- FAILED
--- expected
+++ got
@@ -1 +1 @@
-patching file a
+/home/bruno/patch-2.7.6/src/patch:  replacement text or line numbers mangled in hunk at line 4
* patch < ab.diff -- FAILED
--- expected
+++ got
@@ -1 +1 @@
-patching file a
+/home/bruno/patch-2.7.6/src/patch:  replacement text or line numbers mangled in hunk at line 4
2 tests (0 passed, 2 failed)
XFAIL context-format (exit status: 1)

XFAIL: dash-o-append


* patch -o a.new a < a.diff -- FAILED
--- expected
+++ got
@@ -1,2 +1,4 @@
 patching file a.new (read from a)
 patching file a.new (read from a)
+Hunk #1 FAILED at 1.
+1 out of 1 hunk FAILED -- saving rejects to file a.new.rej
* cat a.new -- FAILED
--- expected
+++ got
@@ -1,2 +1,2 @@
 two
-three
+one
2 tests (0 passed, 2 failed)
XFAIL dash-o-append (exit status: 1)

FAIL: merge
===

* x 3 -- FAILED
--- expected
+++ got
@@ -1,7 +1 @@
-1
-2
-3
-
-1
-2
-3
+shift: can't shift that many
* x 3  2d -- FAILED
--- expected
+++ got
@@ -1,5 +1 @@
-1
-3
-
-1
-3
+shift: can't shift that many
* x 2  2i\\ b -- FAILED
--- expected
+++ got
@@ -1,7 +1 @@
-1
-b
-2
-
-1
-b
-2
+shift: can't shift that many
* x 3  2i\\ b -- 3i\\ c -- FAILED
--- expected
+++ got
@@ -4,6 +4,8 @@
 2
 c
 3
+test: ==: unexpected operator
+Status: 0
 
 Hunk #1 merged at 2.
 1
@@ -11,3 +13,5 @@
 2
 c
 3
+test: ==: unexpected operator
+Status: 0
* x 3  2c\\ 2b -- 2c\\ 2c -- FAILED
--- expected
+++ got
@@ -6,6 +6,7 @@
 2b
 >>>
 3
+test: ==: unexpected operator
 Status: 1
 
 Hunk #1 NOT MERGED at 2-8.
@@ -18,4 +19,5 @@
 2b
 >>>
 3
+test: ==: unexpected operator
 Status: 1
* x 3  2d -- 2d -- FAILED
--- expected
+++ got
@@ -1,7 +1,11 @@
 Hunk #1 already applied at 2.
 1
 3
+test: ==: unexpected operator
+Status: 0
 
 Hunk #1 already applied at 2.
 1
 3
+test: ==: unexpected operator
+Status: 0
* x 2  2i\\ bc -- 2i\\ bc -- FAILED
--- expected
+++ got
@@ -2,8 +2,12 @@
 1
 bc
 2
+test: ==: unexpected operator
+Status: 0
 
 Hunk #1 already applied at 2.
 1
 bc
 2
+test: ==: unexpected operator
+Status: 0
* x 4  2a\\ a 2a\\ a -- 2a\\ a 2a\\ a -- FAILED
--- expected
+++ got
@@ -5,6 +5,8 @@
 a
 3
 4
+test: ==: unexpected operator
+Status: 0
 
 Hunk #1 already applied at 3-4.
 1
@@ -13,3 +15,5 @@
 a
 3
 4
+test: ==: unexpected operator
+Status: 0
* x 2  1i\\ a 1i\\ b -- 1i\\ a 1i\\ b -- FAILED
--- expected
+++ got
@@ -3,9 +3,13 @@
 b
 1
 2
+test: ==: unexpected operator
+Status: 0
 
 Hunk #1 already applied at 1-2.
 a
 b
 1
 2
+test: ==: unexpected operator
+Status: 0
* x 2  2a\\ a 2a\\ b -- 2a\\ a 2a\\ b -- FAILED
--- expected
+++ got
@@ -3,9 +3,13 @@
 2
 a
 b
+test: ==: unexpected operator
+Status: 0
 
 Hunk #1 already applied at 3-4.
 1
 2
 a
 b
+test: ==: unexpected operator
+Status: 0
* x 4  2d -- 3d -- FAILED
--- expected
+++ got
@@ -6,6 +6,7 @@
 3
 >>>
 4
+test: ==: unexpected operator
 Status: 1
 
 Hunk #1 NOT MERGED at 2-9.
@@ -19,4 +20,5 @@
 3
 >>>
 4
+test: ==: unexpected operator
 Status: 1
* x 4  3d -- 2d -- FAILED
--- expected
+++ got
@@ -6,6 +6,7 @@
 2
 >>>
 4
+test: ==: unexpected operator
 Status: 1
 
 Hunk #1 NOT MERGED at 2-9.
@@ -19,4 +20,5 @@
 2
 >>>
 4
+test: ==: unexpected operator
 Status: 1
* x 3  3i\\ b -- 2d -- FAILED
--- expected
+++ got
@@ -6,6 +6,7 @@
 b
 >>>
 3
+test: ==: unexpected operator
 Status: 1
 
 Hunk #1 NOT MERGED at 2-8.
@@ -18,4 +19,5 @@
 b
 >>>
 3
+test: ==: unexpected operator
 Status: 1
* x 3  2d -- 3i\\ b -- FAILED
--- expected
+++ got
@@ -6,6 +6,7 @@
 ===
 >>>
 3
+test: ==: unexpected operator
 Status: 1
 
 Hunk #1 NOT MERGED at 2-8.
@@ -18,4 +19,5 @@
 ===
 >>>
 3
+test: ==: unexpected operator
 Status: 1
* x 1  1c\\ b -- 1c\\ c -- FAILED
--- expected
+++ got
@@ -4,6 +4,7 

Re: bizarre failures on NetBSD 9.3 x86_64

2023-05-09 Thread Bug reports, suggestions, general discussion for GNU patch.
On 5/9/23 23:36, Dennis Clarke via Bug reports, suggestions, general 
discussion for GNU patch. wrote:

On 5/9/23 11:00, Bruno Haible wrote:
 > Dennis Clarke wrote:
 >> Seems to be a problem where a trivial Bourne shell for the user is not
 >> good enough?
 >
 > What if you install GNU bash:
 >



After all that disaster I had a thought : what about that silly and
poorly documented env var CONFIG_SHELL ?

bash-5.1$ echo $CONFIG_SHELL
/usr/pkg/bin/bash
bash-5.1$

Guess what ?


Testsuite summary for GNU patch 2.7.6

# TOTAL: 44
# PASS:  42
# SKIP:  0
# XFAIL: 2
# FAIL:  0
# XPASS: 0
# ERROR: 0


Gotta love the need for GNU bash for this to work. Makes no sense at all
for "patch".




--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
Four decades in production systems.




Re: bizarre failures on NetBSD 9.3 x86_64

2023-05-09 Thread Bug reports, suggestions, general discussion for GNU patch.

On 5/9/23 11:00, Bruno Haible wrote:
> Dennis Clarke wrote:
>> Seems to be a problem where a trivial Bourne shell for the user is not
>> good enough?
>
> What if you install GNU bash:
>
># PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname 
-m`/9.3/All

># export PKG_PATH
># pkg_add bash
>
> and then repeat the build attempt?
>

Bruno, thank you for the reply.

I was thinking that perhaps I fell onto a GNUism or bashism somewhere
and so yes, that is the very first thing I did :)

Same result.

Then I went looking around ...

I ssh into the server normally :

m$ echo $SHELL
/bin/sh

Then get bashed in the head

m$ which bash
/usr/pkg/bin/bash
m$ /usr/pkg/bin/bash --version
GNU bash, version 5.1.16(1)-release (x86_64--netbsd)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 



This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
m$
m$ /usr/pkg/bin/bash
bash-5.1$

OKay, let's extract a fresh tarball of patch-2.7.6

bash-5.1$
bash-5.1$ pwd
/opt/bw/build
bash-5.1$ ls /mnt/pluto/dclarke/src/patch*
/mnt/pluto/dclarke/src/patch-2.7.6.tar.gz
bash-5.1$
bash-5.1$ openssl dgst -sha256 -r /mnt/pluto/dclarke/src/patch-2.7.6.tar.gz
8cf86e00ad3aaa6d26aca30640e86b0e3e1f395ed99f189b06d4c9f74bc58a4e 
*/mnt/pluto/dclarke/src/patch-2.7.6.tar.gz

bash-5.1$
bash-5.1$ gzip -dc /mnt/pluto/dclarke/src/patch-2.7.6.tar.gz | tar -xf -
bash-5.1$ mv patch-2.7.6 patch-2.7.6_NetBSD_9.3_AMD64.004
bash-5.1$ cd patch-2.7.6_NetBSD_9.3_AMD64.004
bash-5.1$

Take a look at this :

bash-5.1$ ls tests/test-lib.sh
tests/test-lib.sh
bash-5.1$
bash-5.1$ nl -b a -n rz tests/test-lib.sh | head -20
01  # Library for simple test scripts
02  # Copyright (C) 2009, 2011-2012 Free Software Foundation, Inc.
03  #
04  # Copying and distribution of this file, with or without 
modification,
05  # in any medium, are permitted without royalty provided the 
copyright

06  # notice and this notice are preserved.
07
08  # FIXME: Requires a version of diff that understands "-u".
09
10  require_gnu_diff() {
11  case "`diff --version 2> /dev/null`" in
12  *GNU*)
13  ;;
14  *)
15  echo "This test requires GNU diff" >&2
16  exit 77
17  esac
18  }
19
20  require() {
bash-5.1$

There on line 8 it seems to say we need the GNU diff?

So that means diffutils or whatever it is called. Maybe ?

Regardless the diff that we get in NetBSD 9.3 seems just fine :

bash-5.1$
bash-5.1$ which diff
/usr/bin/diff
bash-5.1$
bash-5.1$ /usr/bin/printf "Here is line 1\nhere is line 2\nhere is 
another line\n" > /var/tmp/dclarke/foo
bash-5.1$ /usr/bin/printf "Here is line 1\nhere is line 2\nhere is a 
last line\n" > /var/tmp/dclarke/bar

bash-5.1$ diff -u /var/tmp/dclarke/foo /var/tmp/dclarke/bar
--- /var/tmp/dclarke/foo2023-05-10 02:36:33.650699736 +
+++ /var/tmp/dclarke/bar2023-05-10 02:36:49.654477281 +
@@ -1,3 +1,3 @@
 Here is line 1
 here is line 2
-here is another line
+here is a last line

Seems that "-u" works just fine to me.


Fine .. so setup a few env vars for a compile or at least a configure ?

bash-5.1$ env | sort | grep -v 'SSH'

CC=/opt/bw/gcc12/bin/gcc
CFLAGS=-Wl,-rpath=/opt/bw/lib,--enable-new-dtags -m64 -g -O0 
-fno-fast-math -fno-builtin -malign-double -march=k8 -mtune
=k8 -mieee-fp -mhard-float -mno-fancy-math-387 -m128bit-long-double 
-mlong-double-80 -mstackrealign -mpreferred-stack-bo

undary=8
COLUMNS=120
CPPFLAGS=-D_LARGEFILE64_SOURCE
CXX=/opt/bw/gcc12/bin/g++
CXXFLAGS=-g -m64 -O0 -L/opt/bw/lib -Wl,-rpath=/opt/bw/lib,--enable-new-dtags
DISPLAY=localhost:10.0
EDITOR=/usr/bin/vi
ENV=/home/dclarke/.shrc
HOME=/home/dclarke
LC_COLLATE=C
LC_CTYPE=C
LC_MESSAGES=C
LC_MONETARY=C
LC_NUMERIC=C
LC_TIME=C
LD_RUN_PATH=/opt/bw/lib
LINES=43
LOGNAME=dclarke
MAIL=/var/mail/dclarke
MAKE=/usr/pkg/bin/gmake
NICE=/usr/bin/nice
OLDPWD=/opt/bw/build
PAGER=/usr/bin/more
PATH=/opt/bw/bin:/opt/bw/gcc12/bin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/pkg/
bin:/usr/pkg/sbin
PWD=/opt/bw/build/patch-2.7.6_NetBSD_9.3_AMD64.004
SHELL=/bin/sh
SHLVL=0
TERM=xterm
TIME=/usr/bin/time
TMPDIR=/var/tmp/dclarke
TMUX=/var/tmp/dclarke/tmux/default,29620,0
TMUX_PANE=%0
TZ=GMT0
USER=dclarke
VISUAL=/usr/bin/vi
XTERM_LOCALE=C
_=/usr/bin/env

I am looking at this inside a tmux session but I hardly doubt that means
anything.

Those CFLAGS are in place for the most minimal and "debuggable" result.
Is that even a word? Seem reasonable at the moment.

OKay so here in the configure stage of life I will watch closely for
"Thou Art in Sin and shall be cast into HELLFIRE" warnings. However I
just do not see why *everything* falls over and fails in flames and
smoke and ash.

Let's see :

bash-5.1$ 
 [547/1866]

bash-5.1$ pwd

Re: bizarre failures on NetBSD 9.3 x86_64

2023-05-09 Thread Bruno Haible
Dennis Clarke wrote:
> Seems to be a problem where a trivial Bourne shell for the user is not 
> good enough?

What if you install GNU bash:

  # PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/9.3/All
  # export PKG_PATH
  # pkg_add bash

and then repeat the build attempt?

Bruno