From: Steve Langasek Date: Sun, 3 Mar 2024 15:47:53 +0000 (+0100) Subject: debian: Final version of 64-bit time_t transition. X-Git-Url: http://git.tuebingen.mpg.de/?p=lopsub.git;a=commitdiff_plain;h=HEAD;hp=45901057b4103eeb745e080521678c0e43e0eca1 debian: Final version of 64-bit time_t transition. This partially reverts reverts commit b4d4de17a5c8, replacing it with the version that has been uploaded to unstable. It adds a versioned build-dependency on dpkg-dev to guard against accidental backports with a wrong ABI. Signed-off-by: Andre Noll --- diff --git a/Makefile b/Makefile index 548c96f..89cbc2e 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,8 @@ INSTALL := install GZIP := gzip -fn9 ZCAT := zcat +CC += -ffile-prefix-map=$(CURDIR)=. + dummy != $(M4) /dev/null || printf 'failed' ifeq ($(dummy), failed) $(error m4 is required to build this package) @@ -114,6 +116,9 @@ lopsubgen: $(lsg_objs) $(CC) -Wall -g -o $@ $(lsg_objs) $(REALNAME): $(liblopsub_objs) $(CC) --shared -Wl,-soname,liblopsub.so.$(MAJOR_VERSION) -o $@ $^ +liblopsub.a: $(liblopsub_objs) + $(AR) -rcs $@ $^ + lopsubex: $(lopsubex_objs) $(REALNAME) $(CC) -Wall -g -o $@ $(lopsubex_objs) @@ -149,4 +154,4 @@ clean: distclean: clean $(RM) *.lsg.c *.lsg.h lopsubgen.c config_file.c lopsubgen-stage1 \ lopsub.h lopsub.7 lopsub-suite.5 version.c - +-include Makefile.local diff --git a/NEWS b/NEWS index 13a7ed2..8508f44 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Noteworthy changes in lopsub-1.0.4 (2023-07-02) +=============================================== +* make the build reproducible (Chris Lamb, Vagrant Cascadian) +* improvements to the build system +* documentation fixes +* avoid NULL pointer dereference in argument parsing + Noteworthy changes in lopsub-1.0.3 (2019-05-19) =============================================== * build a shared library instead of a static one diff --git a/config_file.l b/config_file.l index f603b8e..66c1b76 100644 --- a/config_file.l +++ b/config_file.l @@ -21,7 +21,7 @@ %s SC_SCANNING IDENTIFIER [a-zA-Z]+[a-zA-Z0-9_-]* -EQUALS [[:space:]]*=[[:space:]]* +EQUALS [[:blank:]]*=[[:blank:]]* OPTION [a-zA-Z]+[a-zA-Z0-9_-]* %{ @@ -47,10 +47,10 @@ OPTION [a-zA-Z]+[a-zA-Z0-9_-]* %% /* skip comments and whitespace */ -^[[:space:]]*#.*\n ; -[[:space:]]|\n+ ; +^[[:blank:]]*#.*\n ; +[[:blank:]]|\n+ ; -\[[[:space:]]*{IDENTIFIER}[[:space:]]*\][[:space:]]*\n { +\[[[:blank:]]*{IDENTIFIER}[[:blank:]]*\][[:blank:]]*\n { int i, j; const char *subcmd = yyget_extra(yyscanner)->subcmd; @@ -71,9 +71,9 @@ OPTION [a-zA-Z]+[a-zA-Z0-9_-]* BEGIN(SC_SCANNING); } -{OPTION}[[:space:]]*\n add_option(yyscanner); +{OPTION}[[:blank:]]*\n add_option(yyscanner); -{OPTION}({EQUALS}|[[:space:]]+) { +{OPTION}({EQUALS}|[[:blank:]]+) { int ret = add_option(yyscanner); if (ret < 0) @@ -268,8 +268,7 @@ int lls_convert_config(const char *buf, size_t nbytes, const char *subcmd, if (errctx) { *errctx = malloc(100); if (*errctx) - sprintf(*errctx, "error at line %d", - yyget_lineno(yyscanner)); + sprintf(*errctx, "yylex error"); } } yy_delete_buffer(yybs, yyscanner); @@ -286,6 +285,7 @@ free_argv: } #if 0 +/* flex -o t.c config_file.l && cc -o tcf t.c */ int main(void) { char buf[100 * 1024]; @@ -301,7 +301,7 @@ int main(void) exit(EXIT_FAILURE); argc = ret; for (i = 0; i < argc; i++) - printf("argv[%d]: %s\n", i, rargv[i]); + printf("argv[%d]: %s\n", i, argv[i]); return EXIT_SUCCESS; } #endif diff --git a/debian/changelog b/debian/changelog index e9ea703..53995e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +liblopsub (1.0.4-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Rename libraries for 64-bit time_t transition. Closes: #1062407 + + -- Steve Langasek Fri, 01 Mar 2024 05:37:06 +0000 + +liblopsub (1.0.4-1) unstable; urgency=low + + * Make the build reproducible (Chris Lamb, Vagrant Cascadian). Closes: + #1039617, #1039618 + * Avoid crash due to a NULL pointer dereference in certain cases + * Minor cleanups and fixes, see NEWS for details. + + -- Andre Noll Sun, 02 Jul 2023 14:12:13 +0200 + liblopsub (1.0.3-2) unstable; urgency=low * Make the output of lopsubgen reproducible. diff --git a/debian/control b/debian/control index 004a71d..f488fe2 100644 --- a/debian/control +++ b/debian/control @@ -2,13 +2,16 @@ Source: liblopsub Section: libdevel Priority: optional Maintainer: Andre Noll -Build-Depends: m4, flex, debhelper (>= 10.0) +Build-Depends: dpkg-dev (>= 1.22.5), m4, flex, debhelper (>= 10.0) Standards-Version: 4.3.0 Homepage: http://people.tuebingen.mpg.de/maan/lopsub Vcs-Browser: http://git.tuebingen.mpg.de/lopsub.git Vcs-Git: git://git.tuebingen.mpg.de/lopsub.git -Package: liblopsub1 +Package: liblopsub1t64 +Provides: ${t64:Provides} +Replaces: liblopsub1 +Breaks: liblopsub1 (<< ${source:Version}) Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Long Option Parser for Subcommands @@ -25,7 +28,7 @@ Homepage: http://people.tuebingen.mpg.de/maan/lopsub Package: liblopsub-dev Architecture: any -Depends: ${shlibs:Depends}, liblopsub1 (= ${binary:Version}), ${misc:Depends} +Depends: ${shlibs:Depends}, liblopsub1t64 (= ${binary:Version}), ${misc:Depends} Description: Long Option Parser for Subcommand - headers Lopsub is an open source library written in C which aims to ease the task of creating, documenting and parsing the options of Unix diff --git a/debian/copyright b/debian/copyright index 95fcd00..ee4fb2b 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,4 +1,4 @@ -Copyright 2016 Andre Noll +Copyright 2016-2023 Andre Noll This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3 diff --git a/debian/liblopsub1.install b/debian/liblopsub1.install deleted file mode 100644 index 6234859..0000000 --- a/debian/liblopsub1.install +++ /dev/null @@ -1,2 +0,0 @@ -debian/tmp/usr/share/man/man7/* -debian/tmp/usr/lib/*/liblopsub.so.* diff --git a/debian/rules b/debian/rules index 3e73eac..3b5e4f1 100755 --- a/debian/rules +++ b/debian/rules @@ -3,7 +3,7 @@ # invoked with the package root as the current directory. sourcepackage := liblopsub -package := liblopsub1 +package := liblopsub1t64 devpackage := liblopsub-dev define checkdir diff --git a/lopsub-suite.5.m4 b/lopsub-suite.5.m4 index 0244c38..cd607a5 100644 --- a/lopsub-suite.5.m4 +++ b/lopsub-suite.5.m4 @@ -144,9 +144,7 @@ way with and .BR [/conclusion] . Both texts will become part of the manual page, but are not not part -of the short or long help. Like for the -.B section -directive, arbitrary roff source may be included here. +of the short or long help. .TP .B aux_info_prefix This text is shown at the bottom of each command before the value of the diff --git a/lopsub.c b/lopsub.c index a9e401f..b5017c3 100644 --- a/lopsub.c +++ b/lopsub.c @@ -632,17 +632,23 @@ static int lls_parse_arg(struct lls_arg *la, const struct lls_option *opts, bool multiple; int idx, ret; - if (!la->arg) - goto success; - if (opt->arg_info == LLS_NO_ARGUMENT) { + if (la->arg && opt->arg_info == LLS_NO_ARGUMENT) { xasprintf(errctx, "arg: %s, option: %s", la->arg, opt->name); return -E_LLS_ARG_GIVEN; } multiple = opt->flags & LLS_MULTIPLE; + if (opt->arg_type == LLS_STRING && !opt->values && !multiple) { + if (lor->value) { /* discard previous value */ + free(lor->value[0].string_val); + free(lor->value); + lor->value = NULL; + } + } + if (!la->arg) + goto success; idx = multiple? lor->given : 0; - if (lor->given == 0 || multiple) { - ret = xrealloc(&lor->value, - (lor->given + 1) * sizeof(*lor->value)); + if (!lor->value || multiple) { + ret = xrealloc(&lor->value, (idx + 1) * sizeof(*lor->value)); if (ret < 0) { xasprintf(errctx, "option value array for --%s", opt->name); @@ -651,8 +657,6 @@ static int lls_parse_arg(struct lls_arg *la, const struct lls_option *opts, } switch (opt->arg_type) { case LLS_STRING: - if (!opt->values && lor->given > 0 && !multiple) - free(lor->value[idx].string_val); if (opt->values) { ret = check_enum_arg(la->arg, opt, errctx); if (ret < 0) @@ -736,10 +740,11 @@ int lls_check_arg_count(const struct lls_parse_result *lpr, xasprintf(errctx, "no non-option args allowed, " "%u given", lpr->num_inputs); else - xasprintf(errctx, "%s %u non-option args allowed, " - "%u given", min_argc < max_argc? - "at most" : "exactly", - max_argc, lpr->num_inputs); + xasprintf(errctx, "%s %u non-option args %s, %u given", + min_argc < max_argc? "at most" : "exactly", + max_argc, + min_argc < max_argc? "allowed" : "required", + lpr->num_inputs); return -E_LLS_BAD_ARG_COUNT; } return 1;