diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/Makefile.in | 81 | ||||
-rw-r--r-- | src/at/deb-format.at | 7 | ||||
-rw-r--r-- | src/at/package.m4 | 4 | ||||
-rwxr-xr-x | src/at/testsuite | 144 | ||||
-rw-r--r-- | src/deb/build.c | 7 | ||||
-rw-r--r-- | src/main/archives.c | 57 | ||||
-rw-r--r-- | src/main/configure.c | 22 | ||||
-rw-r--r-- | src/main/script.c | 12 | ||||
-rw-r--r-- | src/query/main.c | 53 |
10 files changed, 208 insertions, 190 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 31d1a9e..6d0f2f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -98,14 +98,6 @@ dpkg_deb_SOURCES = \ deb/main.c \ # EOL -dpkg_deb_LDADD = \ - $(LDADD) \ - $(Z_LIBS) \ - $(LZMA_LIBS) \ - $(ZSTD_LIBS) \ - $(BZ2_LIBS) \ - # EOL - dpkg_divert_SOURCES = \ divert/main.c \ # EOL @@ -142,6 +134,9 @@ dpkg_trigger_SOURCES = \ trigger/main.c \ # EOL +dist_bashcompletions_DATA = \ + # EOL + SUFFIXES = include $(top_srcdir)/build-aux/subst.am diff --git a/src/Makefile.in b/src/Makefile.in index 88b2456..cbabcd6 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -120,14 +120,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/dpkg-arch.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(nobase_dist_pkgdata_DATA) \ - $(am__DIST_COMMON) +DIST_COMMON = $(srcdir)/Makefile.am $(dist_bashcompletions_DATA) \ + $(nobase_dist_pkgdata_DATA) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(pkglibexecdir)" "$(DESTDIR)$(pkgdatadir)" + "$(DESTDIR)$(pkglibexecdir)" "$(DESTDIR)$(bashcompletionsdir)" \ + "$(DESTDIR)$(pkgdatadir)" PROGRAMS = $(bin_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp am_dpkg_OBJECTS = common/force.$(OBJEXT) common/selinux.$(OBJEXT) \ @@ -153,9 +154,9 @@ am__v_lt_1 = am_dpkg_deb_OBJECTS = deb/build.$(OBJEXT) deb/extract.$(OBJEXT) \ deb/info.$(OBJEXT) deb/main.$(OBJEXT) dpkg_deb_OBJECTS = $(am_dpkg_deb_OBJECTS) -dpkg_deb_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +dpkg_deb_LDADD = $(LDADD) +dpkg_deb_DEPENDENCIES = ../lib/dpkg/libdpkg.la $(am__DEPENDENCIES_1) \ + ../lib/compat/libcompat.la am_dpkg_divert_OBJECTS = divert/main.$(OBJEXT) dpkg_divert_OBJECTS = $(am_dpkg_divert_OBJECTS) dpkg_divert_LDADD = $(LDADD) @@ -275,7 +276,7 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -DATA = $(nobase_dist_pkgdata_DATA) +DATA = $(dist_bashcompletions_DATA) $(nobase_dist_pkgdata_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -441,6 +442,7 @@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +aclocaldir = @aclocaldir@ admindir = @admindir@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -448,6 +450,7 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ backupsdir = @backupsdir@ +bashcompletionsdir = @bashcompletionsdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -459,6 +462,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ devlibdir = @devlibdir@ docdir = @docdir@ +docspecdir = @docspecdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -476,10 +480,14 @@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ +methodsdir = @methodsdir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +perllibdir = @perllibdir@ pkgconfdir = @pkgconfdir@ +pkgconfigdir = @pkgconfigdir@ +polkitactionsdir = @polkitactionsdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ @@ -572,14 +580,6 @@ dpkg_deb_SOURCES = \ deb/main.c \ # EOL -dpkg_deb_LDADD = \ - $(LDADD) \ - $(Z_LIBS) \ - $(LZMA_LIBS) \ - $(ZSTD_LIBS) \ - $(BZ2_LIBS) \ - # EOL - dpkg_divert_SOURCES = \ divert/main.c \ # EOL @@ -616,6 +616,9 @@ dpkg_trigger_SOURCES = \ trigger/main.c \ # EOL +dist_bashcompletions_DATA = \ + # EOL + SUFFIXES = .sh .pl do_shell_subst = $(AM_V_GEN) $(SED) \ -e "s:^ADMINDIR=.*$$:ADMINDIR='$(admindir)':" \ @@ -1032,6 +1035,27 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +install-dist_bashcompletionsDATA: $(dist_bashcompletions_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_bashcompletions_DATA)'; test -n "$(bashcompletionsdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bashcompletionsdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bashcompletionsdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bashcompletionsdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(bashcompletionsdir)" || exit $$?; \ + done + +uninstall-dist_bashcompletionsDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_bashcompletions_DATA)'; test -n "$(bashcompletionsdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(bashcompletionsdir)'; $(am__uninstall_files_from_dir) install-nobase_dist_pkgdataDATA: $(nobase_dist_pkgdata_DATA) @$(NORMAL_INSTALL) @list='$(nobase_dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ @@ -1146,7 +1170,7 @@ check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkglibexecdir)" "$(DESTDIR)$(pkgdatadir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkglibexecdir)" "$(DESTDIR)$(bashcompletionsdir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1253,7 +1277,8 @@ info: info-am info-am: -install-data-am: install-data-local install-nobase_dist_pkgdataDATA +install-data-am: install-data-local install-dist_bashcompletionsDATA \ + install-nobase_dist_pkgdataDATA install-dvi: install-dvi-am @@ -1334,6 +1359,7 @@ ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ + uninstall-dist_bashcompletionsDATA \ uninstall-nobase_dist_pkgdataDATA uninstall-pkglibexecSCRIPTS .MAKE: check-am install-am install-strip @@ -1345,16 +1371,17 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-binSCRIPTS install-data install-data-am \ - install-data-local install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-nobase_dist_pkgdataDATA \ - install-pdf install-pdf-am install-pkglibexecSCRIPTS \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installcheck-local installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-binSCRIPTS \ + install-data-local install-dist_bashcompletionsDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-nobase_dist_pkgdataDATA install-pdf \ + install-pdf-am install-pkglibexecSCRIPTS install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installcheck-local installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-binSCRIPTS uninstall-dist_bashcompletionsDATA \ uninstall-nobase_dist_pkgdataDATA uninstall-pkglibexecSCRIPTS .PRECIOUS: Makefile diff --git a/src/at/deb-format.at b/src/at/deb-format.at index e67ee10..13654d4 100644 --- a/src/at/deb-format.at +++ b/src/at/deb-format.at @@ -517,8 +517,11 @@ AT_SKIP_IF([! command -v xz >/dev/null]) DPKG_GEN_PKG_DEB_FORMAT_TEMPL() AT_CHECK([ # Extract the base members -xz -c control.tar >control.tar.xz -xz -c data.tar >data.tar.xz +# XXX: Due to a new behavior in xz 5.6.0, when it automatically reduces the +# amount of threads it prints a warning on stderr, even w/o -T. We pass an +# explicit -T+1 to force parallel mode but only use one thread as a workaround. +xz -T+1 -c control.tar >control.tar.xz +xz -T+1 -c data.tar >data.tar.xz ]) AT_CHECK([ diff --git a/src/at/package.m4 b/src/at/package.m4 index ca9daa9..e36d505 100644 --- a/src/at/package.m4 +++ b/src/at/package.m4 @@ -1,7 +1,7 @@ # Signature of the current package. m4_define([AT_PACKAGE_NAME], [dpkg]) m4_define([AT_PACKAGE_TARNAME], [dpkg]) -m4_define([AT_PACKAGE_VERSION], [1.22.4]) -m4_define([AT_PACKAGE_STRING], [dpkg 1.22.4]) +m4_define([AT_PACKAGE_VERSION], [1.22.5]) +m4_define([AT_PACKAGE_STRING], [dpkg 1.22.5]) m4_define([AT_PACKAGE_URL], [https://wiki.debian.org/Teams/Dpkg]) m4_define([AT_PACKAGE_BUGREPORT], [debian-dpkg@lists.debian.org]) diff --git a/src/at/testsuite b/src/at/testsuite index aea9493..2bdc028 100755 --- a/src/at/testsuite +++ b/src/at/testsuite @@ -614,9 +614,9 @@ at_help_all="1;deb-format.at:1;dpkg-deb options;dpkg-deb command-line; 2;deb-format.at:10;dpkg-deb .deb format 0.93x;dpkg-deb deb-old; 3;deb-format.at:208;dpkg-deb .deb format 2.x (core);dpkg-deb deb; 4;deb-format.at:511;dpkg-deb .deb format 2.x (xz);dpkg-deb deb; -5;deb-format.at:562;dpkg-deb .deb format 2.x (zstd);dpkg-deb deb; -6;deb-format.at:613;dpkg-deb .deb format 2.x (bzip2);dpkg-deb deb; -7;deb-format.at:641;dpkg-deb .deb format 2.x (lzma);dpkg-deb deb; +5;deb-format.at:565;dpkg-deb .deb format 2.x (zstd);dpkg-deb deb; +6;deb-format.at:616;dpkg-deb .deb format 2.x (bzip2);dpkg-deb deb; +7;deb-format.at:644;dpkg-deb .deb format 2.x (lzma);dpkg-deb deb; 8;deb-content.at:1;dpkg-deb .deb conffiles;dpkg-deb deb conffiles; 9;deb-fields.at:1;dpkg-deb .deb fields;dpkg-deb deb fields; 10;deb-split.at:1;dpkg-split options;dpkg-split command-line; @@ -1000,7 +1000,7 @@ fi # List of tests. if $at_list_p; then cat <<_ATEOF || at_write_fail=1 -dpkg 1.22.4 test suite: dpkg tools functional test suite test groups: +dpkg 1.22.5 test suite: dpkg tools functional test suite test groups: NUM: FILE-NAME:LINE TEST-GROUP-NAME KEYWORDS @@ -1041,7 +1041,7 @@ _ATEOF exit $at_write_fail fi if $at_version_p; then - printf "%s\n" "$as_me (dpkg 1.22.4)" && + printf "%s\n" "$as_me (dpkg 1.22.5)" && cat <<\_ATEOF || at_write_fail=1 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1241,11 +1241,11 @@ exec 5>>"$at_suite_log" # Banners and logs. printf "%s\n" "## --------------------------------------------------------- ## -## dpkg 1.22.4 test suite: dpkg tools functional test suite. ## +## dpkg 1.22.5 test suite: dpkg tools functional test suite. ## ## --------------------------------------------------------- ##" { printf "%s\n" "## --------------------------------------------------------- ## -## dpkg 1.22.4 test suite: dpkg tools functional test suite. ## +## dpkg 1.22.5 test suite: dpkg tools functional test suite. ## ## --------------------------------------------------------- ##" echo @@ -2105,7 +2105,7 @@ _ASBOX printf "%s\n" "Please send $at_msg and all information you think might help: To: <debian-dpkg@lists.debian.org> - Subject: [dpkg 1.22.4] $as_me: $at_msg1$at_msg2 + Subject: [dpkg 1.22.5] $as_me: $at_msg1$at_msg2 You may investigate any problem if you feel able to do so, in which case the test suite provides a good starting point. Its output may @@ -3426,14 +3426,20 @@ $at_traceon; } { set +x printf "%s\n" "$at_srcdir/deb-format.at:518: # Extract the base members -xz -c control.tar >control.tar.xz -xz -c data.tar >data.tar.xz +# XXX: Due to a new behavior in xz 5.6.0, when it automatically reduces the +# amount of threads it prints a warning on stderr, even w/o -T. We pass an +# explicit -T+1 to force parallel mode but only use one thread as a workaround. +xz -T+1 -c control.tar >control.tar.xz +xz -T+1 -c data.tar >data.tar.xz " at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:518" ( $at_check_trace; # Extract the base members -xz -c control.tar >control.tar.xz -xz -c data.tar >data.tar.xz +# XXX: Due to a new behavior in xz 5.6.0, when it automatically reduces the +# amount of threads it prints a warning on stderr, even w/o -T. We pass an +# explicit -T+1 to force parallel mode but only use one thread as a workaround. +xz -T+1 -c control.tar >control.tar.xz +xz -T+1 -c data.tar >data.tar.xz ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false @@ -3446,13 +3452,13 @@ $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:524: +printf "%s\n" "$at_srcdir/deb-format.at:527: # Test control.tar.xz member ar qSc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz ar t pkg-control-xz.deb dpkg-deb -c pkg-control-xz.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:524" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:527" ( $at_check_trace; # Test control.tar.xz member ar qSc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz @@ -3471,19 +3477,19 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:524" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:527" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:537: +printf "%s\n" "$at_srcdir/deb-format.at:540: # Test data.tar.xz member ar qSc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz ar t pkg-data-xz.deb dpkg-deb -c pkg-data-xz.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:537" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:540" ( $at_check_trace; # Test data.tar.xz member ar qSc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz @@ -3502,13 +3508,13 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:537" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:540" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:550: +printf "%s\n" "$at_srcdir/deb-format.at:553: # Test building and extracting xz compressed archive dpkg-deb --uniform-compression --root-owner-group -Zxz -b pkg-templ pkg-comp-xz.deb >/dev/null dpkg-deb --ctrl-tarfile pkg-comp-xz.deb >ctrl-xz.tar @@ -3516,7 +3522,7 @@ dpkg-deb --fsys-tarfile pkg-comp-xz.deb >fsys-xz.tar cmp ctrl-xz.tar control.tar cmp fsys-xz.tar data.tar " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:550" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:553" ( $at_check_trace; # Test building and extracting xz compressed archive dpkg-deb --uniform-compression --root-owner-group -Zxz -b pkg-templ pkg-comp-xz.deb >/dev/null @@ -3530,7 +3536,7 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:550" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:553" $at_failed && at_fn_log_failure $at_traceon; } @@ -3541,7 +3547,7 @@ $at_traceon; } read at_status <"$at_status_file" #AT_STOP_4 #AT_START_5 -at_fn_group_banner 5 'deb-format.at:562' \ +at_fn_group_banner 5 'deb-format.at:565' \ "dpkg-deb .deb format 2.x (zstd)" " " 1 at_xfail=no ( @@ -3550,12 +3556,12 @@ at_xfail=no -printf "%s\n" "deb-format.at:565" >"$at_check_line_file" +printf "%s\n" "deb-format.at:568" >"$at_check_line_file" (! command -v gzip >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:565" -printf "%s\n" "deb-format.at:566" >"$at_check_line_file" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:568" +printf "%s\n" "deb-format.at:569" >"$at_check_line_file" (! command -v zstd >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:566" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:569" @@ -3581,7 +3587,7 @@ test _ATEOF { set +x -printf "%s\n" "$at_srcdir/deb-format.at:568: +printf "%s\n" "$at_srcdir/deb-format.at:571: # Initialize the template package mv pkg-deb-format pkg-templ cp \$top_srcdir/ChangeLog.old pkg-templ/ @@ -3595,7 +3601,7 @@ printf "%s\n" "$at_srcdir/deb-format.at:568: gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:568" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:571" ( $at_check_trace; # Initialize the template package mv pkg-deb-format pkg-templ @@ -3615,18 +3621,18 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:568" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:571" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:569: +printf "%s\n" "$at_srcdir/deb-format.at:572: # Extract the base members zstd -c control.tar >control.tar.zst zstd -c data.tar >data.tar.zst " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:569" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:572" ( $at_check_trace; # Extract the base members zstd -c control.tar >control.tar.zst @@ -3637,19 +3643,19 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:569" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:572" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:575: +printf "%s\n" "$at_srcdir/deb-format.at:578: # Test control.tar.zst member ar qSc pkg-control-zst.deb debian-binary control.tar.zst data.tar.zst ar t pkg-control-zst.deb dpkg-deb -c pkg-control-zst.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:575" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:578" ( $at_check_trace; # Test control.tar.zst member ar qSc pkg-control-zst.deb debian-binary control.tar.zst data.tar.zst @@ -3668,19 +3674,19 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:575" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:578" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:588: +printf "%s\n" "$at_srcdir/deb-format.at:591: # Test data.tar.zst member ar qSc pkg-data-zst.deb debian-binary control.tar.gz data.tar.zst ar t pkg-data-zst.deb dpkg-deb -c pkg-data-zst.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:588" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:591" ( $at_check_trace; # Test data.tar.zst member ar qSc pkg-data-zst.deb debian-binary control.tar.gz data.tar.zst @@ -3699,13 +3705,13 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:588" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:591" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:601: +printf "%s\n" "$at_srcdir/deb-format.at:604: # Test building and extracting zstd compressed archive dpkg-deb --uniform-compression --root-owner-group -Zzstd -b pkg-templ pkg-comp-zstd.deb >/dev/null dpkg-deb --ctrl-tarfile pkg-comp-zstd.deb >ctrl-zstd.tar @@ -3713,7 +3719,7 @@ dpkg-deb --fsys-tarfile pkg-comp-zstd.deb >fsys-zstd.tar cmp ctrl-zstd.tar control.tar cmp fsys-zstd.tar data.tar " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:601" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:604" ( $at_check_trace; # Test building and extracting zstd compressed archive dpkg-deb --uniform-compression --root-owner-group -Zzstd -b pkg-templ pkg-comp-zstd.deb >/dev/null @@ -3727,7 +3733,7 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:601" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:604" $at_failed && at_fn_log_failure $at_traceon; } @@ -3738,7 +3744,7 @@ $at_traceon; } read at_status <"$at_status_file" #AT_STOP_5 #AT_START_6 -at_fn_group_banner 6 'deb-format.at:613' \ +at_fn_group_banner 6 'deb-format.at:616' \ "dpkg-deb .deb format 2.x (bzip2)" " " 1 at_xfail=no ( @@ -3747,12 +3753,12 @@ at_xfail=no -printf "%s\n" "deb-format.at:616" >"$at_check_line_file" +printf "%s\n" "deb-format.at:619" >"$at_check_line_file" (! command -v gzip >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:616" -printf "%s\n" "deb-format.at:617" >"$at_check_line_file" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:619" +printf "%s\n" "deb-format.at:620" >"$at_check_line_file" (! command -v bzip2 >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:617" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:620" @@ -3778,7 +3784,7 @@ test _ATEOF { set +x -printf "%s\n" "$at_srcdir/deb-format.at:619: +printf "%s\n" "$at_srcdir/deb-format.at:622: # Initialize the template package mv pkg-deb-format pkg-templ cp \$top_srcdir/ChangeLog.old pkg-templ/ @@ -3792,7 +3798,7 @@ printf "%s\n" "$at_srcdir/deb-format.at:619: gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:619" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:622" ( $at_check_trace; # Initialize the template package mv pkg-deb-format pkg-templ @@ -3812,17 +3818,17 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:619" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:622" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:620: +printf "%s\n" "$at_srcdir/deb-format.at:623: # Extract the base members bzip2 -c data.tar >data.tar.bz2 " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:620" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:623" ( $at_check_trace; # Extract the base members bzip2 -c data.tar >data.tar.bz2 @@ -3832,19 +3838,19 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:620" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:623" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:625: +printf "%s\n" "$at_srcdir/deb-format.at:628: # Test data.tar.bz2 member ar qSc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 ar t pkg-data-bz2.deb dpkg-deb -c pkg-data-bz2.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:625" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:628" ( $at_check_trace; # Test data.tar.bz2 member ar qSc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 @@ -3863,7 +3869,7 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:625" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:628" $at_failed && at_fn_log_failure $at_traceon; } @@ -3874,7 +3880,7 @@ $at_traceon; } read at_status <"$at_status_file" #AT_STOP_6 #AT_START_7 -at_fn_group_banner 7 'deb-format.at:641' \ +at_fn_group_banner 7 'deb-format.at:644' \ "dpkg-deb .deb format 2.x (lzma)" " " 1 at_xfail=no ( @@ -3883,12 +3889,12 @@ at_xfail=no -printf "%s\n" "deb-format.at:644" >"$at_check_line_file" +printf "%s\n" "deb-format.at:647" >"$at_check_line_file" (! command -v gzip >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:644" -printf "%s\n" "deb-format.at:645" >"$at_check_line_file" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:647" +printf "%s\n" "deb-format.at:648" >"$at_check_line_file" (! command -v lzma >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:645" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:648" @@ -3914,7 +3920,7 @@ test _ATEOF { set +x -printf "%s\n" "$at_srcdir/deb-format.at:647: +printf "%s\n" "$at_srcdir/deb-format.at:650: # Initialize the template package mv pkg-deb-format pkg-templ cp \$top_srcdir/ChangeLog.old pkg-templ/ @@ -3928,7 +3934,7 @@ printf "%s\n" "$at_srcdir/deb-format.at:647: gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:647" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:650" ( $at_check_trace; # Initialize the template package mv pkg-deb-format pkg-templ @@ -3948,17 +3954,17 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:647" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:650" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:648: +printf "%s\n" "$at_srcdir/deb-format.at:651: # Extract the base members lzma -c data.tar >data.tar.lzma " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:648" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:651" ( $at_check_trace; # Extract the base members lzma -c data.tar >data.tar.lzma @@ -3968,19 +3974,19 @@ at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:648" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:651" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:653: +printf "%s\n" "$at_srcdir/deb-format.at:656: # Test data.tar.lzma member ar qSc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma ar t pkg-data-lzma.deb dpkg-deb -c pkg-data-lzma.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:653" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:656" ( $at_check_trace; # Test data.tar.lzma member ar qSc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma @@ -3999,7 +4005,7 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:653" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:656" $at_failed && at_fn_log_failure $at_traceon; } diff --git a/src/deb/build.c b/src/deb/build.c index 597872b..1f0c050 100644 --- a/src/deb/build.c +++ b/src/deb/build.c @@ -177,10 +177,9 @@ file_treewalk_feed(const char *dir, int fd_out) if (S_ISLNK(treenode_get_mode(node))) { fi = file_info_new(nodename); file_info_list_append(&symlist, &symlist_end, fi); - } else { - if (fd_write(fd_out, nodename, strlen(nodename) + 1) < 0) - ohshite(_("failed to write filename to tar pipe (%s)"), - _("data member")); + } else if (fd_write(fd_out, nodename, strlen(nodename) + 1) < 0) { + ohshite(_("failed to write filename to tar pipe (%s)"), + _("data member")); } free(nodename); diff --git a/src/main/archives.c b/src/main/archives.c index 015bb23..7e399f9 100644 --- a/src/main/archives.c +++ b/src/main/archives.c @@ -534,8 +534,9 @@ tarobject_matches(struct tarcontext *tc, const char *fn_new, struct tar_entry *te, struct fsys_namenode *namenode) { - char *linkname; + struct varbuf linkname = VARBUF_INIT; ssize_t linksize; + bool linkmatch; debug(dbg_eachfiledetail, "tarobject matches on-disk object?"); @@ -548,8 +549,7 @@ tarobject_matches(struct tarcontext *tc, * remain real symlinks where we can compare the target. */ if (!S_ISLNK(stab->st_mode)) break; - linkname = m_malloc(stab->st_size + 1); - linksize = readlink(fn_old, linkname, stab->st_size + 1); + linksize = file_readlink(fn_old, &linkname, stab->st_size); if (linksize < 0) ohshite(_("unable to read link '%.255s'"), fn_old); else if (linksize > stab->st_size) @@ -558,13 +558,10 @@ tarobject_matches(struct tarcontext *tc, else if (linksize < stab->st_size) warning(_("symbolic link '%.250s' size has changed from %jd to %zd"), fn_old, (intmax_t)stab->st_size, linksize); - linkname[linksize] = '\0'; - if (strcmp(linkname, te->linkname) == 0) { - free(linkname); + linkmatch = strcmp(linkname.buf, te->linkname) == 0; + varbuf_destroy(&linkname); + if (linkmatch) return; - } else { - free(linkname); - } break; case TAR_FILETYPE_CHARDEV: if (S_ISCHR(stab->st_mode) && stab->st_rdev == te->dev) @@ -1044,25 +1041,21 @@ tarobject(struct tar_archive *tar, struct tar_entry *ti) ohshite(_("unable to move aside '%.255s' to install new version"), ti->name); } else if (S_ISLNK(stab.st_mode)) { - ssize_t symlink_len; + ssize_t linksize; int rc; /* We can't make a symlink with two hardlinks, so we'll have to * copy it. (Pretend that making a copy of a symlink is the same * as linking to it.) */ - varbuf_reset(&symlinkfn); - varbuf_grow(&symlinkfn, stab.st_size + 1); - symlink_len = readlink(fnamevb.buf, symlinkfn.buf, symlinkfn.size); - if (symlink_len < 0) + linksize = file_readlink(fnamevb.buf, &symlinkfn, stab.st_size); + if (linksize < 0) ohshite(_("unable to read link '%.255s'"), ti->name); - else if (symlink_len > stab.st_size) + else if (linksize > stab.st_size) ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"), - fnamevb.buf, (intmax_t)stab.st_size, symlink_len); - else if (symlink_len < stab.st_size) + fnamevb.buf, (intmax_t)stab.st_size, linksize); + else if (linksize < stab.st_size) warning(_("symbolic link '%.250s' size has changed from %jd to %zd"), - fnamevb.buf, (intmax_t)stab.st_size, symlink_len); - varbuf_trunc(&symlinkfn, symlink_len); - varbuf_end_str(&symlinkfn); + fnamevb.buf, (intmax_t)stab.st_size, linksize); if (symlink(symlinkfn.buf,fnametmpvb.buf)) ohshite(_("unable to make backup symlink for '%.255s'"), ti->name); rc = lchown(fnametmpvb.buf, stab.st_uid, stab.st_gid); @@ -1693,19 +1686,17 @@ wanttoinstall(struct pkginfo *pkg) } else { return true; } + } else if (in_force(FORCE_DOWNGRADE)) { + warning(_("downgrading %.250s from %.250s to %.250s"), + pkg_name(pkg, pnaw_nonambig), + versiondescribe(&pkg->installed.version, vdew_nonambig), + versiondescribe(&pkg->available.version, vdew_nonambig)); + return true; } else { - if (in_force(FORCE_DOWNGRADE)) { - warning(_("downgrading %.250s from %.250s to %.250s"), - pkg_name(pkg, pnaw_nonambig), - versiondescribe(&pkg->installed.version, vdew_nonambig), - versiondescribe(&pkg->available.version, vdew_nonambig)); - return true; - } else { - notice(_("will not downgrade %.250s from %.250s to %.250s, skipping"), - pkg_name(pkg, pnaw_nonambig), - versiondescribe(&pkg->installed.version, vdew_nonambig), - versiondescribe(&pkg->available.version, vdew_nonambig)); - return false; - } + notice(_("will not downgrade %.250s from %.250s to %.250s, skipping"), + pkg_name(pkg, pnaw_nonambig), + versiondescribe(&pkg->installed.version, vdew_nonambig), + versiondescribe(&pkg->available.version, vdew_nonambig)); + return false; } } diff --git a/src/main/configure.c b/src/main/configure.c index c2d58c7..f2c9227 100644 --- a/src/main/configure.c +++ b/src/main/configure.c @@ -699,7 +699,6 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) { static struct varbuf target = VARBUF_INIT; struct stat stab; - ssize_t r; int loopprotect; varbuf_set_str(result, dpkg_fsys_get_dir()); @@ -724,6 +723,8 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) in, result->buf); return 0; } else if (S_ISLNK(stab.st_mode)) { + ssize_t linksize; + debug(dbg_conffdetail, "conffderef symlink loopprotect=%d", loopprotect); if (loopprotect++ >= 25) { @@ -734,36 +735,35 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) return -1; } - varbuf_reset(&target); - varbuf_grow(&target, stab.st_size + 1); - r = readlink(result->buf, target.buf, target.size); - if (r < 0) { + linksize = file_readlink(result->buf, &target, stab.st_size); + if (linksize < 0) { warning(_("%s: unable to readlink conffile '%s'\n" " (= '%s'): %s"), pkg_name(pkg, pnaw_nonambig), in, result->buf, strerror(errno)); return -1; - } else if (r != stab.st_size) { + } else if (linksize != stab.st_size) { warning(_("symbolic link '%.250s' size has " "changed from %jd to %zd"), - result->buf, (intmax_t)stab.st_size, r); + result->buf, (intmax_t)stab.st_size, + linksize); /* If the returned size is smaller, let's * proceed, otherwise error out. */ - if (r > stab.st_size) + if (linksize > stab.st_size) return -1; } - varbuf_trunc(&target, r); - varbuf_end_str(&target); debug(dbg_conffdetail, "conffderef readlink gave %zd, '%s'", - r, target.buf); + linksize, target.buf); if (target.buf[0] == '/') { varbuf_set_str(result, dpkg_fsys_get_dir()); debug(dbg_conffdetail, "conffderef readlink absolute"); } else { + ssize_t r; + for (r = result->used - 1; r > 0 && result->buf[r] != '/'; r--) ; if (r < 0) { diff --git a/src/main/script.c b/src/main/script.c index b4f369d..017d92e 100644 --- a/src/main/script.c +++ b/src/main/script.c @@ -358,13 +358,11 @@ maintscript_fallback(struct pkginfo *pkg, } warning(_("unable to stat %s '%.250s': %s"), cmd.name, oldscriptpath, strerror(errno)); - } else { - if (!maintscript_exec(pkg, &pkg->installed, &cmd, &stab, SUBPROC_WARN)) { - command_destroy(&cmd); - free(buf); - post_script_tasks(); - return 1; - } + } else if (!maintscript_exec(pkg, &pkg->installed, &cmd, &stab, SUBPROC_WARN)) { + command_destroy(&cmd); + free(buf); + post_script_tasks(); + return 1; } notice(_("trying script from the new package instead ...")); diff --git a/src/query/main.c b/src/query/main.c index 7f8de59..6674896 100644 --- a/src/query/main.c +++ b/src/query/main.c @@ -69,7 +69,7 @@ pkg_array_match_patterns(struct pkg_array *array, const char *const *argv) { int argc, i, ip, *found; - int rc = 0; + int misses = 0; struct pkg_spec *ps; for (argc = 0; argv[argc]; argc++); @@ -101,7 +101,7 @@ pkg_array_match_patterns(struct pkg_array *array, for (ip = 0; ip < argc; ip++) { if (!found[ip]) { notice(_("no packages found matching %s"), argv[ip]); - rc++; + misses++; } pkg_spec_destroy(&ps[ip]); } @@ -109,7 +109,7 @@ pkg_array_match_patterns(struct pkg_array *array, free(ps); free(found); - return rc; + return misses; } struct list_format { @@ -250,7 +250,7 @@ static int listpackages(const char *const *argv) { struct pkg_array array; - int rc = 0; + int misses = 0; struct list_format fmt; struct pager *pager; @@ -279,7 +279,7 @@ listpackages(const char *const *argv) pkg_array_foreach(&array, pkg_array_list_item, &fmt); } else { - rc = pkg_array_match_patterns(&array, pkg_array_list_item, &fmt, argv); + misses = pkg_array_match_patterns(&array, pkg_array_list_item, &fmt, argv); } m_output(stdout, _("<standard output>")); @@ -290,7 +290,7 @@ listpackages(const char *const *argv) pkg_array_destroy(&array); modstatdb_shutdown(); - return rc; + return !!misses; } static int @@ -335,7 +335,7 @@ static int searchfiles(const char *const *argv) { const char *thisarg; - int failures = 0; + int misses = 0; struct varbuf path = VARBUF_INIT; static struct varbuf vb; @@ -378,7 +378,7 @@ searchfiles(const char *const *argv) } if (!found) { notice(_("no path found matching pattern %s"), thisarg); - failures++; + misses++; m_output(stderr, _("<standard error>")); } else { m_output(stdout, _("<standard output>")); @@ -388,13 +388,13 @@ searchfiles(const char *const *argv) varbuf_destroy(&path); - return failures; + return !!misses; } static int print_status(const char *const *argv) { - int failures = 0; + int misses = 0; modstatdb_open(msdbrw_readonly); @@ -416,7 +416,7 @@ print_status(const char *const *argv) !pkg_is_informative(pkg, &pkg->installed)) { notice(_("package '%s' is not installed and no information is available"), pkg_name(pkg, pnaw_nonambig)); - failures++; + misses++; } else { write_stanza(stdout, _("<standard output>"), pkg, &pkg->installed); } @@ -427,7 +427,7 @@ print_status(const char *const *argv) } m_output(stdout, _("<standard output>")); - if (failures) { + if (misses) { fputs(_("Use dpkg --info (= dpkg-deb --info) to examine archive files.\n"), stderr); m_output(stderr, _("<standard error>")); @@ -435,13 +435,13 @@ print_status(const char *const *argv) modstatdb_shutdown(); - return failures; + return !!misses; } static int print_avail(const char *const *argv) { - int failures = 0; + int misses = 0; modstatdb_open(msdbrw_readonly | msdbrw_available_readonly); @@ -458,7 +458,7 @@ print_avail(const char *const *argv) if (!pkg_is_informative(pkg, &pkg->available)) { notice(_("package '%s' is not available"), pkgbin_name(pkg, &pkg->available, pnaw_nonambig)); - failures++; + misses++; } else { write_stanza(stdout, _("<standard output>"), pkg, &pkg->available); } @@ -469,12 +469,12 @@ print_avail(const char *const *argv) } m_output(stdout, _("<standard output>")); - if (failures) + if (misses) m_output(stderr, _("<standard error>")); modstatdb_shutdown(); - return failures; + return !!misses; } static int @@ -484,7 +484,7 @@ list_files(const char *const *argv) struct fsys_namenode_list *file; struct pkginfo *pkg; struct fsys_namenode *namenode; - int failures = 0; + int misses = 0; if (!*argv) badusage(_("--%s needs at least one package name argument"), cipaction->olong); @@ -498,7 +498,7 @@ list_files(const char *const *argv) case PKG_STAT_NOTINSTALLED: notice(_("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig)); - failures++; + misses++; break; default: ensure_packagefiles_available(pkg); @@ -534,7 +534,7 @@ list_files(const char *const *argv) } m_output(stdout, _("<standard output>")); - if (failures) { + if (misses) { fputs(_("Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.\n"), stderr); m_output(stderr, _("<standard error>")); @@ -542,7 +542,7 @@ list_files(const char *const *argv) modstatdb_shutdown(); - return failures; + return !!misses; } static void @@ -566,14 +566,13 @@ showpackages(const char *const *argv) struct pkg_array array; struct pkg_format_node *fmt; bool fmt_needs_db_fsys; - int rc = 0; + int misses = 0; fmt = pkg_format_parse(opt_showformat, &err); if (!fmt) { notice(_("error in show format: %s"), err.str); dpkg_error_destroy(&err); - rc++; - return rc; + return 2; } fmt_needs_db_fsys = pkg_format_needs_db_fsys(fmt); @@ -602,7 +601,7 @@ showpackages(const char *const *argv) } else { if (fmt_needs_db_fsys) pkg_array_foreach(&array, pkg_array_load_db_fsys, NULL); - rc = pkg_array_match_patterns(&array, pkg_array_show_item, fmt, argv); + misses = pkg_array_match_patterns(&array, pkg_array_show_item, fmt, argv); } m_output(stdout, _("<standard output>")); @@ -612,7 +611,7 @@ showpackages(const char *const *argv) pkg_format_free(fmt); modstatdb_shutdown(); - return rc; + return !!misses; } static bool @@ -883,5 +882,5 @@ int main(int argc, const char *const *argv) { dpkg_program_done(); dpkg_locales_done(); - return !!ret; + return ret; } |