[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [platform-testers] groff 1.23.0.rc3 on FreeBSD
From: |
G. Branden Robinson |
Subject: |
Re: [platform-testers] groff 1.23.0.rc3 on FreeBSD |
Date: |
Mon, 6 Mar 2023 09:56:34 -0600 |
Hi Bruno,
At 2023-03-06T01:56:56+0100, Bruno Haible wrote:
> On FreeBSD 13.1, the build succeeds, but there is 1 test failure:
>
> FAIL: contrib/gdiffmk/tests/runtests.sh
>
> Find attached the log. Apparently non-numeric arguments get passed to the
> 'expr' program.
Yes. Here's the relevant output.
FAIL: contrib/gdiffmk/tests/runtests.sh
=======================================
./contrib/gdiffmk/tests/result.1 PASSED
./contrib/gdiffmk/tests/result.2 PASSED
./contrib/gdiffmk/tests/result.3 PASSED
./contrib/gdiffmk/tests/result.4 PASSED
./contrib/gdiffmk/tests/result.5 PASSED
./contrib/gdiffmk/tests/result.6 TEST FAILED
0a1,9
> expr: illegal option -- a
> expr: usage: expr [-e] expression
>
> expr: illegal option -- c
> expr: usage: expr [-e] expression
>
> expr: illegal option -- d
> expr: usage: expr [-e] expression
>
5c14
< .mc C
---
> .mc
10c19
< .mc A
---
> .mc
14c23
< .mc D
---
> .mc
./contrib/gdiffmk/tests/result.6a PASSED
./contrib/gdiffmk/tests/result.7 TEST FAILED
0a1,9
> expr: illegal option -- a
> expr: usage: expr [-e] expression
>
> expr: illegal option -- d
> expr: usage: expr [-e] expression
>
> expr: illegal option -- c
> expr: usage: expr [-e] expression
>
./contrib/gdiffmk/tests/result.8 PASSED
./contrib/gdiffmk/tests/result.9 PASSED
./contrib/gdiffmk/tests/result.9a TEST FAILED
0a1,3
> expr: illegal option -- M
> expr: usage: expr [-e] expression
>
5c8
< <<<<
---
>
18c21
< <<<<
---
>
./contrib/gdiffmk/tests/result.10 PASSED
failure_count 3
FAIL contrib/gdiffmk/tests/runtests.sh (exit status: 1)
I note that the test script itself uses `expr` in a simple and well
controlled way. And also that its diagnostics appear to be embedded in
gdiffmk's own output.
The identities of those options, -a, -c, -d, and -M, make my nose itch.
gdiffmk [-a addmark] [-c changemark] [-d deletemark] [-D [-B]
[-M mark1 mark2]] [-x diffcmd] [--] file1 file2 [output]
So, looking at contrib/gdiffmk/gdiffmk.sh...
Its approach to option argument processing looks like this.
RequiresArgument () {
# Process flags that take either concatenated or
# separated values.
case "$1" in
-??*)
expr "$1" : '-.\(.*\)'
return 1
;;
esac
if test $# -lt 2
then
Exit 255 "Option '$1' requires a value."
fi
echo "$2"
return 0
}
FreeBSD expr is rejecting arguments that are structured like options,
but which it doesn't recognize, instead of interpreting them as
literals. Presumably this is why they keep flogging their '-e' flag in
their diagnostics. I'll look at POSIX for guidance.
(Also, exiting with a status > 125 from a shell script is a bad idea;
POSIX also talks about this. But it's a separate issue.)
Regards,
Branden
signature.asc
Description: PGP signature