diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-08-09 17:45:58 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-08-09 17:45:58 +0000 |
commit | b85f1db0aa31c87d8486326920b267303da77af4 (patch) | |
tree | 86441f2962f8bcb68144694ca552674bf94b5af1 | |
parent | 256e526cf273c30f812853c6afbf075ed6ecd59c (diff) |
Update to xrdb 1.2.1
-rw-r--r-- | app/xrdb/ChangeLog | 62 | ||||
-rw-r--r-- | app/xrdb/Makefile.in | 1 | ||||
-rw-r--r-- | app/xrdb/aclocal.m4 | 16 | ||||
-rw-r--r-- | app/xrdb/compile | 13 | ||||
-rw-r--r-- | app/xrdb/configure | 42 | ||||
-rw-r--r-- | app/xrdb/configure.ac | 2 | ||||
-rw-r--r-- | app/xrdb/man/Makefile.in | 1 | ||||
-rw-r--r-- | app/xrdb/man/xrdb.man | 4 | ||||
-rw-r--r-- | app/xrdb/xrdb.c | 31 |
9 files changed, 139 insertions, 33 deletions
diff --git a/app/xrdb/ChangeLog b/app/xrdb/ChangeLog index 5c2be1168..5c623f23d 100644 --- a/app/xrdb/ChangeLog +++ b/app/xrdb/ChangeLog @@ -1,3 +1,65 @@ +commit 9c3a19e3f13252c6ac5b02ce703531b2bf9f7463 +Author: Matthieu Herrb <matthieu.herrb@laas.fr> +Date: Mon Aug 9 19:31:28 2021 +0200 + + xrdb 1.2.1 + + Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr> + +commit 4d3c11bee8c81abbc033a4731648a88db14508e1 +Author: Walter Harms <wharms@bfs.de> +Date: Sat Jun 26 23:11:25 2021 +0200 + + fix assignment discards ‘const’ qualifier + + xrdb.c: In function ‘main’: + xrdb.c:1071:52: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] + cmd_defines[num_cmd_defines++] = "-undef"; + + Signed-off-by: Walter Harms <wharms@bfs.de> + +commit 7d69c7f52b83a9b732325a16603b22e6c2f15d93 +Author: Walter Harms <wharms@bfs.de> +Date: Sat Jun 26 23:06:23 2021 +0200 + + XFree() can handle NULL arg + + Signed-off-by: Walter Harms <wharms@bfs.de> + +commit 2c57bc85c4cea7a159985a446e1f5f61a4c0f139 +Author: Walter Harms <wharms@bfs.de> +Date: Sat Jun 26 22:55:46 2021 +0200 + + Add actual querying capabilities + + The world is littered with broken grep commands because `xrdb -query` + can only dump the database and doesn't implement this simple search + feature. This patch adds a new `-get` option to search and print the + content of a single property by name. + + Signed-off-by: Michele Guerini Rocco <rnhm...@inventati.org> + Reviewed-by: Walter Harms <wharms@bfs.de> + Signed-off-by: Walter Harms <wharms@bfs.de> + +commit 9c51a2829f65ea03ef87376ca9561037d9262f6d +Author: Tobias Stoeckmann <tobias@stoeckmann.org> +Date: Sun Jun 7 19:56:43 2020 +0200 + + Fix out of boundary read. + + If a binary file which starts with 0x00 is edited, xrdb performs + an off-by-one read outside of its buffer. + + The fix is simple: Do not try to append an empty string to buffer, + which would be a no-op anyway. + + Proof of Concept (compile with -fsanitize=address): + + $ dd if=/dev/zero bs=1 count=1 of=poc.txt + $ xrdb -edit poc.txt + + Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> + commit c281cadb06657c2a15a52598be6cf9c30fad1b12 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Tue Feb 19 15:43:17 2019 -0800 diff --git a/app/xrdb/Makefile.in b/app/xrdb/Makefile.in index cf0b64d9d..d4e5a3ae2 100644 --- a/app/xrdb/Makefile.in +++ b/app/xrdb/Makefile.in @@ -300,6 +300,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/app/xrdb/aclocal.m4 b/app/xrdb/aclocal.m4 index 2a518c4b6..d0a818e1e 100644 --- a/app/xrdb/aclocal.m4 +++ b/app/xrdb/aclocal.m4 @@ -19,9 +19,9 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> dnl @@ -62,7 +62,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -163,7 +163,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -173,11 +173,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -194,7 +194,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full diff --git a/app/xrdb/compile b/app/xrdb/compile index a85b723c7..99e50524b 100644 --- a/app/xrdb/compile +++ b/app/xrdb/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/app/xrdb/configure b/app/xrdb/configure index 78ce2a29a..fb03f12a4 100644 --- a/app/xrdb/configure +++ b/app/xrdb/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xrdb 1.2.0. +# Generated by GNU Autoconf 2.69 for xrdb 1.2.1. # # Report bugs to <https://gitlab.freedesktop.org/xorg/app/xrdb/issues>. # @@ -581,8 +581,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xrdb' PACKAGE_TARNAME='xrdb' -PACKAGE_VERSION='1.2.0' -PACKAGE_STRING='xrdb 1.2.0' +PACKAGE_VERSION='1.2.1' +PACKAGE_STRING='xrdb 1.2.1' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xrdb/issues' PACKAGE_URL='' @@ -730,6 +730,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -811,6 +812,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1063,6 +1065,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1200,7 +1211,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1313,7 +1324,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xrdb 1.2.0 to adapt to many kinds of systems. +\`configure' configures xrdb 1.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1353,6 +1364,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1383,7 +1395,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xrdb 1.2.0:";; + short | recursive ) echo "Configuration of xrdb 1.2.1:";; esac cat <<\_ACEOF @@ -1496,7 +1508,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xrdb configure 1.2.0 +xrdb configure 1.2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1911,7 +1923,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xrdb $as_me 1.2.0, which was +It was created by xrdb $as_me 1.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4051,7 +4063,7 @@ fi # Define the identity of the package. PACKAGE='xrdb' - VERSION='1.2.0' + VERSION='1.2.1' cat >>confdefs.h <<_ACEOF @@ -10783,8 +10795,8 @@ _ACEOF # Checks for pkg-config packages pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRDB" >&5 -$as_echo_n "checking for XRDB... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmuu x11 xproto >= 7.0.25" >&5 +$as_echo_n "checking for xmuu x11 xproto >= 7.0.25... " >&6; } if test -n "$XRDB_CFLAGS"; then pkg_cv_XRDB_CFLAGS="$XRDB_CFLAGS" @@ -10824,7 +10836,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -10851,7 +10863,7 @@ Alternatively, you may set the environment variables XRDB_CFLAGS and XRDB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -11413,7 +11425,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xrdb $as_me 1.2.0, which was +This file was extended by xrdb $as_me 1.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11479,7 +11491,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xrdb config.status 1.2.0 +xrdb config.status 1.2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/app/xrdb/configure.ac b/app/xrdb/configure.ac index 3cf383f2f..6d5382f11 100644 --- a/app/xrdb/configure.ac +++ b/app/xrdb/configure.ac @@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xrdb], [1.2.0], +AC_INIT([xrdb], [1.2.1], [https://gitlab.freedesktop.org/xorg/app/xrdb/issues], [xrdb]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) diff --git a/app/xrdb/man/Makefile.in b/app/xrdb/man/Makefile.in index 920c3b435..257014a0f 100644 --- a/app/xrdb/man/Makefile.in +++ b/app/xrdb/man/Makefile.in @@ -223,6 +223,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/app/xrdb/man/xrdb.man b/app/xrdb/man/xrdb.man index 7ed14fc71..85c748b7f 100644 --- a/app/xrdb/man/xrdb.man +++ b/app/xrdb/man/xrdb.man @@ -251,6 +251,10 @@ option. The option can be used to merge the contents of properties back into the input resource file without damaging preprocessor commands. .TP 8 +.B \-get \fIname\fP +This option indicates that the current content of the property matching +\fIname\fP should be printed onto the standard output. +.TP 8 .B \-load This option indicates that the input should be loaded as the new value of the specified properties, replacing whatever was there (i.e. diff --git a/app/xrdb/xrdb.c b/app/xrdb/xrdb.c index 6054790ca..19c615391 100644 --- a/app/xrdb/xrdb.c +++ b/app/xrdb/xrdb.c @@ -48,6 +48,7 @@ #include <X11/Xatom.h> #include <X11/Xos.h> #include <X11/Xmu/SysUtil.h> +#include <X11/Xresource.h> #include <stdio.h> #include <ctype.h> #include <errno.h> @@ -84,6 +85,7 @@ #define OPLOAD 4 #define OPMERGE 5 #define OPOVERRIDE 6 +#define OPGET 7 #define BACKUP_SUFFIX ".bak" /* for editing */ @@ -126,6 +128,7 @@ static char *editFile = NULL; static const char *cpp_program = NULL; static const char * const cpp_locations[] = { CPP }; static const char *backup_suffix = BACKUP_SUFFIX; +static const char *resource_name = NULL; static Bool dont_execute = False; static Bool show_cpp = False; static String defines; @@ -745,6 +748,8 @@ EditFile(Entries *new, FILE *in, FILE *out) buff[0] = '\0'; if (!fgets(buff, BUFSIZ, in)) goto cleanup; + if (buff[0] == '\0') + continue; AppendToBuffer(&b, buff, strlen(buff)); c = &b.buff[b.used - 1]; if ((*(c--) == '\n') && (b.used == 1 || *c != '\\')) @@ -784,6 +789,7 @@ Syntax(const char *errmsg) " -nocpp do not use a preprocessor\n" " -E show preprocessor command & processed input file\n" " -query query resources\n" + " -get name get the content of a resource\n" " -load load resources from file [default]\n" " -override add in resources from file\n" " -merge merge resources from file & sort\n" @@ -982,6 +988,13 @@ main(int argc, char *argv[]) oper = OPQUERY; continue; } + else if (isabbreviation("-get", arg, 2)) { + oper = OPGET; + if (++i >= argc) + Syntax("-get requires an argument"); + resource_name = argv[i]; + continue; + } else if (isabbreviation("-load", arg, 2)) { oper = OPLOAD; continue; @@ -1055,7 +1068,7 @@ main(int argc, char *argv[]) } else if (!strcmp("-undef", arg)) { if (num_cmd_defines < MAX_CMD_DEFINES) { - cmd_defines[num_cmd_defines++] = "-undef"; + cmd_defines[num_cmd_defines++] = (char *) "-undef"; } else { fatal("%s: Too many cpp arguments\n", ProgramName); @@ -1282,7 +1295,19 @@ Process(int scrno, Bool doScreen, Bool execute) } else if (oper == OPQUERY) { if (xdefs) - printf("%s", xdefs); /* fputs broken in SunOS 4.0 */ + fputs(xdefs, stdout); + } + else if (oper == OPGET) { + if (xdefs && resource_name != NULL) { + char *type = NULL; + XrmValue value; + XrmDatabase xrdb = XrmGetStringDatabase(xdefs); + Bool found = XrmGetResource(xrdb, resource_name, + resource_name, &type, &value); + if (found == True && value.addr != NULL) + printf("%s\n", value.addr); + XrmDestroyDatabase(xrdb); + } } else if (oper == OPREMOVE) { if (xdefs) @@ -1454,7 +1479,7 @@ Process(int scrno, Bool doScreen, Bool execute) } if (execute) FreeEntries(&newDB); - if (doScreen && xdefs) + if (doScreen) XFree(xdefs); } |