]> git.tuebingen.mpg.de Git - lopsub.git/commitdiff
lopsubgen.suite: Fix homepage link. master
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 29 Apr 2024 00:26:26 +0000 (02:26 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 29 Apr 2024 00:32:23 +0000 (02:32 +0200)
There is no tilde in the URL. This affects the lopbsupgen man page.

Makefile
NEWS
config_file.l
debian/changelog
debian/control
debian/copyright
debian/liblopsub1.install [deleted file]
debian/rules
lopsub-suite.5.m4
lopsub.c
lopsubgen.suite

index 230a966b257de0eb761907426905ea97d30db64b..89cbc2eeb3abe456e21ee44e69377eb50d4377f5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,13 @@ endif
 .ONESHELL:
 .SHELLFLAGS := -ec
 
+# Recipes which redirect stdout to the target of the rule (i.e., constructs
+# like cmd > $@) create empty or incomplete output files if the command fails,
+# for example when cmd was not found. Since the target exists and is uptodate
+# in this case, this may lead to all sorts of problems. The following target
+# makes sure that such files are removed.
+.DELETE_ON_ERROR:
+
 PREFIX ?= /usr/local
 M4 := m4
 LN := ln -f
@@ -21,6 +28,17 @@ 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)
+endif
+dummy != printf '%%%%\n' | $(LEX) -o /dev/null || printf 'failed'
+ifeq ($(dummy), failed)
+$(error (f)lex is required to build this package)
+endif
+
 DATE_FMT := +%B %Y
 # To get a reproducible build, we use $(SOURCE_DATE_EPOCH) instead of the
 # current time if this variable is set.
@@ -79,13 +97,17 @@ lsg_objs := lopsubgen.o lsg.o lopsubgen.lsg.o lopsub.o version.o
 liblopsub_objs := config_file.o lopsub.o version.o
 lopsubex_objs := lopsubex.o lopsubex.lsg.o $(liblopsub_objs)
 
+LLS_CFLAGS := -g -fPIC
+STRICT_CFLAGS := -Wall
+STRICT_CFLAGS += -Werror-implicit-function-declaration
+
 $(lsg_objs) $(liblopsub_objs) $(lopsubex_objs): %.o: %.c
 lopsubgen.o config_file.o:
-       $(CC) -g -c -fPIC -o $@ ${@:.o=.c}
+       $(CC) $(CPPFLAGS) $(LLS_CFLAGS) $(CFLAGS) -c -o $@ ${@:.o=.c}
 lsg1.o: lsg.c lsg.h
-       $(CC) -g -DSTAGE1 -Wall -g -c $< -o $@
+       $(CC) $(CPPFLAGS) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS) -DSTAGE1 -c -o $@ $<
 %.o: %.c
-       $(CC) -Wall -I. -g -c -fPIC -o $@ $<
+       $(CC) -I. $(CPPFLAGS) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS) -c -o $@ $<
 
 # linking
 lopsubgen-stage1: $(lsg1_objs)
@@ -94,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)
 
@@ -129,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 13a7ed237c809ff18013c7550d2cd5889605ab93..8508f442c72c5ce0d96e2bee05a9be1bc5feacb5 100644 (file)
--- 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
index f603b8ee4636a7e48af43246144e89e451e6e109..66c1b769192186ba77b474bc4bdf65190962768c 100644 (file)
@@ -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+ ;
 
-<INITIAL,SC_SCANNING>\[[[:space:]]*{IDENTIFIER}[[:space:]]*\][[:space:]]*\n {
+<INITIAL,SC_SCANNING>\[[[: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);
 }
 
-<SC_SCANNING>{OPTION}[[:space:]]*\n add_option(yyscanner);
+<SC_SCANNING>{OPTION}[[:blank:]]*\n add_option(yyscanner);
 
-<SC_SCANNING>{OPTION}({EQUALS}|[[:space:]]+) {
+<SC_SCANNING>{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
index e9ea70316c5865c1db50f95a361c9708cce3108d..53995e3e8c6c395e5a6183df8641180a7fa58432 100644 (file)
@@ -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 <vorlon@debian.org>  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 <maan@tuebingen.mpg.de>  Sun, 02 Jul 2023 14:12:13 +0200
+
 liblopsub (1.0.3-2) unstable; urgency=low
 
   * Make the output of lopsubgen reproducible.
index 004a71d2f79fbd2709cf343067b85a4d23271ca1..f488fe2db8c5a54cb9cc4db1217c1fa61784a049 100644 (file)
@@ -2,13 +2,16 @@ Source: liblopsub
 Section: libdevel
 Priority: optional
 Maintainer: Andre Noll <maan@tuebingen.mpg.de>
-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
index 95fcd00deeab89fcf4b84e4b4d0a18fd92c66122..ee4fb2bfedd5546b27d5052f8a108b5f15411012 100644 (file)
@@ -1,4 +1,4 @@
-Copyright 2016 Andre Noll <maan@tuebingen.mpg.de>
+Copyright 2016-2023 Andre Noll <maan@tuebingen.mpg.de>
 
 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 (file)
index 6234859..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-debian/tmp/usr/share/man/man7/*
-debian/tmp/usr/lib/*/liblopsub.so.*
index 3e73eac868278489bfb755432706a82a484ce645..3b5e4f13a40f5344b0cba4b0eeb2ebf117910bed 100755 (executable)
@@ -3,7 +3,7 @@
 # invoked with the package root as the current directory.
 
 sourcepackage := liblopsub
-package := liblopsub1
+package := liblopsub1t64
 devpackage := liblopsub-dev
 
 define checkdir
index 0244c38a49f056f086476c3e3238a61241e698a3..cd607a5ec5bb074d3bef44efe09b56f465e74068 100644 (file)
@@ -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
index a9e401f259f63422e3db094080cc66ecb808c694..b5017c32db1e45b87d3d765c19862503558421f9 100644 (file)
--- 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;
index d8166ab6e0793ee9717ad1326bf8c825e564fdc7..f65bb996c39e3619bfbe870e2d5a3aaa1f0b422a 100644 (file)
        lopsub-suite(5), lopsub(7)
 
        Homepage:
-       .UR http://people.tuebingen.mpg.de/~maan/lopsub
+       .UR http://people.tuebingen.mpg.de/maan/lopsub
        .UE
 [/section]