Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,55 @@ jobs:
../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-solaris
../maint/RunSymbolTest install-dir/lib/ ../maint/

zos:
name: z/OS
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
concurrency:
group: zos-ssh-build
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true

- name: Prepare
run: ./autogen.sh

- name: Build & test
env:
ZOS_HOST: ${{ secrets.ZOS_HOST }}
ZOS_PORT: ${{ secrets.ZOS_PORT }}
ZOS_PRIVATE_KEY: ${{ secrets.ZOS_PRIVATE_KEY }}
ZOS_KNOWN_HOSTS: ${{ secrets.ZOS_KNOWN_HOSTS }}
run: |
(umask 0077 && printenv ZOS_PRIVATE_KEY > id_rsa_zos)
mkdir -p ~/.ssh
printenv ZOS_KNOWN_HOSTS > ~/.ssh/known_hosts

tar czf ../pcre2-build.tar.gz --exclude=.git .
mv ../pcre2-build.tar.gz .

scp -i id_rsa_zos -P "$ZOS_PORT" pcre2-build.tar.gz "$ZOS_HOST:/data/"
ssh -i id_rsa_zos -p "$ZOS_PORT" "$ZOS_HOST" /data/zopen/usr/local/bin/bash -c \
'export _BPXK_AUTOCVT=ON;
export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)";
export _TAG_REDIR_ERR=txt;
export _TAG_REDIR_IN=txt;
export _TAG_REDIR_OUT=txt;
. /data/zopen/etc/zopen-config;
set -e;
set -x;
cd /data;
rm -rf pcre2-build;
mkdir pcre2-build;
gtar xzf pcre2-build.tar.gz -C pcre2-build;
cd pcre2-build;
chtag -R -tc ISO8859-1 .;
MAKE=gmake CC=xlc ./configure --enable-ebcdic --disable-unicode;
gmake;
gmake check'

distcheck:
name: Build & verify distribution
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ lib_LTLIBRARIES =
# TESTS is for binary unit tests, check_SCRIPTS for script-based tests

TESTS =
XFAIL_TESTS =
check_SCRIPTS =
dist_noinst_SCRIPTS =

Expand Down Expand Up @@ -725,6 +726,9 @@ if WITH_PCRE2_8
TESTS += RunGrepTest
EXTRA_DIST += RunGrepTest.bat
dist_noinst_SCRIPTS += RunGrepTest
if WITH_EBCDIC
XFAIL_TESTS += RunGrepTest
endif # WITH_EBCDIC
endif # WITH_PCRE2_8

## Distribute all the test data files
Expand Down
4 changes: 3 additions & 1 deletion RunTest
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ fi

# Set up a suitable "diff" command for comparison. Some systems
# have a diff that lacks a -u option. Try to deal with this.
# Use gdiff if available.

cf="diff"
diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
gdiff /dev/null /dev/null 2>/dev/null && cf="gdiff"
$cf -u /dev/null /dev/null 2>/dev/null && cf="$cf -u"

# Find the test data

Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# Check for a 64-bit integer type
AC_TYPE_INT64_T

# Check for xlc which has some special (broken/non-standard) behaviour on z/OS.
PCRE2_ZOS_FIXES

AC_PROG_INSTALL
LT_INIT([win32-dll])
AC_PROG_LN_S
Expand Down
50 changes: 50 additions & 0 deletions m4/pcre2_zos.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
dnl Tests whether the compiler requires an additional flag in order to fail on
dnl undefined headers.

dnl The concept of setting this commandline flag was learned from patches and
dnl mailing list discussions of the gnulib and gawk projects (credit to
dnl Bruno Haible).

AC_DEFUN([PCRE2_ZOS_FIXES],
[
AC_CACHE_CHECK([for OS/390 (z/OS)], [pcre2_cv_os390],
[if test "`uname`" = "OS/390"; then
pcre2_cv_os390=yes
else
pcre2_cv_os390=no
fi])
if test "$pcre2_cv_os390" = "yes"; then
AC_CACHE_CHECK([whether the compiler supports -qhaltonmsg=CCN3296], [pcre2_cv_xlc_qhaltonmsg_support],
[save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -qhaltonmsg=CCN3296"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[pcre2_cv_xlc_qhaltonmsg_support=yes],
[pcre2_cv_xlc_qhaltonmsg_support=no])
CFLAGS="$save_CFLAGS"
])

AC_CACHE_CHECK([whether non-existent headers fail the compile], [pcre2_cv_xlc_nonexistent_fatal],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <thereshouldbenoheader.h>]])],
[pcre2_cv_xlc_nonexistent_fatal=no],
[pcre2_cv_xlc_nonexistent_fatal=yes])
])

if test "$pcre2_cv_xlc_nonexistent_fatal" = "no" && test "$pcre2_cv_xlc_qhaltonmsg_support" = "yes"; then
AC_CACHE_CHECK([whether -qhaltonmsg=CCN3296 fixes the non-existent-header issue], [pcre2_cv_xlc_qhaltonmsg_fixes],
[save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -qhaltonmsg=CCN3296"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <thereshouldbenoheader.h>]])],
[pcre2_cv_xlc_qhaltonmsg_fixes=no],
[pcre2_cv_xlc_qhaltonmsg_fixes=yes])
CFLAGS="$save_CFLAGS"
])

if test "$pcre2_cv_xlc_qhaltonmsg_fixes" = "no"; then
AC_MSG_ERROR([-qhaltonmsg=CCN3296 not effective on non-existent headers])
fi

CFLAGS="$CFLAGS -qhaltonmsg=CCN3296"
fi

fi
])
1 change: 1 addition & 0 deletions maint/manifest-tarball
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ drwxr-xr-x tarball-dir/pcre2-SNAPSHOT/m4
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/m4/ltversion.m4
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/m4/lt~obsolete.m4
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/m4/pcre2_visibility.m4
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/m4/pcre2_zos.m4
-rwxr-xr-x tarball-dir/pcre2-SNAPSHOT/missing
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/pcre2-config.in
-rwxr-xr-x tarball-dir/pcre2-SNAPSHOT/perltest.sh
Expand Down
7 changes: 5 additions & 2 deletions src/pcre2_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ POSSIBILITY OF SUCH DAMAGE.
#else
#define PRINTABLE(c) ((c) >= 32 && (c) < 127)
#endif
#define CHAR_OUTPUT(c) (c)
#define CHAR_INPUT(c) (c)
#define CHAR_OUTPUT(c) (c)
#define CHAR_OUTPUT_HEX(c) (c)
#define CHAR_INPUT(c) (c)
#define CHAR_INPUT_HEX(c) (c)
#include "pcre2_printint.c"
#undef PRINTABLE
#undef CHAR_OUTPUT
#undef CHAR_OUTPUT_HEX
#undef CHAR_INPUT
#define DEBUG_CALL_PRINTINT
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/pcre2_compile_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ while (TRUE)
uint8_t posix_vertical[4] = { CHAR_LF, CHAR_VT, CHAR_FF, CHAR_CR };
uint8_t posix_underscore = CHAR_UNDERSCORE;
uint8_t *chars = NULL;
uint n = 0;
int n = 0;

if (tabopt == 1) { chars = posix_vertical; n = 4; }
else if (tabopt == 2) { chars = &posix_underscore; n = 1; }
Expand Down
18 changes: 9 additions & 9 deletions src/pcre2_printint.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ if (utf)
if (one_code_unit)
{
if (PRINTABLE(c))
fprintf(f, "%c", (char)CHAR_OUTPUT(c));
fprintf(f, "%c", CHAR_OUTPUT(c));
else
{
c = CHAR_OUTPUT(c);
c = CHAR_OUTPUT_HEX(c);
if (c < 0x80) fprintf(f, "\\x%02x", c);
else fprintf(f, "\\x{%02x}", c);
}
Expand Down Expand Up @@ -219,7 +219,7 @@ while (*ptr != '\0')
{
uint32_t c = *ptr++;
if (PRINTABLE(c)) fprintf(f, "%c", CHAR_OUTPUT(c));
else fprintf(f, "\\x{%x}", CHAR_OUTPUT(c));
else fprintf(f, "\\x{%x}", CHAR_OUTPUT_HEX(c));
}
}

Expand All @@ -230,7 +230,7 @@ for (; len > 0; len--)
{
uint32_t c = *ptr++;
if (PRINTABLE(c)) fprintf(f, "%c", CHAR_OUTPUT(c));
else fprintf(f, "\\x{%x}", CHAR_OUTPUT(c));
else fprintf(f, "\\x{%x}", CHAR_OUTPUT_HEX(c));
}
}

Expand Down Expand Up @@ -481,22 +481,22 @@ if (negated)

for (input = 0; input < 256; input++)
{
i = CHAR_INPUT(input);
i = CHAR_INPUT_HEX(input);
if ((map[i/8] & (1u << (i&7))) != 0)
{
int j, jinput;
for (jinput = input; jinput+1 < 256; jinput++)
{
j = CHAR_INPUT(jinput+1);
j = CHAR_INPUT_HEX(jinput+1);
if ((map[j/8] & (1u << (j&7))) == 0) break;
}
j = CHAR_INPUT(jinput);
j = CHAR_INPUT_HEX(jinput);
if (i == CHAR_MINUS || i == CHAR_BACKSLASH ||
i == CHAR_RIGHT_SQUARE_BRACKET ||
(first && i == CHAR_CIRCUMFLEX_ACCENT))
fprintf(f, "\\");
if (PRINTABLE(i)) fprintf(f, "%c", CHAR_OUTPUT(i));
else fprintf(f, "\\x%02x", CHAR_OUTPUT(i));
else fprintf(f, "\\x%02x", CHAR_OUTPUT_HEX(i));
first = FALSE;
if (jinput > input)
{
Expand All @@ -505,7 +505,7 @@ for (input = 0; input < 256; input++)
j == CHAR_RIGHT_SQUARE_BRACKET)
fprintf(f, "\\");
if (PRINTABLE(j)) fprintf(f, "%c", CHAR_OUTPUT(j));
else fprintf(f, "\\x%02x", CHAR_OUTPUT(j));
else fprintf(f, "\\x%02x", CHAR_OUTPUT_HEX(j));
}
input = jinput;
}
Expand Down
Loading
Loading