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-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

bizarre failures on NetBSD 9.3 x86_64

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



I was very surprised to see GNU patch 2.7.6 fail almost every test.

m$
m$ uname -a
NetBSD mimas.genunix.com 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 
15:30:37 UTC 2022 
mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

m$
m$ uptime
 2:16PM  up 72 days,  1:35, 2 users, load averages: 0.00, 0.02, 0.00
m$
m$ which gcc
/opt/bw/gcc12/bin/gcc
m$
m$ gcc --version
gcc (GENUNIX Fri Aug 26 16:41:30 UTC 2022) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

m$
m$ echo $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-boundary=8

m$


m$ pwd
/opt/bw/build/patch-2.7.6_NetBSD_9.3_AMD64.002
m$ ./configure --prefix=/opt/bw --program-prefix=g \
> --disable-silent-rules --enable-dependency-tracking
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... /opt/bw/gcc12/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /opt/bw/gcc12/bin/gcc accepts -g... yes
checking for /opt/bw/gcc12/bin/gcc option to accept ISO C89... none needed
checking whether /opt/bw/gcc12/bin/gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of /opt/bw/gcc12/bin/gcc... gcc3
checking for /opt/bw/gcc12/bin/gcc option to accept ISO C99... none needed
checking for /opt/bw/gcc12/bin/gcc option to accept ISO Standard C... 
(cached) none needed

checking how to run the C preprocessor... /opt/bw/gcc12/bin/gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for Minix Amsterdam compiler... no
checking for ar... ar
checking the archiver (ar) interface... ar
checking for ar... (cached) ar
checking for ranlib... ranlib
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for ANSI C header files... (cached) yes
checking for size_t... yes
checking for working alloca.h... no
checking for alloca... yes
checking build system type... x86_64-unknown-netbsd9.3
checking host system type... x86_64-unknown-netbsd9.3
checking for d_ino member in directory struct... yes
checking for long file names... yes
checking for pathconf... yes
checking for canonicalize_file_name... no
checking for getcwd... yes
checking for readlink... yes
checking for realpath... yes
checking for chown... yes
checking for fchown... yes
checking for _set_invalid_parameter_handler... no
checking for fchdir... yes
checking for fdopendir... yes
checking for faccessat... yes
checking for fchmodat... yes
checking for lchmod... yes
checking for fcntl... yes
checking for symlink... yes
checking for mempcpy... no
checking for fstatat... yes
checking for getdtablesize... yes
checking for getprogname... yes
checking for getexecname... no
checking for gettimeofday... yes
checking for nanotime... no
checking for lstat... yes
checking for mbsinit... yes
checking for mbrtowc... yes
checking for mprotect... yes
checking for mkdirat... yes
checking for tzset... yes
checking for openat... yes
checking for readlinkat... yes
checking for link... yes
checking for renameat... yes
checking for setenv... yes
checking for strdup... yes
checking for strndup... yes
checking for symlinkat... yes
checking for localtime_r... yes
checking for timegm... yes
checking for pipe... yes
checking for unlinkat... yes
checking for utime... yes
checking for futimes... yes
checking for futimesat... no
checking for futimens... yes
checking for utimensat... yes
checking for