5 Commits
v1.6 ... v1.7

Author SHA1 Message Date
Iustin Pop
e8e6d543de Release version 1.7 2023-04-20 23:23:56 +02:00
Iustin Pop
34978b4019 Fix a 25-year old bug \o/
This is a trivial bug, but a bug nevertheless. It's present in the
first commit in this (synthetic) Git repository, and from my
investigations into very old versions - mt-st-0.5 from an old RedHat
version - it was already present in the `stinit.c` version from Apr
11, 1998, which makes it 25 years and 9 days old. This is a new record
for me, which I don't think I'll beat :)

The bug is trivial, in retrospect, and was found just by accident
because with the 1.6 release uploaded in Debian, the new test suite is
run on multiple architectures. While amd64/x86 doesn't trigger this
bug in neither '-O2' nor '-g' build, mips64el, arm64, and s390x do
show the bug in the optimised builds (and only in them) as follows:

amd64:

```
$ /sbin/stinit -v -v -v -p -f ./tests/data/bad-definition.data

Parsing modes for ('XYZ', 'UVW1', '').
Mode 1 definition:  blocksize=
Warning: errors in definition for ('XYZ', 'UVW1', ''):
 blocksize=

Definition parse completed. Errors found!
```

s390x:

```
$ ./stinit -p -v -v -v -f tests/data/bad-definition.data

Parsing modes for ('XYZ', 'UVW1', '').
Mode 1 definition:  blocksize=
Warning: errors in definition for ('XYZ', 'UVW1', ''):
 �H

Definition parse completed. Errors found!
```

And shelltest fails to parse that binary output, in 4/5 cases, which
by luck caused the builds to fail. From there it was a fun
investigation into trying to find why it behaves like that.

This bug is caught by the recently introduced MSAN build in the GitHub
CI, so will rely less on luck in the future.

I'm not 100% sure on the semantics of the fix, but it should only
affect this case (missing value to argument), so should be a well
localised fix.

Signed-off-by: Iustin Pop <iustin@k1024.org>
2023-04-20 23:18:23 +02:00
Iustin Pop
8056c1542a Fix CFLAGS for sanitizer
Oops, didn't fail as expected :)
2023-04-20 23:04:14 +02:00
Iustin Pop
c36a4a0fa5 Don't run undefined (UBSAN) on top of MSAN 2023-04-20 23:03:46 +02:00
Iustin Pop
f9c0570e34 Run tests under various sanitizers
This is in preparation for the next commit which will fix a very long
standing bug…
2023-04-20 23:01:20 +02:00
4 changed files with 49 additions and 4 deletions

View File

@@ -65,3 +65,34 @@ jobs:
#fail_ci_if_error: true
verbose: true
gcov: true
sanitizers:
name: Test with clang sanitizers
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
compiler: ['clang']
# These are the various sanitizers from https://github.com/google/sanitizers:
cflags:
- '-fsanitize=address -O1 -fno-omit-frame-pointer -g'
- '-fsanitize=memory -fsanitize-memory-track-origins -fPIE -pie -fno-omit-frame-pointer -g -O2'
- '-fsanitize=undefined'
fail-fast: false
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build the code
run: make
- name: Install dependencies
run: sudo apt-get install -yy shelltestrunner
- name: Run tests
run: make check

View File

@@ -1,5 +1,15 @@
# Changelog
## Changes in version 1.7 (Thu, 20 Apr 2023)
Fixes a single bug in stinit parsing of invalid definitions. This is a
trivial bug, and only affects config files manually installed by root,
so the impact should be minimal.
The bug also does not appear on amd64/x86, but (in Debian) was only
triggered (as undefined behaviour) on mips64el, arm64 and s390x,
likely due to different platform behaviour.
## Changes in version 1.6 (Wed, 19 Apr 2023)
This is bugfix release agains 1.5. In between 1.4 and 1.5, the "make

View File

@@ -31,7 +31,7 @@ DISTFILES = \
TESTFILES = $(wildcard tests/*.test)
TESTDATAFILES = $(wildcard tests/data/*.data)
VERSION=1.6
VERSION=1.7
RELEASEDIR=mt-st-$(VERSION)
TARFILE=mt-st-$(VERSION).tar.gz

View File

@@ -139,9 +139,13 @@ static char *find_string(char *s, char *target, char *buf, int buflen)
cp++;
for (cp2 = cp; *cp2 != '"' && *cp2 != '\0'; cp2++)
;
} else
for (cp2 = cp + 1; isalnum(*cp2) || *cp2 == '-'; cp2++)
;
} else {
if (*cp == '\0')
return NULL;
else
for (cp2 = cp + 1; isalnum(*cp2) || *cp2 == '-'; cp2++)
;
}
if (*cp2 == '\0')
return NULL;
have_arg = TRUE;