Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package pspg for openSUSE:Factory checked in at 2026-11-30 14:27:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pspg (Old) and /work/SRC/openSUSE:Factory/.pspg.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pspg" Mon Nov 30 14:27:47 2026 rev:8 rq:1401534 version:5.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/pspg/pspg.changes 2026-11-23 15:08:34.488942533 +0100 +++ /work/SRC/openSUSE:Factory/.pspg.new.1340718/pspg.changes 2026-11-30 14:30:58.079480799 +0100 @@ -1,0 +2,6 @@ +Sun Nov 29 05:18:59 UTC 2026 - Marcus Rueckert <[email protected]> + +- Update to 5.9.2: + - fix possible crashes when input has bad format + +------------------------------------------------------------------- Old: ---- pspg-5.9.1.tar.gz New: ---- pspg-5.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pspg.spec ++++++ --- /var/tmp/diff_new_pack.OeMCTX/_old 2026-11-30 14:30:59.243529698 +0100 +++ /var/tmp/diff_new_pack.OeMCTX/_new 2026-11-30 14:30:59.244529740 +0100 @@ -17,7 +17,7 @@ Name: pspg -Version: 5.9.1 +Version: 5.9.2 Release: 0 Summary: Pager for PostgreSQL, MariaDB, Percona, and MySQL License: BSD-2-Clause ++++++ pspg-5.9.1.tar.gz -> pspg-5.9.2.tar.gz ++++++ ++++ 6201 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/README.md new/pspg-5.9.2/README.md --- old/pspg-5.9.1/README.md 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/README.md 2026-11-29 05:59:29.000000000 +0100 @@ -109,7 +109,7 @@ Output format options: -a, --ascii force ascii -b, --blackwhite black-white style - -s, --style=N set color style number (0..22) + -s, --style=N set color style number (0..24) --bold-labels row, column labels use bold font --bold-cursor cursor use bold font --border type of borders (0..2) @@ -856,6 +856,11 @@ export PKG_CONFIG_PATH="/opt/csw/lib/64/pkgconfig" ./configure +### ASAN build + + export CFLAGS="-g -O1 -fsanitize=address,undefined -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address,undefined" + ./configure --enable-debug + ## Possible ToDo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/meson.build new/pspg-5.9.2/meson.build --- old/pspg-5.9.1/meson.build 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/meson.build 2026-11-29 05:59:29.000000000 +0100 @@ -1,4 +1,4 @@ -project('pspg', ['c'], version: '5.9.1') +project('pspg', ['c'], version: '5.9.2') build_args = [ '-DPROJECT_NAME=' + meson.project_name(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/pspg.spec new/pspg-5.9.2/pspg.spec --- old/pspg-5.9.1/pspg.spec 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/pspg.spec 2026-11-29 05:59:29.000000000 +0100 @@ -3,7 +3,7 @@ Summary: pspg: a unix pager optimized for psql Name: pspg -Version: 5.9.1 +Version: 5.9.2 Release: 0%{?dist} License: BSD Group: Development/Tools diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/args.c new/pspg-5.9.2/src/args.c --- old/pspg-5.9.1/src/args.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/args.c 2026-11-29 05:59:29.000000000 +0100 @@ -12,6 +12,7 @@ */ #include <ctype.h> +#include <errno.h> #include <getopt.h> #include <limits.h> #include <stddef.h> @@ -132,7 +133,7 @@ static void consume_whitespace(const char **input) { - while (isspace(**input)) + while (isspace((unsigned char) **input)) { (*input)++; } @@ -182,7 +183,7 @@ arg = copybuf; while (*input != '\0') { - if (isspace(*input) && !squote && !dquote && !bsquote) + if (isspace((unsigned char) *input) && !squote && !dquote && !bsquote) { break; } @@ -383,6 +384,64 @@ } +static long +to_long_with_check(char *ptr, bool *is_error) +{ + char *endptr; + long result; + + errno = 0; + *is_error = true; + + result = strtol(ptr, &endptr, 10); + + if (errno != 0) + { + if (errno == ERANGE) + { + format_error("strtol: ERANGE error"); + return 0; + } + + leave("strtol: %m"); + return 0; + } + + if (endptr == ptr) + { + format_error("missing digits"); + return 0; + } + + *is_error = false; + + return result; +} + +/* + * Returns int value converted from string from a specified range + */ +static int +to_int_with_range_check(char *_optarg, const char *msg, int a, int b, bool *is_error) +{ + long val; + + val = to_long_with_check(optarg, is_error); + if (*is_error) + return 0; + + if (val < a || val > b) + { + *is_error = true; + format_error(msg, a, b); + return 0; + } + + *is_error = false; + + return (int) val; +} + bool readargs(char **argv, int argc, @@ -401,7 +460,8 @@ while ((opt = getopt_long(argc, argv, "abs:c:d:f:h:p:XVFgGiIq:U:w:W", long_options, &option_index)) != -1) { - int n; + int n; + bool is_error; switch (opt) { @@ -517,12 +577,13 @@ opts->query = optarg; break; case 'w': - opts->watch_time = atoi(optarg); - if (opts->watch_time < 0 || opts->watch_time > 3600) - { - state->errstr = "query watch time can be between 0 and 3600"; + n = to_int_with_range_check(optarg, + "query watch time can be between %d and %d", 0, 3600, + &is_error); + if (is_error) return false; - } + + opts->watch_time = n; break; case 2: opts->no_mouse = true; @@ -571,7 +632,7 @@ { fprintf(stdout, "The pspg-%s is special pager designed for databases.\n\n", PSPG_VERSION); fprintf(stdout, "Authors:\n"); - fprintf(stdout, " 2017-2025 Pavel Stehule, Benesov district, Czech Republic\n\n"); + fprintf(stdout, " 2017-2026 Pavel Stehule, Benesov district, Czech Republic\n\n"); fprintf(stdout, "Licence:\n"); fprintf(stdout, " Distributed under BSD licence\n\n"); @@ -584,12 +645,12 @@ opts->csv_separator = *optarg; break; case 19: - n = atoi(optarg); - if (n < 0 || n > 2) - { - state->errstr = "csv border type can be between 0 and 2"; + n = to_int_with_range_check(optarg, + "csv border type can be between %d and %d", 0, 2, + &is_error); + if (is_error) return false; - } + opts->border_type = n; break; case 21: @@ -608,12 +669,13 @@ opts->log_pathname = sstrdup(optarg); break; case 26: - state->reserved_rows = atoi(optarg); - if (state->reserved_rows < 1 || state->reserved_rows > 100) - { - state->errstr = "reserved rows should be between 1 and 100"; + n = to_int_with_range_check(optarg, + "reserved rows should be between %d and %d", 1, 100, + &is_error); + if (is_error) return false; - } + + state->reserved_rows = n; break; case 27: state->interactive = true; @@ -668,12 +730,13 @@ opts->quit_on_f3 = true; break; case 36: - state->boot_wait = atoi(optarg); - if (state->boot_wait < 0 || state->boot_wait > 120) - { - state->errstr = "wait should be between 1 and 120 (sec)"; + n = to_int_with_range_check(optarg, + "wait should be between %d and %d (sec)", 0, 120, + &is_error); + if (is_error) return false; - } + + state->boot_wait = n; break; case 38: opts->csv_skip_columns_like = sstrdup(optarg); @@ -688,12 +751,13 @@ opts->show_scrollbar = false; break; case 42: - opts->clipboard_app = atoi(optarg); - if (opts->clipboard_app < 1 || opts->clipboard_app > 4) - { - state->errstr = "value of clipboard_app should be 1, 2, 3 or 4"; + n = to_int_with_range_check(optarg, + "value of clipboard_app should be %d, 2, 3 or %d", 1, 4, + &is_error); + if (is_error) return false; - } + + opts->clipboard_app = n; break; case 'V': print_version(); @@ -705,21 +769,21 @@ opts->theme = 0; break; case 's': - n = atoi(optarg); - if (n < 0 || n > MAX_STYLE) - { - format_error("only color schemas 0 .. %d are supported", MAX_STYLE); + n = to_int_with_range_check(optarg, + "only color schemas %d .. %d are supported", 0, MAX_STYLE, + &is_error); + if (is_error) return false; - } + opts->theme = n; break; case 'c': - n = atoi(optarg); - if (n < 0 || n > 9) - { - state->errstr = "fixed columns should be between 0 and 4"; + n = to_int_with_range_check(optarg, + "fixed columns should be between %d and %d", 0, 9, + &is_error); + if (is_error) return false; - } + opts->freezed_cols = n; break; case 'f': @@ -748,7 +812,10 @@ { long port; - port = strtol(optarg, NULL, 10); + port = to_long_with_check(optarg, &is_error); + if (is_error) + return false; + if ((port < 1) || (port > 65535)) { format_error("invalid port number: %s", optarg); @@ -803,9 +870,14 @@ opts->hide_header_line = true; break; case 52: - opts->esc_delay = atoi(optarg); - break; + n = to_int_with_range_check(optarg, + "value for esc-delay is out of range", 0, INT_MAX, + &is_error); + if (is_error) + return false; + opts->esc_delay = n; + break; case 53: opts->on_exit_clean = true; break; @@ -843,7 +915,10 @@ break; case 59: - lopt = atol(optarg); + lopt = to_long_with_check(optarg, &is_error); + if (is_error) + return false; + if (lopt < 0 || lopt > UINT_MAX) { state->errstr = "value for csv-trim-width is out of range (0 .. INT_MAX)"; @@ -854,7 +929,10 @@ break; case 60: - lopt = atol(optarg); + lopt = to_long_with_check(optarg, &is_error); + if (is_error) + return false; + if (lopt < 0 || lopt > UINT_MAX) { state->errstr = "value for csv-trim-rows is out of range (0 .. INT_MAX)"; @@ -912,7 +990,7 @@ return FILE_MATRIX; for (i = 0; i < 3; i++) - *w_ptr++ = tolower(*r_ptr++); + *w_ptr++ = tolower((unsigned char) *r_ptr++); *w_ptr = '\0'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/bscommands.c new/pspg-5.9.2/src/bscommands.c --- old/pspg-5.9.1/src/bscommands.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/bscommands.c 2026-11-29 05:59:29.000000000 +0100 @@ -54,10 +54,10 @@ if (*instr == '\0') return NULL; - if (isalpha(*instr)) + if (isalpha((unsigned char) *instr)) { *token = instr++; - while (isalpha(*instr)) + while (isalpha((unsigned char) *instr)) instr += 1; *n = instr - *token; @@ -110,18 +110,18 @@ instr += 1; } } - else if (isalpha(*instr) || *instr == '_') + else if (isalpha((unsigned char) *instr) || *instr == '_') { *ident = instr++; - while (isalnum(*instr) || *instr == '_') + while (isalnum((unsigned char) *instr) || *instr == '_') instr += 1; *n = instr - *ident; } - else if (allow_colnum && isdigit(*instr)) + else if (allow_colnum && isdigit((unsigned char) *instr)) { *ident = instr++; - while (isdigit(*instr) || *instr == '_') + while (isdigit((unsigned char) *instr) || *instr == '_') instr += 1; *n = instr - *ident; @@ -626,7 +626,7 @@ cmdline += 1; } - if (isdigit(*cmdline)) + if (isdigit((unsigned char) *cmdline)) { *long_argument = strtol(cmdline, &endptr, 10); @@ -670,7 +670,7 @@ n = 0; ptr = cmdline; - while (isalpha(*ptr)) + while (isalpha((unsigned char) *ptr)) { ptr += 1; n += 1; @@ -820,7 +820,7 @@ if (len > 0) { - if (isdigit(*ident)) + if (isdigit((unsigned char) *ident)) { /* entered column number */ *long_argument = strtol(ident, NULL, 10); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/config.c new/pspg-5.9.2/src/config.c --- old/pspg-5.9.1/src/config.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/config.c 2026-11-29 05:59:29.000000000 +0100 @@ -228,7 +228,7 @@ return false; } - if (value < min && value > max) + if (value < min || value > max) { log_row("value of key \"%s\" is out of range [%d, %d]", key, min, max); return false; @@ -324,7 +324,7 @@ else if (strcmp(key, "default_clipboard_format") == 0) is_valid = assign_int(key, (int *) &opts->clipboard_format, int_val, res, 0, CLIPBOARD_FORMAT_INSERT_WITH_COMMENTS); else if (strcmp(key, "clipboard_app") == 0) - is_valid = assign_int(key, &opts->clipboard_app, int_val, res, 0, 3); + is_valid = assign_int(key, &opts->clipboard_app, int_val, res, 0, 4); else if (strcmp(key, "xterm_mouse_mode") == 0) is_valid = assign_bool(key, &opts->xterm_mouse_mode, bool_val, res); else if (strcmp(key, "show_scrollbar") == 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/infra.c new/pspg-5.9.2/src/infra.c --- old/pspg-5.9.1/src/infra.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/infra.c 2026-11-29 05:59:29.000000000 +0100 @@ -418,7 +418,7 @@ if (use_utf8) { /* is there any valid utf8 sequence */ - if (strlen(str) <= utf8charlen(*str)) + if (strlen(str) < utf8charlen(*str)) return true; else return false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/pgclient.c new/pspg-5.9.2/src/pgclient.c --- old/pspg-5.9.1/src/pgclient.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/pgclient.c 2026-11-29 05:59:29.000000000 +0100 @@ -130,7 +130,7 @@ } /* - * Returns true, when some column should be hidden. + * Returns number of visible columns */ static int mark_hidden_columns(PGresult *result, @@ -292,18 +292,26 @@ RELEASE_AND_LEAVE(errmsg); } - if ((nfields = PQnfields(result)) > 1024) + if ((nfields = PQnfields(result)) > MAX_COLUMNS) RELEASE_AND_EXIT("too much columns"); - hidden = smalloc(1024 * sizeof(bool)); + hidden = smalloc(MAX_COLUMNS * sizeof(bool)); pdesc->nfields = mark_hidden_columns(result, nfields, opts, hidden); + /* in this case all rows must to have same number of fields */ + pdesc->nfields_all = pdesc->nfields; + pdesc->has_header = true; n = 0; for (i = 0; i < nfields; i++) + { if (!hidden[i]) + { + pdesc->columns_map[n] = n; pdesc->types[n++] = column_type_class(PQftype(result, i)); + } + } /* calculate necessary size of header data */ size = 0; @@ -320,7 +328,7 @@ if (!row) EXIT_OUT_OF_MEMORY(); - row->nfields = nfields; + row->nfields = pdesc->nfields; multiline_row = false; n = 0; @@ -384,7 +392,6 @@ pdesc->multilines[n] |= multiline_col; multiline_row |= multiline_col; - pdesc->columns_map[n] = n; n += 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/pretty-csv.c new/pspg-5.9.2/src/pretty-csv.c --- old/pspg-5.9.1/src/pretty-csv.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/pretty-csv.c 2026-11-29 05:59:29.000000000 +0100 @@ -35,14 +35,14 @@ int used; int size; int maxfields; - int starts[1024]; /* start of first char of column (in bytes) */ - int sizes[1024]; /* lenght of chars of column (in bytes) */ - long int digits[1024]; /* number of digits, used for format detection */ - long int tsizes[1024]; /* size of column in bytes, used for format detection */ - int firstdigit[1024]; /* rows where first char is digit */ - size_t widths[1024]; /* column's display width */ - bool multilines[1024]; /* true if column has multiline row */ - bool hidden[1024]; + int starts[MAX_COLUMNS]; /* start of first char of column (in bytes) */ + int sizes[MAX_COLUMNS]; /* lenght of chars of column (in bytes) */ + long int digits[MAX_COLUMNS]; /* number of digits, used for format detection */ + long int tsizes[MAX_COLUMNS]; /* size of column in bytes, used for format detection */ + int firstdigit[MAX_COLUMNS]; /* rows where first char is digit */ + size_t widths[MAX_COLUMNS]; /* column's display width */ + bool multilines[MAX_COLUMNS]; /* true if column has multiline row */ + bool hidden[MAX_COLUMNS]; } LinebufType; typedef struct @@ -394,7 +394,7 @@ { if (row->fields[i][0] == '\0') return false; - if (isdigit((row->fields[i])[0])) + if (isdigit((unsigned char) (row->fields[i])[0])) return false; } @@ -404,7 +404,7 @@ { if (row->fields[i][0] == '\0') return true; - if (isdigit((row->fields[i])[0])) + if (isdigit((unsigned char) (row->fields[i])[0])) return true; } @@ -564,7 +564,7 @@ RowType *row; bool more_lines = true; bool multiline = rb->multilines[i]; - char *fields[1024]; + char *fields[MAX_COLUMNS]; int multiline_lineno; /* skip broken rows */ @@ -906,7 +906,7 @@ while (*ptr) { - if (isdigit(*ptr)) + if (isdigit((unsigned char) *ptr)) digits += 1; else if (*ptr != '-' && *ptr != ' ' && *ptr != ':') total += 1; @@ -959,7 +959,7 @@ linebuf->tsizes[i] += total; linebuf->digits[i] += digits; - if (isdigit(*row->fields[i])) + if (isdigit((unsigned char) *row->fields[i])) linebuf->firstdigit[i]++; } @@ -1195,6 +1195,9 @@ { if (c == '\t' && !translated) { + if (nfields >= MAX_COLUMNS) + leave("too much columns"); + append_char(linebuf, '\0'); linebuf->sizes[nfields++] = size + 1; size = 0; @@ -1214,7 +1217,6 @@ } else { - if (linebuf->used > 0) { char *locbuf; @@ -1222,6 +1224,9 @@ bool multiline = false; int i; + if (nfields >= MAX_COLUMNS) + leave("too much columns"); + append_char(linebuf, '\0'); linebuf->sizes[nfields++] = size + 1; @@ -1373,7 +1378,7 @@ if (sep != -1 && c == sep && !instr) { - if (nfields >= 1024) + if (nfields >= MAX_COLUMNS) leave("too much columns"); if (skip_initial) @@ -1440,6 +1445,9 @@ ungetc(c, ifile); } + if (nfields >= MAX_COLUMNS) + leave("too much columns"); + if (!skip_initial && (last_nw - first_nw > 0 || found_string || nullstr_size == 0)) { linebuf->sizes[nfields] = last_nw - first_nw; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/print.c new/pspg-5.9.2/src/print.c --- old/pspg-5.9.1/src/print.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/print.c 2026-11-29 05:59:29.000000000 +0100 @@ -285,9 +285,22 @@ if (srcx + maxx <= col->xmin) continue; - colname = desc->namesline + col->name_offset; - colname_size = col->name_size; - colname_width = col->name_width; + /* the background of the names row is already cleared */ + if (col->name_size <= 0) + continue; + + if (col->name_size <= 0) + { + colname = ""; + colname_size = 0; + colname_width = 0; + } + else + { + colname = desc->namesline + col->name_offset; + colname_size = col->name_size; + colname_width = col->name_width; + } col_val_xmin = col->xmin; if (desc->headline_transl[col_val_xmin] == 'I' || @@ -642,7 +655,7 @@ if (use_utf8) return utf8_isupper(chr); - return isupper(*chr); + return isupper((unsigned char) *chr); } static bool @@ -651,16 +664,16 @@ if (use_utf8 && (chr & 0x80)) return false; - return isalnum(chr); + return isalnum((unsigned char) chr); } static bool is_ascii_alpha(char chr) { - if (use_utf8 && (chr & 0x80)) + if (use_utf8 && (((unsigned char) chr) & 0x80)) return false; - return isalpha(chr); + return isalpha((unsigned char) chr); } /* @@ -777,7 +790,7 @@ while (is_ascii_alnum(*line) || *line == '_') { - if (islower(*line)) + if (islower((unsigned char) *line)) only_upper = false; line += 1; @@ -791,7 +804,7 @@ words[nwords].typ = 2; goto fin; } - else if (isupper(*start) && *line == ':') + else if (isupper((unsigned char) *start) && *line == ':') { words[nwords].typ = 3; goto fin; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/pspg.c new/pspg-5.9.2/src/pspg.c --- old/pspg-5.9.1/src/pspg.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/pspg.c 2026-11-29 05:59:29.000000000 +0100 @@ -1670,7 +1670,7 @@ { while (*str != '\0') { - if (isupper(*str)) + if (isupper((unsigned char) *str)) return true; str += 1; @@ -2264,21 +2264,25 @@ int errsz; int status; - memset(buffer, 0, sizeof(err_buffer)); + memset(err_buffer, 0, sizeof(err_buffer)); fclose(fp); fp = NULL; waitpid(pid, &status, 0); - errsz = read(ferr, err_buffer, 1000); + errsz = read(ferr, err_buffer, sizeof(err_buffer) - 1); close(fin); close(fout); close(ferr); - if (errsz != -1) + if (errsz > 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { - format_error("%s", err_buffer); + if (errsz > 0) + format_error("%s", err_buffer); + else + format_error("clipboard application failed (status %d)", status); + log_row("write error (%s)", current_state->errstr); show_info_wait(" Cannot write to clipboard (%s)", @@ -2825,12 +2829,12 @@ { /* * in this moment, the log file is not initialized, - * use strerr instead. + * use stderr instead. */ logfile = stderr; if (!load_config(cf, &opts)) - fprintf(stderr, "warning: found errors while reading of config file"); + fprintf(stderr, "warning: found errors while reading of config file\n"); logfile = NULL; @@ -3795,6 +3799,13 @@ if (desc.headline_transl) finalize_tabular_data(&desc); + /* fresh data can have a different number of columns */ + if (last_ordered_column > desc.columns) + last_ordered_column = -1; + + if (vertical_cursor_column > desc.columns) + vertical_cursor_column = desc.columns; /* 0 when not a table */ + trim_footer_rows(&desc); if (desc.headline_transl != NULL && !desc.is_expanded_mode) @@ -3840,6 +3851,9 @@ first_row = adjust_first_row(first_row, &desc, &scrdesc); + if (opts.vertical_cursor && vertical_cursor_column > 0) + last_x_focus = get_x_focus(vertical_cursor_column, cursor_col, &desc, &scrdesc); + last_watch_sec = sec; last_watch_ms = ms; if (last_ordered_column != -1) @@ -6321,6 +6335,9 @@ for (colnum = startcolumn; colnum <= desc.columns; colnum++) { + if (desc.cranges[colnum - 1].name_size <= 0) + continue; + if (use_utf8) { if (utf8_nstrstr_with_sizes(desc.namesline + desc.cranges[colnum - 1].name_offset, @@ -6351,6 +6368,9 @@ for (colnum = 1; colnum < startcolumn; colnum++) { + if (desc.cranges[colnum - 1].name_size <= 0) + continue; + if (nstrstr_with_sizes(desc.namesline + desc.cranges[colnum - 1].name_offset, desc.cranges[colnum - 1].name_size, scrdesc.searchcolterm, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/pspg.h new/pspg-5.9.2/src/pspg.h --- old/pspg-5.9.1/src/pspg.h 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/pspg.h 2026-11-29 05:59:29.000000000 +0100 @@ -35,7 +35,7 @@ #define FILE_TSV 2 #define FILE_MATRIX 3 -#define PSPG_VERSION "5.9.1" +#define PSPG_VERSION "5.9.2" /* GNU Hurd does not define MAXPATHLEN */ #ifndef MAXPATHLEN @@ -51,6 +51,8 @@ #define LINEBUFFER_LINES 1000 +#define MAX_COLUMNS 1024 + typedef struct LineBuffer { int first_row; @@ -252,10 +254,10 @@ int nfields; int nfields_all; bool has_header; - char types[1024]; /* a or d .. content in column */ - int widths[1024]; /* column's display width */ - bool multilines[1024]; /* true if column has multiline row */ - int columns_map[1024]; /* column numbers - used when some column is hidden */ + char types[MAX_COLUMNS]; /* a or d .. content in column */ + int widths[MAX_COLUMNS]; /* column's display width */ + bool multilines[MAX_COLUMNS]; /* true if column has multiline row */ + int columns_map[MAX_COLUMNS]; /* column numbers - used when some column is hidden */ } PrintDataDesc; typedef struct diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/readline.c new/pspg-5.9.2/src/readline.c --- old/pspg-5.9.1/src/readline.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/readline.c 2026-11-29 05:59:29.000000000 +0100 @@ -291,14 +291,19 @@ while (list_index < current_state->desc->columns) { + CRange *cr = ¤t_state->desc->cranges[list_index++]; const char *name; int name_len; - name = current_state->desc->namesline + current_state->desc->cranges[list_index].name_offset; - name_len = current_state->desc->cranges[list_index].name_size; - list_index += 1; + /* skip columns without name */ + if (cr->name_size <= 0) + continue; + + name = current_state->desc->namesline + cr->name_offset; + name_len = cr->name_size; + if (use_utf8) { if (utf8_nstarts_with_with_sizes(name, name_len, text, len)) @@ -333,13 +338,13 @@ while (ptr > rl_line_buffer) { - if (isalnum(*(ptr - 1))) + if (isalnum((unsigned char) *(ptr - 1))) ptr -= 1; else break; } - if (isalnum(*ptr)) + if (isalnum((unsigned char) *ptr)) get_token(ptr, token, size); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/st_menu.c new/pspg-5.9.2/src/st_menu.c --- old/pspg-5.9.1/src/st_menu.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/st_menu.c 2026-11-29 05:59:29.000000000 +0100 @@ -340,7 +340,7 @@ } else { - buffer[0] = tolower(str[0]); + buffer[0] = tolower((unsigned char) str[0]); buffer[1] = '\0'; result = strdup(buffer); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/string.c new/pspg-5.9.2/src/string.c --- old/pspg-5.9.1/src/string.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/string.c 2026-11-29 05:59:29.000000000 +0100 @@ -26,7 +26,7 @@ if (*str2 == '\0') return false; - if (toupper(*str1++) != toupper(*str2++)) + if (toupper((unsigned char) *str1++) != toupper((unsigned char) *str2++)) return false; } @@ -56,10 +56,10 @@ if (needle_prev != needle_cur) { needle_prev = needle_cur; - f1 = toupper(*needle_cur); + f1 = toupper((unsigned char) *needle_cur); } - f2 = toupper(*haystack_cur); + f2 = toupper((unsigned char) *haystack_cur); if (f1 == f2) { needle_cur += 1; @@ -102,10 +102,10 @@ if (needle_prev != needle_cur) { needle_prev = needle_cur; - f1 = toupper(*needle_cur); + f1 = toupper((unsigned char) *needle_cur); } - f2 = toupper(*haystack_cur); + f2 = toupper((unsigned char) *haystack_cur); if (f1 == f2) { needle_cur += 1; @@ -135,7 +135,7 @@ while (pattern_size > 0) { - if (toupper(*str++) != toupper(*pattern++)) + if (toupper((unsigned char) *str++) != toupper((unsigned char) *pattern++)) return false; pattern_size -= 1; @@ -169,8 +169,8 @@ if (needle_prev != needle_cur) { needle_prev = needle_cur; - needle_char_is_upper = isupper(*needle_cur); - f1 = toupper(*needle_cur); + needle_char_is_upper = isupper((unsigned char) *needle_cur); + f1 = toupper((unsigned char) *needle_cur); } if (needle_char_is_upper) @@ -181,7 +181,7 @@ else { /* case insensitive */ - eq = f1 == toupper(*haystack_cur); + eq = f1 == toupper((unsigned char) *haystack_cur); } if (eq) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/table.c new/pspg-5.9.2/src/table.c --- old/pspg-5.9.1/src/table.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/table.c 2026-11-29 05:59:29.000000000 +0100 @@ -1882,7 +1882,7 @@ } /* first char should be a digit */ - if (!isdigit(c)) + if (!isdigit((unsigned char) c)) { char *_nullstr = *nullstr; size_t len; @@ -1963,14 +1963,14 @@ else return false; } - else if (!isdigit(c)) + else if (!isdigit((unsigned char) c)) { if (c == 'e' && !found_exponent && chrlen == 1 && decimal_point != '\0') { /* try to skip e+n */ if (str[1] == '+' || str[1] == '-') { - if (isdigit(str[2])) + if (isdigit((unsigned char) str[2])) { /* too long string - should not be translated to number */ if (buffptr + 3 - buffer > (BUFFER_MAX_SIZE - 1)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/src/theme_loader.c new/pspg-5.9.2/src/theme_loader.c --- old/pspg-5.9.1/src/theme_loader.c 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/src/theme_loader.c 2026-11-29 05:59:29.000000000 +0100 @@ -77,7 +77,7 @@ return token; } - while (isspace(*tokenizer->current)) + while (isspace((unsigned char) *tokenizer->current)) tokenizer->current++; if (*tokenizer->current == '\0') @@ -89,7 +89,7 @@ if (c == '#') { token->str = tokenizer->current; - while (isxdigit(*tokenizer->current)) + while (isxdigit((unsigned char) *tokenizer->current)) tokenizer->current++; if ((tokenizer->current - token->str) != 6) @@ -103,9 +103,9 @@ token->size = 6; token->value = (int) strtol(token->str, NULL, 16); } - else if (isdigit(c)) + else if (isdigit((unsigned char) c)) { - while (isdigit(*tokenizer->current)) + while (isdigit((unsigned char) *tokenizer->current)) tokenizer->current++; token->typ = TOKEN_NUMBER; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/tools/ax_lib_postgresql.m4 new/pspg-5.9.2/tools/ax_lib_postgresql.m4 --- old/pspg-5.9.1/tools/ax_lib_postgresql.m4 1970-01-01 01:00:00.000000000 +0100 +++ new/pspg-5.9.2/tools/ax_lib_postgresql.m4 2026-11-29 05:59:29.000000000 +0100 @@ -0,0 +1,268 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lib_postgresql.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LIB_POSTGRESQL([MINIMUM-VERSION],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) +# +# DESCRIPTION +# +# This macro provides tests of availability of PostgreSQL 'libpq' library +# of particular version or newer. +# +# AX_LIB_POSTGRESQL macro takes only one argument which is optional. If +# there is no required version passed, then macro does not run version +# test. +# +# The --with-postgresql option takes one of three possible values: +# +# no - do not check for PostgreSQL client library +# +# yes - do check for PostgreSQL library in standard locations (pg_config +# should be in the PATH) +# +# path - complete path to pg_config utility, use this option if pg_config +# can't be found in the PATH (You could set also PG_CONFIG variable) +# +# This macro calls: +# +# AC_SUBST(POSTGRESQL_CPPFLAGS) +# AC_SUBST(POSTGRESQL_LDFLAGS) +# AC_SUBST(POSTGRESQL_LIBS) +# AC_SUBST(POSTGRESQL_VERSION) +# +# And sets: +# +# HAVE_POSTGRESQL +# +# It execute if found ACTION-IF-FOUND (empty by default) and +# ACTION-IF-NOT-FOUND (AC_MSG_FAILURE by default) if not found. +# +# LICENSE +# +# Copyright (c) 2008 Mateusz Loskot <[email protected]> +# Copyright (c) 2014 Sree Harsha Totakura <[email protected]> +# Copyright (c) 2018 Bastien Roucaries <[email protected]> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 43 + +AC_DEFUN([_AX_LIB_POSTGRESQL_PG_CONFIG],[ + ax_found_postgresql="no" + ax_found_postgresql_req_version="yes" + + while true; do + AC_CACHE_CHECK([for the pg_config program], [ac_cv_path_PG_CONFIG], + [AC_PATH_PROGS_FEATURE_CHECK([PG_CONFIG], [pg_config], + [[ac_cv_path_PG_CONFIG="";$ac_path_PG_CONFIG --includedir > /dev/null \ + && ac_cv_path_PG_CONFIG=$ac_path_PG_CONFIG ac_path_PG_CONFIG_found=:]], + [ac_cv_path_PG_CONFIG=""])]) + PG_CONFIG=$ac_cv_path_PG_CONFIG + AS_IF([test "X$PG_CONFIG" = "X"],[break]) + + _AX_LIB_POSTGRESQL_PG_CONFIG_fail="no" + AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS_PG_CONFIG], + [ac_cv_POSTGRESQL_CPPFLAGS_PG_CONFIG="-I`$PG_CONFIG --includedir`" || _AX_LIB_POSTGRESQL_PG_CONFIG_fail=yes]) + AS_IF([test "X$_AX_LIB_POSTGRESQL_PG_CONFIG_fail" = "Xyes"],[break]) + POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS_PG_CONFIG" + + AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS_PG_CONFIG], + [ac_cv_POSTGRESQL_LDFLAGS_PG_CONFIG="-L`$PG_CONFIG --libdir`" || _AX_LIB_POSTGRESQL_PG_CONFIG_fail=yes]) + AS_IF([test "X$_AX_LIB_POSTGRESQL_PG_CONFIG_fail" = "Xyes"],[break]) + POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS_PG_CONFIG" + + AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS_PG_CONFIG], + [ac_cv_POSTGRESQL_LIBS_PG_CONFIG="-lpq"]) + POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS_PG_CONFIG" + + AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION_PG_CONFIG], + [ + ac_cv_POSTGRESQL_VERSION_PG_CONFIG=`$PG_CONFIG --version | sed "s/^PostgreSQL[[[:space:]]][[[:space:]]]*\([[0-9.]][[0-9.]]*\).*/\1/"` \ + || _AX_LIB_POSTGRESQL_PG_CONFIG_fail=yes + ]) + AS_IF([test "X$_AX_LIB_POSTGRESQL_PG_CONFIG_fail" = "Xyes"],[break]) + POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION_PG_CONFIG" + + + dnl + dnl Check if required version of PostgreSQL is available + dnl + AS_IF([test X"$ax_postgresql_version_req" != "X"],[ + AC_MSG_CHECKING([if PostgreSQL version $POSTGRESQL_VERSION is >= $ax_postgresql_version_req]) + AX_COMPARE_VERSION([$POSTGRESQL_VERSION],[ge],[$ax_postgresql_version_req], + [ax_found_postgresql_req_version=yes],[ax_found_postgresql_req_version=no]) + AC_MSG_RESULT([$ax_found_postgresql_req_version]) + ]) + AS_IF([test "X$ax_found_postgresql_req_version" = "Xno"],[break]) + + ax_found_postgresql="yes" + ax_lib_postgresql_method=PG_CONFIG + break + done +]) + +AC_DEFUN([_AX_LIB_POSTGRESQL_PKG_CONFIG], +[ + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + ax_found_postgresql=no + + while true; do + PKG_PROG_PKG_CONFIG + AS_IF([test "X$PKG_CONFIG" = "X"],[break]) + + _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=no; + AS_IF([test "X$ax_postgresql_version_req" = "X"], + [PKG_CHECK_EXISTS([libpq],[ax_found_postgresql_pkg_config=yes],[ax_found_postgresql_pkg_config=no])], + [PKG_CHECK_EXISTS([libpq >= "$ax_postgresql_version_req"], + [ax_found_postgresql_pkg_config=yes],[ax_found_postgresql_pkg_config=no])]) + AS_IF([test "X$ax_found_postgresql_pkg_config" = "Xno"],[break]) + + AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS], + [ac_cv_POSTGRESQL_CPPFLAGS="`$PKG_CONFIG libpq --cflags-only-I`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) + AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) + POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS" + + + AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS], + [ac_cv_POSTGRESQL_LDFLAGS="`$PKG_CONFIG libpq --libs-only-L --libs-only-other`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) + AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) + POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS" + + + AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS], + [ac_cv_POSTGRESQL_LIBS="`$PKG_CONFIG libpq --libs-only-l`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) + AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) + POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS" + + dnl already checked by exist but need to be recovered + AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION], + [ac_cv_POSTGRESQL_VERSION="`$PKG_CONFIG libpq --modversion`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) + AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) + POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION" + + ax_found_postgresql=yes + ax_lib_postgresql_method=PKG_CONFIG + break; + done + +]) + + + +AC_DEFUN([AX_LIB_POSTGRESQL], +[ + ax_skip_pkg_config="no" + + AC_ARG_WITH([postgresql], + AS_HELP_STRING([--with-postgresql=@<:@ARG@:>@], + [use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config] + ), + [ + AS_CASE([$withval], + [[[nN]][[oO]]],[ax_want_postgresql="no"], + [[[yY]][[eE]][[sS]]],[ax_want_postgresql="yes"], + [ + ax_want_postgresql="yes" + ax_skip_pkg_config="yes" + PG_CONFIG="$withval" + ]) + ], + [ax_want_postgresql="yes"] + ) + + AS_IF([test -n "$PG_CONFIG" && test "X$ac_cv_path_PG_CONFIG" != "X$PG_CONFIG"], [ + AS_UNSET([ac_cv_path_PG_CONFIG]) + AS_UNSET([ac_cv_POSTGRESQL_CPPFLAGS_PG_CONFIG]) + AS_UNSET([ac_cv_POSTGRESQL_LDFLAGS_PG_CONFIG]) + AS_UNSET([ac_cv_POSTGRESQL_LIBS_PG_CONFIG]) + AS_UNSET([ac_cv_POSTGRESQL_VERSION_PG_CONFIG]) + AS_UNSET([ac_cv_postgresql_link_PG_CONFIG]) + ]) + + AC_ARG_VAR([POSTGRESQL_CPPFLAGS],[cpp flags for PostgreSQL overriding detected flags]) + AC_ARG_VAR([POSTGRESQL_LIBS],[libs for PostgreSQL overriding detected libs]) + AC_ARG_VAR([POSTGRESQL_LDFLAGS],[linker flags for PostgreSQL overriding detected flags]) + + # populate cache + AS_IF([test "X$POSTGRESQL_CPPFLAGS" != X],[ac_cv_POSTGRESQL_CPPFLAGS="$POSTGRESQL_CPPFLAGS"]) + AS_IF([test "X$POSTGRESQL_LDFLAGS" != X],[ac_cv_POSTGRESQL_LDFLAGS="$POSTGRESQL_LDFLAGS"]) + AS_IF([test "X$POSTGRESQL_LIBS" != X],[ac_cv_POSTGRESQL_LIBS="$POSTGRESQL_LIBS"]) + + AS_IF([test "X$POSTGRESQL_CPPFLAGS" != X],[ac_cv_POSTGRESQL_CPPFLAGS_PG_CONFIG="$POSTGRESQL_CPPFLAGS"]) + AS_IF([test "X$POSTGRESQL_LDFLAGS" != X],[ac_cv_POSTGRESQL_LDFLAGS_PG_CONFIG="$POSTGRESQL_LDFLAGS"]) + AS_IF([test "X$POSTGRESQL_LIBS" != X],[ac_cv_POSTGRESQL_LIBS_PG_CONFIG="$POSTGRESQL_LIBS"]) + + ax_postgresql_version_req=ifelse([$1], [], [], [$1]) + ax_found_postgresql="no" + + POSTGRESQL_VERSION="" + + dnl + dnl Check PostgreSQL libraries (libpq) + dnl + AS_IF([test X"$ax_want_postgresql" = "Xyes"],[ + + AS_IF([test X"$ax_skip_pkg_config" = "Xno"], + [_AX_LIB_POSTGRESQL_PKG_CONFIG]) + + AS_IF([test X"$ax_found_postgresql" = "Xno"], + [_AX_LIB_POSTGRESQL_PG_CONFIG]) + + AS_IF([test X"$ax_found_postgresql" = Xyes],[ + _AX_LIB_POSTGRESQL_OLD_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" + _AX_LIB_POSTGRESQL_OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $POSTGRESQL_LDFLAGS" + _AX_LIB_POSTGRESQL_OLD_LIBS="$LIBS" + LIBS="$LIBS $POSTGRESQL_LIBS" + while true; do + dnl try to compile + AC_CHECK_HEADER([libpq-fe.h],[],[ax_found_postgresql=no]) + AS_IF([test "X$ax_found_postgresql" = "Xno"],[break]) + dnl try now to link + AS_VAR_PUSHDEF([ax_lib_postgresql_Link], [ac_cv_postgresql_link_$ax_lib_postgresql_method]) + AC_CACHE_CHECK([for the PostgreSQL library linking is working],[ax_lib_postgresql_Link], + [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM( + [ + #include <libpq-fe.h> + ], + [[ + char conninfo[]="dbname = postgres"; + PGconn *conn; + conn = PQconnectdb(conninfo); + ]] + ) + ],[AS_VAR_SET([ax_lib_postgresql_Link], [yes])], + [AS_VAR_SET([ax_lib_postgresql_Link], [no])]) + ]) + AS_VAR_COPY([ax_found_postgresql], [ax_lib_postgresql_Link]) + AS_VAR_POPDEF([ax_lib_postgresql_Link]) + AS_IF([test "X$ax_found_postgresql" = "Xno"],[break]) + break + done + CPPFLAGS="$_AX_LIB_POSTGRESQL_OLD_CPPFLAGS" + LDFLAGS="$_AX_LIB_POSTGRESQL_OLD_LDFLAGS" + LIBS="$_AX_LIB_POSTGRESQL_OLD_LIBS" + ]) + + AS_IF([test "x$ax_found_postgresql" = "xyes"],[ + AC_DEFINE([HAVE_POSTGRESQL], [1], + [Define to 1 if PostgreSQL libraries are available])]) + ]) + + AC_SUBST([POSTGRESQL_VERSION]) + AC_SUBST([POSTGRESQL_CPPFLAGS]) + AC_SUBST([POSTGRESQL_LDFLAGS]) + AC_SUBST([POSTGRESQL_LIBS]) + + AS_IF([test "x$ax_found_postgresql" = "xyes"], + [ifelse([$2], , :, [$2])], + [ifelse([$3], , AS_IF([test X"$ax_want_postgresql" = "Xyes"],[AC_MSG_ERROR([Library requirements (PostgreSQL) not met.])],[:]), [$3])]) +]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/pspg-5.9.1/tools/m4_ax_lib_postgresql.m4 new/pspg-5.9.2/tools/m4_ax_lib_postgresql.m4 --- old/pspg-5.9.1/tools/m4_ax_lib_postgresql.m4 2026-11-02 19:09:15.000000000 +0100 +++ new/pspg-5.9.2/tools/m4_ax_lib_postgresql.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,247 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lib_postgresql.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LIB_POSTGRESQL([MINIMUM-VERSION],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) -# -# DESCRIPTION -# -# This macro provides tests of availability of PostgreSQL 'libpq' library -# of particular version or newer. -# -# AX_LIB_POSTGRESQL macro takes only one argument which is optional. If -# there is no required version passed, then macro does not run version -# test. -# -# The --with-postgresql option takes one of three possible values: -# -# no - do not check for PostgreSQL client library -# -# yes - do check for PostgreSQL library in standard locations (pg_config -# should be in the PATH) -# -# path - complete path to pg_config utility, use this option if pg_config -# can't be found in the PATH (You could set also PG_CONFIG variable) -# -# This macro calls: -# -# AC_SUBST(POSTGRESQL_CPPFLAGS) -# AC_SUBST(POSTGRESQL_LDFLAGS) -# AC_SUBST(POSTGRESQL_LIBS) -# AC_SUBST(POSTGRESQL_VERSION) -# -# And sets: -# -# HAVE_POSTGRESQL -# -# It execute if found ACTION-IF-FOUND (empty by default) and -# ACTION-IF-NOT-FOUND (AC_MSG_FAILURE by default) if not found. -# -# LICENSE -# -# Copyright (c) 2008 Mateusz Loskot <[email protected]> -# Copyright (c) 2014 Sree Harsha Totakura <[email protected]> -# Copyright (c) 2018 Bastien Roucaries <[email protected]> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 22 - -AC_DEFUN([_AX_LIB_POSTGRESQL_OLD],[ - found_postgresql="no" - _AX_LIB_POSTGRESQL_OLD_fail="no" - while true; do - AC_CACHE_CHECK([for the pg_config program], [ac_cv_path_PG_CONFIG], - [AC_PATH_PROGS_FEATURE_CHECK([PG_CONFIG], [pg_config], - [[ac_cv_path_PG_CONFIG="";$ac_path_PG_CONFIG --includedir > /dev/null \ - && ac_cv_path_PG_CONFIG=$ac_path_PG_CONFIG ac_path_PG_CONFIG_found=:]], - [ac_cv_path_PG_CONFIG=""])]) - PG_CONFIG=$ac_cv_path_PG_CONFIG - AS_IF([test "X$PG_CONFIG" = "X"],[break]) - - AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS], - [ac_cv_POSTGRESQL_CPPFLAGS="-I`$PG_CONFIG --includedir`" || _AX_LIB_POSTGRESQL_OLD_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break]) - POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS" - - AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS], - [ac_cv_POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir`" || _AX_LIB_POSTGRESQL_OLD_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break]) - POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS" - - AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS], - [ac_cv_POSTGRESQL_LIBS="-lpq"]) - POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS" - - AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION], - [ - ac_cv_POSTGRESQL_VERSION=`$PG_CONFIG --version | sed "s/^PostgreSQL[[[:space:]]][[[:space:]]]*\([[0-9.]][[0-9.]]*\).*/\1/"` \ - || _AX_LIB_POSTGRESQL_OLD_fail=yes - ]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break]) - POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION" - - - dnl - dnl Check if required version of PostgreSQL is available - dnl - AS_IF([test X"$postgresql_version_req" != "X"],[ - AC_MSG_CHECKING([if PostgreSQL version $POSTGRESQL_VERSION is >= $postgresql_version_req]) - AX_COMPARE_VERSION([$POSTGRESQL_VERSION],[ge],[$postgresql_version_req], - [found_postgresql_req_version=yes],[found_postgresql_req_version=no]) - AC_MSG_RESULT([$found_postgresql_req_version]) - ]) - AS_IF([test "Xfound_postgresql_req_version" = "Xno"],[break]) - - found_postgresql="yes" - break - done -]) - -AC_DEFUN([_AX_LIB_POSTGRESQL_PKG_CONFIG], -[ - AC_REQUIRE([PKG_PROG_PKG_CONFIG]) - found_postgresql=no - - while true; do - PKG_PROG_PKG_CONFIG - AS_IF([test X$PKG_CONFIG = X],[break]) - - _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=no; - AS_IF([test "X$postgresql_version_req" = "X"], - [PKG_CHECK_EXISTS([libpq],[found_postgresql_pkg_config=yes],[found_postgresql=no])], - [PKG_CHECK_EXISTS([libpq >= "$postgresql_version_req"], - [found_postgresql=yes],[found_postgresql=no])]) - AS_IF([test "X$found_postgresql" = "Xno"],[break]) - - AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS], - [ac_cv_POSTGRESQL_CPPFLAGS="`$PKG_CONFIG libpq --cflags-only-I`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS" - - - AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS], - [ac_cv_POSTGRESQL_LDFLAGS="`$PKG_CONFIG libpq --libs-only-L --libs-only-other`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS" - - - AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS], - [ac_cv_POSTGRESQL_LIBS="`$PKG_CONFIG libpq --libs-only-l`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=ye]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS" - - dnl already checked by exist but need to be recovered - AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION], - [ac_cv_POSTGRESQL_VERSION="`$PKG_CONFIG libpq --modversion`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION" - - found_postgresql=yes - break; - done - -]) - - - -AC_DEFUN([AX_LIB_POSTGRESQL], -[ - AC_ARG_WITH([postgresql], - AS_HELP_STRING([--with-postgresql=@<:@ARG@:>@], - [use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config] - ), - [ - AS_CASE([$withval], - [[[nN]][[oO]]],[want_postgresql="no"], - [[[yY]][[eE]][[sS]]],[want_postgresql="yes"], - [ - want_postgresql="yes" - PG_CONFIG="$withval" - ]) - ], - [want_postgresql="yes"] - ) - - AC_ARG_VAR([POSTGRESQL_CPPFLAGS],[cpp flags for PostgreSQL overriding detected flags]) - AC_ARG_VAR([POSTGRESQL_LIBFLAGS],[libs for PostgreSQL overriding detected flags]) - AC_ARG_VAR([POSTGRESQL_LDFLAGS],[linker flags for PostgreSQL overriding detected flags]) - - # populate cache - AS_IF([test "X$POSTGRESQL_CPPFLAGS" != X],[ac_cv_POSTGRESQL_CPPFLAGS="$POSTGRESQL_CPPFLAGS"]) - AS_IF([test "X$POSTGRESQL_LDFLAGS" != X],[ac_cv_POSTGRESQL_LDFLAGS="$POSTGRESQL_LDFLAGS"]) - AS_IF([test "X$POSTGRESQL_LIBS" != X],[ac_cv_POSTGRESQL_LIBS="$POSTGRESQL_LIBS"]) - - postgresql_version_req=ifelse([$1], [], [], [$1]) - found_postgresql="no" - - POSTGRESQL_VERSION="" - - dnl - dnl Check PostgreSQL libraries (libpq) - dnl - AS_IF([test X"$want_postgresql" = "Xyes"],[ - _AX_LIB_POSTGRESQL_PKG_CONFIG - - - AS_IF([test X"$found_postgresql" = "Xno"], - [_AX_LIB_POSTGRESQL_OLD]) - - AS_IF([test X"$found_postgresql" = Xyes],[ - _AX_LIB_POSTGRESQL_OLD_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" - _AX_LIB_POSTGRESQL_OLD_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $POSTGRESQL_LDFLAGS" - _AX_LIB_POSTGRESQL_OLD_LIBS="$LIBS" - LIBS="$LIBS $POSTGRESQL_LIBS" - while true; do - dnl try to compile - AC_CHECK_HEADER([libpq-fe.h],[],[found_postgresql=no]) - AS_IF([test "X$found_postgresql" = "Xno"],[break]) - dnl try now to link - AC_CACHE_CHECK([for the PostgreSQL library linking is working],[ac_cv_postgresql_found], - [ - AC_LINK_IFELSE([ - AC_LANG_PROGRAM( - [ - #include <libpq-fe.h> - ], - [[ - char conninfo[]="dbname = postgres"; - PGconn *conn; - conn = PQconnectdb(conninfo); - ]] - ) - ],[ac_cv_postgresql_found=yes], - [ac_cv_postgresql_found=no]) - ]) - found_postgresql="$ac_cv_postgresql_found" - AS_IF([test "X$found_postgresql" = "Xno"],[break]) - break - done - CPPFLAGS="$_AX_LIB_POSTGRESQL_OLD_CPPFLAGS" - LDFLAGS="$_AX_LIB_POSTGRESQL_OLD_LDFLAGS" - LIBS="$_AX_LIB_POSTGRESQL_OLD_LIBS" - ]) - - - AS_IF([test "x$found_postgresql" = "xyes"],[ - AC_DEFINE([HAVE_POSTGRESQL], [1], - [Define to 1 if PostgreSQL libraries are available])]) - ]) - - AC_SUBST([POSTGRESQL_VERSION]) - AC_SUBST([POSTGRESQL_CPPFLAGS]) - AC_SUBST([POSTGRESQL_LDFLAGS]) - AC_SUBST([POSTGRESQL_LIBS]) - - AS_IF([test "x$found_postgresql" = "xyes"], - [ifelse([$2], , :, [$2])], - [ifelse([$3], , AS_IF([test X"$want_postgresql" = "Xyes"],[AC_MSG_ERROR([Library requirements (PostgreSQL) not met.])],[:]), [$3])]) - -])
