From d1cbe73c1acd206da0040d7d5b8f4a53cb05d75e Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 8 Nov 2021 01:19:56 +0100 Subject: [PATCH 1/4] Fix #46 --- lib/pacutils/config.c | 7 +++++++ lib/pacutils/config.h | 2 ++ src/pacconf.c | 3 +++ t/10-config-basic.c | 4 +++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/pacutils/config.c b/lib/pacutils/config.c index 49a0a28..8af77e4 100644 --- a/lib/pacutils/config.c +++ b/lib/pacutils/config.c @@ -45,6 +45,7 @@ struct _pu_config_setting { {"CleanMethod", PU_CONFIG_OPTION_CLEANMETHOD}, {"Color", PU_CONFIG_OPTION_COLOR}, + {"NoProgressBar", PU_CONFIG_OPTION_NOPROGRESSBAR}, {"UseSyslog", PU_CONFIG_OPTION_USESYSLOG}, {"CheckSpace", PU_CONFIG_OPTION_CHECKSPACE}, {"VerbosePkgLists", PU_CONFIG_OPTION_VERBOSEPKGLISTS}, @@ -258,6 +259,7 @@ pu_config_t *pu_config_new(void) { config->checkspace = PU_CONFIG_BOOL_UNSET; config->color = PU_CONFIG_BOOL_UNSET; + config->noprogressbar = PU_CONFIG_BOOL_UNSET; config->disabledownloadtimeout = PU_CONFIG_BOOL_UNSET; config->ilovecandy = PU_CONFIG_BOOL_UNSET; config->usesyslog = PU_CONFIG_BOOL_UNSET; @@ -473,6 +475,7 @@ int pu_config_resolve(pu_config_t *config) { #define SETBOOL(opt) if(opt == -1) { opt = 0; } SETBOOL(config->checkspace); SETBOOL(config->color); + SETBOOL(config->noprogressbar); SETBOOL(config->disabledownloadtimeout); SETBOOL(config->ilovecandy); SETBOOL(config->usesyslog); @@ -515,6 +518,7 @@ void pu_config_merge(pu_config_t *dest, pu_config_t *src) { MERGEBOOL(dest->checkspace, src->checkspace); MERGEBOOL(dest->verbosepkglists, src->verbosepkglists); MERGEBOOL(dest->color, src->color); + MERGEBOOL(dest->noprogressbar, src->noprogressbar); MERGEBOOL(dest->ilovecandy, src->ilovecandy); MERGEBOOL(dest->disabledownloadtimeout, src->disabledownloadtimeout); @@ -817,6 +821,9 @@ int pu_config_reader_next(pu_config_reader_t *reader) { case PU_CONFIG_OPTION_COLOR: config->color = 1; break; + case PU_CONFIG_OPTION_NOPROGRESSBAR: + config->noprogressbar = 1; + break; case PU_CONFIG_OPTION_USESYSLOG: config->usesyslog = 1; break; diff --git a/lib/pacutils/config.h b/lib/pacutils/config.h index 3750dd2..a03927e 100644 --- a/lib/pacutils/config.h +++ b/lib/pacutils/config.h @@ -35,6 +35,7 @@ typedef enum pu_config_option_t { PU_CONFIG_OPTION_CLEANMETHOD, PU_CONFIG_OPTION_COLOR, + PU_CONFIG_OPTION_NOPROGRESSBAR, PU_CONFIG_OPTION_USESYSLOG, PU_CONFIG_OPTION_CHECKSPACE, PU_CONFIG_OPTION_VERBOSEPKGLISTS, @@ -85,6 +86,7 @@ typedef struct pu_config_t { pu_config_bool_t checkspace; pu_config_bool_t color; + pu_config_bool_t noprogressbar; pu_config_bool_t ilovecandy; pu_config_bool_t usesyslog; pu_config_bool_t verbosepkglists; diff --git a/src/pacconf.c b/src/pacconf.c index b62aa47..988c448 100644 --- a/src/pacconf.c +++ b/src/pacconf.c @@ -304,6 +304,7 @@ void dump_options(void) { show_bool("UseSyslog", config->usesyslog); show_bool("Color", config->color); + show_bool("NoProgressBar", config->noprogressbar); show_bool("DisableDownloadTimeout", config->disabledownloadtimeout); show_bool("CheckSpace", config->checkspace); show_bool("VerbosePkgLists", config->verbosepkglists); @@ -418,6 +419,8 @@ int list_directives(alpm_list_t *directives) { show_bool("UseSyslog", config->usesyslog); } else if (strcasecmp(i->data, "Color") == 0) { show_bool("Color", config->color); + } else if (strcasecmp(i->data, "NoProgressBar") == 0) { + show_bool("NoProgressBar", config->noprogressbar); } else if (strcasecmp(i->data, "CheckSpace") == 0) { show_bool("CheckSpace", config->checkspace); } else if (strcasecmp(i->data, "VerbosePkgLists") == 0) { diff --git a/t/10-config-basic.c b/t/10-config-basic.c index 7139054..cab5422 100644 --- a/t/10-config-basic.c +++ b/t/10-config-basic.c @@ -45,6 +45,7 @@ char buf[] = "CleanMethod = KeepInstalled KeepCurrent\n" "UseSyslog\n" "Color\n" + "NoProgressBar\n" "CheckSpace\n" "VerbosePkgLists\n" "ILoveCandy\n" @@ -109,7 +110,7 @@ int main(void) { while (pu_config_reader_next(reader) != -1); - tap_plan(40); + tap_plan(41); tap_ok(reader->eof, "eof reached"); tap_ok(!reader->error, "no error"); @@ -125,6 +126,7 @@ int main(void) { tap_ok(config->usesyslog, "UseSyslog"); tap_ok(config->color, "Color"); + tap_ok(config->noprogressbar, "NoProgressBar"); tap_ok(config->checkspace, "CheckSpace"); tap_ok(config->verbosepkglists, "VerbosePkgLists"); tap_ok(config->ilovecandy, "ILoveCandy"); From 41ba988960886e1dec23dc82749fdd4b8174a244 Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 8 Nov 2021 09:46:49 +0100 Subject: [PATCH 2/4] Fixes #42 --- doc/paccapability.pod | 10 +++++++++- doc/pacconf.pod | 2 +- doc/paclog.pod | 2 +- doc/pacrepairdb.pod | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/paccapability.pod b/doc/paccapability.pod index 319b341..d968334 100644 --- a/doc/paccapability.pod +++ b/doc/paccapability.pod @@ -9,7 +9,7 @@ paccapability - query libalpm capabilities =head1 DESCRIPTION -B provides a way to query which features libalpm was built with. +B provides a way to query which features L was built with. Recognized capabilities are: =over @@ -52,3 +52,11 @@ Display version information and exit. paccapability signatures >/dev/null && ... =back + +=head1 SEE ALSO + +=over + +L + +=back diff --git a/doc/pacconf.pod b/doc/pacconf.pod index d814910..3868472 100644 --- a/doc/pacconf.pod +++ b/doc/pacconf.pod @@ -15,7 +15,7 @@ a normalized format. By default, if only a single I is provided, only its value will be printed without the option name. For directives without a value, the directive name will be used as the value. -The values displayed are the final values as would be parsed by pacman itself. +The values displayed are the final values as would be parsed by L itself. All default values are set, C directives are processed, C<$arch> and C<$repo> variables in repository servers are replaced, and C will be replaced if set to C. diff --git a/doc/paclog.pod b/doc/paclog.pod index e6c9f32..5ab5c07 100644 --- a/doc/paclog.pod +++ b/doc/paclog.pod @@ -100,6 +100,6 @@ Display errors, warnings, and notes. B determines whether or not to read the log file from F based on a naive check using L. If B is called in an environment, such as a shell function or script being used in a pipe, where F is not -connected to a terminal but does not a log file to parse, B should be +connected to a terminal but does not contain a log file to parse, B should be called with F closed. For POSIX-compatible shells, this can be done with C<< <&- >>. diff --git a/doc/pacrepairdb.pod b/doc/pacrepairdb.pod index e4a9dd7..ba93301 100644 --- a/doc/pacrepairdb.pod +++ b/doc/pacrepairdb.pod @@ -67,7 +67,7 @@ Disable low-speed timeouts for downloads. =item B<--print-only> -Display the packages to be repaired and the cache packages to be used and exit. +Display the packages to be repaired and the cached packages to be used and exit. =item B<--root>=F @@ -107,7 +107,7 @@ nonetheless has the same name and version, B will blindly install it, worsening any database problems. B does not check for leftover orphaned files. It is the user's -responsibility locate and handle orphaned files. +responsibility to locate and handle orphaned files. B determines whether or not to read package names from F based on a naive check using L. If B is called in an From 10b85f6cb284c726b800a06b727d6436ea5177dc Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 8 Nov 2021 10:11:09 +0100 Subject: [PATCH 3/4] Fix compilation error on armv6h --- lib/pacutils/ui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pacutils/ui.c b/lib/pacutils/ui.c index 5160986..4f62dac 100644 --- a/lib/pacutils/ui.c +++ b/lib/pacutils/ui.c @@ -515,7 +515,7 @@ void pu_ui_cb_download(void *ctx, const char *filename, (int)(100 * downloaded / s->total)); } else { fprintf(c->out, "(%d/%d) %s (%jd)\r", - c->index + 1, num, s->filename, s->downloaded); + c->index + 1, num, s->filename, (intmax_t)s->downloaded); } } fflush(c->out); From 60465531d515894c82308526fa4d22edad4c8f4b Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 8 Nov 2021 22:14:20 +0100 Subject: [PATCH 4/4] Fix #50 Fix segfault on 32 bits architecture (like armv6h, armv7h) by forcing a 64 bits size for off_t by using _FILE_OFFSET_BITS=64 --- ext/globdir.c/t/Makefile | 5 +++++ ext/mini.c/t/Makefile | 5 +++++ lib/Makefile | 5 +++++ src/Makefile | 5 +++++ t/Makefile | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/ext/globdir.c/t/Makefile b/ext/globdir.c/t/Makefile index 66c0a51..999a778 100644 --- a/ext/globdir.c/t/Makefile +++ b/ext/globdir.c/t/Makefile @@ -4,6 +4,11 @@ GIT ?= git CFLAGS += -Wall -Wextra -Wpedantic -g +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),32) + CFLAGS += -D_FILE_OFFSET_BITS=64 +endif + override CPPFLAGS += -I.. TESTS = \ diff --git a/ext/mini.c/t/Makefile b/ext/mini.c/t/Makefile index 8232a53..2588a49 100644 --- a/ext/mini.c/t/Makefile +++ b/ext/mini.c/t/Makefile @@ -2,6 +2,11 @@ CFLAGS += -Wall -Wextra -Wpedantic -g +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),32) + CFLAGS += -D_FILE_OFFSET_BITS=64 +endif + override CPPFLAGS += -I.. TESTS = 01-sanity.t 10-basic.t 10-lookup.t 90-smoke.t diff --git a/lib/Makefile b/lib/Makefile index a8c368c..3f00f40 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -5,6 +5,11 @@ ALPM_CFLAGS ?= $(shell pkg-config libalpm --cflags) CFLAGS ?= -Wall -Wextra -Wpedantic -Werror -g +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),32) + CFLAGS += -D_FILE_OFFSET_BITS=64 +endif + override CFLAGS += $(ALPM_CFLAGS) override LDLIBS += -lalpm diff --git a/src/Makefile b/src/Makefile index 708bca1..c9fecd6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,6 +5,11 @@ ALPM_CFLAGS ?= $(shell pkg-config libalpm --cflags) CFLAGS ?= -Wall -Wextra -Wpedantic -Werror -g +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),32) + CFLAGS += -D_FILE_OFFSET_BITS=64 +endif + override CFLAGS += $(ALPM_CFLAGS) override CPPFLAGS += -I../lib override LDFLAGS += -L../lib diff --git a/t/Makefile b/t/Makefile index 4e4d447..b34069e 100644 --- a/t/Makefile +++ b/t/Makefile @@ -2,6 +2,11 @@ CFLAGS += -Wall -g -Wextra -I../lib LDFLAGS += -L../lib LDLIBS += -lpacutils -lalpm -larchive +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),32) + CFLAGS += -D_FILE_OFFSET_BITS=64 +endif + ALPM_CFLAGS ?= $(shell pkg-config libalpm --cflags) override CFLAGS += $(ALPM_CFLAGS)