diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:30:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:30:08 +0000 |
commit | 44cf9c6d2d274eac37502e835155f7e985f1b8e6 (patch) | |
tree | 9576ba968924c5b9a55ba9e14f4f26184c62c7d4 /src | |
parent | Adding upstream version 1.22.6. (diff) | |
download | dpkg-upstream/1.22.7.tar.xz dpkg-upstream/1.22.7.zip |
Adding upstream version 1.22.7.upstream/1.22.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
37 files changed, 1256 insertions, 833 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 6d0f2f2..abb1d96 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,6 +27,7 @@ bin_PROGRAMS = \ dpkg-deb \ dpkg-divert \ dpkg-query \ + dpkg-realpath \ dpkg-split \ dpkg-statoverride \ dpkg-trigger \ @@ -34,7 +35,6 @@ bin_PROGRAMS = \ bin_SCRIPTS = \ dpkg-maintscript-helper \ - dpkg-realpath \ # EOL pkglibexec_SCRIPTS = \ @@ -46,7 +46,6 @@ EXTRA_DIST += \ dpkg-db-backup.sh \ dpkg-db-keeper.sh \ dpkg-maintscript-helper.sh \ - dpkg-realpath.sh \ # EOL CLEANFILES += \ @@ -107,6 +106,10 @@ dpkg_query_SOURCES = \ query/main.c \ # EOL +dpkg_realpath_SOURCES = \ + realpath/main.c \ + # EOL + dpkg_split_SOURCES = \ split/dpkg-split.h \ split/info.c \ diff --git a/src/Makefile.in b/src/Makefile.in index cbabcd6..699ca68 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -97,12 +97,12 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = dpkg$(EXEEXT) dpkg-deb$(EXEEXT) dpkg-divert$(EXEEXT) \ - dpkg-query$(EXEEXT) dpkg-split$(EXEEXT) \ + dpkg-query$(EXEEXT) dpkg-realpath$(EXEEXT) dpkg-split$(EXEEXT) \ dpkg-statoverride$(EXEEXT) dpkg-trigger$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/dpkg-arch.m4 \ - $(top_srcdir)/m4/dpkg-build.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/build-to-host.m4 \ + $(top_srcdir)/m4/dpkg-arch.m4 $(top_srcdir)/m4/dpkg-build.m4 \ $(top_srcdir)/m4/dpkg-compiler.m4 \ $(top_srcdir)/m4/dpkg-coverage.m4 \ $(top_srcdir)/m4/dpkg-funcs.m4 \ @@ -167,6 +167,11 @@ dpkg_query_OBJECTS = $(am_dpkg_query_OBJECTS) dpkg_query_LDADD = $(LDADD) dpkg_query_DEPENDENCIES = ../lib/dpkg/libdpkg.la $(am__DEPENDENCIES_1) \ ../lib/compat/libcompat.la +am_dpkg_realpath_OBJECTS = realpath/main.$(OBJEXT) +dpkg_realpath_OBJECTS = $(am_dpkg_realpath_OBJECTS) +dpkg_realpath_LDADD = $(LDADD) +dpkg_realpath_DEPENDENCIES = ../lib/dpkg/libdpkg.la \ + $(am__DEPENDENCIES_1) ../lib/compat/libcompat.la am_dpkg_split_OBJECTS = split/info.$(OBJEXT) split/join.$(OBJEXT) \ split/main.$(OBJEXT) split/queue.$(OBJEXT) \ split/split.$(OBJEXT) @@ -241,10 +246,10 @@ am__depfiles_remade = common/$(DEPDIR)/force.Po \ main/$(DEPDIR)/select.Po main/$(DEPDIR)/trigproc.Po \ main/$(DEPDIR)/unpack.Po main/$(DEPDIR)/update.Po \ main/$(DEPDIR)/verify.Po query/$(DEPDIR)/main.Po \ - split/$(DEPDIR)/info.Po split/$(DEPDIR)/join.Po \ - split/$(DEPDIR)/main.Po split/$(DEPDIR)/queue.Po \ - split/$(DEPDIR)/split.Po statoverride/$(DEPDIR)/main.Po \ - trigger/$(DEPDIR)/main.Po + realpath/$(DEPDIR)/main.Po split/$(DEPDIR)/info.Po \ + split/$(DEPDIR)/join.Po split/$(DEPDIR)/main.Po \ + split/$(DEPDIR)/queue.Po split/$(DEPDIR)/split.Po \ + statoverride/$(DEPDIR)/main.Po trigger/$(DEPDIR)/main.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -265,12 +270,13 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(dpkg_SOURCES) $(dpkg_deb_SOURCES) $(dpkg_divert_SOURCES) \ - $(dpkg_query_SOURCES) $(dpkg_split_SOURCES) \ - $(dpkg_statoverride_SOURCES) $(dpkg_trigger_SOURCES) -DIST_SOURCES = $(dpkg_SOURCES) $(dpkg_deb_SOURCES) \ - $(dpkg_divert_SOURCES) $(dpkg_query_SOURCES) \ + $(dpkg_query_SOURCES) $(dpkg_realpath_SOURCES) \ $(dpkg_split_SOURCES) $(dpkg_statoverride_SOURCES) \ $(dpkg_trigger_SOURCES) +DIST_SOURCES = $(dpkg_SOURCES) $(dpkg_deb_SOURCES) \ + $(dpkg_divert_SOURCES) $(dpkg_query_SOURCES) \ + $(dpkg_realpath_SOURCES) $(dpkg_split_SOURCES) \ + $(dpkg_statoverride_SOURCES) $(dpkg_trigger_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -396,6 +402,7 @@ PACKAGE_RELEASE_DATE = @PACKAGE_RELEASE_DATE@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VCS_ID = @PACKAGE_VCS_ID@ PACKAGE_VCS_TYPE = @PACKAGE_VCS_TYPE@ PACKAGE_VCS_URL = @PACKAGE_VCS_URL@ PACKAGE_VCS_WEB = @PACKAGE_VCS_WEB@ @@ -477,6 +484,8 @@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ logdir = @logdir@ mandir = @mandir@ @@ -517,9 +526,9 @@ LDADD = \ # EOL EXTRA_DIST = dpkg-db-backup.sh dpkg-db-keeper.sh \ - dpkg-maintscript-helper.sh dpkg-realpath.sh \ - $(srcdir)/at/atlocal.in $(srcdir)/at/package.m4 \ - $(TESTSUITE_AT) $(TESTSUITE) $(srcdir)/at/package.m4 + dpkg-maintscript-helper.sh $(srcdir)/at/atlocal.in \ + $(srcdir)/at/package.m4 $(TESTSUITE_AT) $(TESTSUITE) \ + $(srcdir)/at/package.m4 CLEANFILES = $(bin_SCRIPTS) $(pkglibexec_SCRIPTS) # EOL DISTCLEANFILES = at/atconfig at/atconfig nobase_dist_pkgdata_DATA = \ @@ -528,7 +537,6 @@ nobase_dist_pkgdata_DATA = \ bin_SCRIPTS = \ dpkg-maintscript-helper \ - dpkg-realpath \ # EOL pkglibexec_SCRIPTS = \ @@ -589,6 +597,10 @@ dpkg_query_SOURCES = \ query/main.c \ # EOL +dpkg_realpath_SOURCES = \ + realpath/main.c \ + # EOL + dpkg_split_SOURCES = \ split/dpkg-split.h \ split/info.c \ @@ -620,34 +632,32 @@ dist_bashcompletions_DATA = \ # EOL SUFFIXES = .sh .pl -do_shell_subst = $(AM_V_GEN) $(SED) \ - -e "s:^ADMINDIR=.*$$:ADMINDIR='$(admindir)':" \ - -e "s:^BACKUPSDIR=.*$$:BACKUPSDIR='$(backupsdir)':" \ - -e "s:^PKGDATADIR_DEFAULT=.*$$:PKGDATADIR_DEFAULT='$(pkgdatadir)':" \ - -e "s:^version=['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":" \ - -e "s:^TAR=.*$$:TAR='$(TAR)':" \ - # EOL +subst_shell_rules = "\ + s{^ADMINDIR=.*$$}{ADMINDIR='$(admindir)'}; \ + s{^BACKUPSDIR=.*$$}{BACKUPSDIR='$(backupsdir)'}; \ + s{^PKGDATADIR_DEFAULT=.*$$}{PKGDATADIR_DEFAULT='$(pkgdatadir)'}; \ + s{^version=['\"][^'\"]*[\"']}{version=\"$(PACKAGE_VERSION)\"}; \ + s{^TAR=.*$$}{TAR='$(TAR)'}; \ + " +subst_shell_filter = $(PERL) -p -e $(subst_shell_rules) +subst_shell_file = $(PERL) -i -p -e $(shell_subst_rules) # Perl support. -do_perl_subst = $(AM_V_GEN) $(SED) \ - -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \ - -e "s:our \$$CONFDIR = .*;:our \$$CONFDIR = '$(pkgconfdir)';:" \ - -e "s:our \$$ADMINDIR = .*;:our \$$ADMINDIR = '$(admindir)';:" \ - -e "s:our \$$LIBDIR = .*;:our \$$LIBDIR = '$(pkglibexecdir)';:" \ - -e "s:our \$$DATADIR = .*;:our \$$DATADIR = '$(pkgdatadir)';:" \ - -e "s:our \$$PROGMAKE = .*;:our \$$PROGMAKE = '$(MAKE)';:" \ - -e "s:our \$$PROGTAR = .*;:our \$$PROGTAR = '$(TAR)';:" \ - -e "s:our \$$PROGPATCH = .*;:our \$$PROGPATCH = '$(PATCH)';:" \ - -e "s:our \$$PROGVERSION = .*;:our \$$PROGVERSION = '$(PACKAGE_VERSION)';:" \ - # EOL - - -# Makefile support. -do_make_subst = $(AM_V_GEN) $(SED) \ - -e "s:dpkg_datadir[[:space:]]*=[[:space:]]*[^[:space:]]*:dpkg_datadir = $(pkgdatadir):" \ - # EOL - +subst_perl_rules = "\ + s{^\#!\s*/usr/bin/perl}{\#!$(PERL)}; \ + s{our \\\$$CONFDIR = .*;}{our \\\$$CONFDIR = '$(pkgconfdir)';}; \ + s{our \\\$$ADMINDIR = .*;}{our \\\$$ADMINDIR = '$(admindir)';}; \ + s{our \\\$$LIBDIR = .*;}{our \\\$$LIBDIR = '$(pkglibexecdir)';}; \ + s{our \\\$$DATADIR = .*;}{our \\\$$DATADIR = '$(pkgdatadir)';}; \ + s{our \\\$$PROGMAKE = .*;}{our \\\$$PROGMAKE = '$(MAKE)';}; \ + s{our \\\$$PROGTAR = .*;}{our \\\$$PROGTAR = '$(TAR)';}; \ + s{our \\\$$PROGPATCH = .*;}{our \\\$$PROGPATCH = '$(PATCH)';}; \ + s{our \\\$$PROGVERSION = .*;}{our \\\$$PROGVERSION = '$(PACKAGE_VERSION)';}; \ + " + +subst_perl_filter = $(PERL) -p -e $(subst_perl_rules) +subst_perl_file = $(PERL) -i -p -e $(subst_perl_rules) TESTSUITE_AT = $(srcdir)/at/testsuite.at $(srcdir)/at/local.at \ $(srcdir)/at/deb-format.at $(srcdir)/at/deb-fields.at \ $(srcdir)/at/deb-content.at $(srcdir)/at/deb-split.at \ @@ -655,6 +665,8 @@ TESTSUITE_AT = $(srcdir)/at/testsuite.at $(srcdir)/at/local.at \ $(srcdir)/at/chdir.at TESTSUITE = $(srcdir)/at/testsuite AUTOTEST_DEPS = at/atconfig at/atlocal $(TESTSUITE) +TEST_VERBOSE_OPT = $(TEST_VERBOSE:0=) +TESTSUITEFLAGS = -j$(TEST_PARALLEL) $(TEST_VERBOSE_OPT:1=--verbose) AUTOTEST = $(AUTOM4TE) --language=autotest all: all-am @@ -836,6 +848,18 @@ query/main.$(OBJEXT): query/$(am__dirstamp) \ dpkg-query$(EXEEXT): $(dpkg_query_OBJECTS) $(dpkg_query_DEPENDENCIES) $(EXTRA_dpkg_query_DEPENDENCIES) @rm -f dpkg-query$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dpkg_query_OBJECTS) $(dpkg_query_LDADD) $(LIBS) +realpath/$(am__dirstamp): + @$(MKDIR_P) realpath + @: > realpath/$(am__dirstamp) +realpath/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) realpath/$(DEPDIR) + @: > realpath/$(DEPDIR)/$(am__dirstamp) +realpath/main.$(OBJEXT): realpath/$(am__dirstamp) \ + realpath/$(DEPDIR)/$(am__dirstamp) + +dpkg-realpath$(EXEEXT): $(dpkg_realpath_OBJECTS) $(dpkg_realpath_DEPENDENCIES) $(EXTRA_dpkg_realpath_DEPENDENCIES) + @rm -f dpkg-realpath$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(dpkg_realpath_OBJECTS) $(dpkg_realpath_LDADD) $(LIBS) split/$(am__dirstamp): @$(MKDIR_P) split @: > split/$(am__dirstamp) @@ -958,6 +982,7 @@ mostlyclean-compile: -rm -f divert/*.$(OBJEXT) -rm -f main/*.$(OBJEXT) -rm -f query/*.$(OBJEXT) + -rm -f realpath/*.$(OBJEXT) -rm -f split/*.$(OBJEXT) -rm -f statoverride/*.$(OBJEXT) -rm -f trigger/*.$(OBJEXT) @@ -992,6 +1017,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@main/$(DEPDIR)/update.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@main/$(DEPDIR)/verify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@query/$(DEPDIR)/main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@realpath/$(DEPDIR)/main.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@split/$(DEPDIR)/info.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@split/$(DEPDIR)/join.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@split/$(DEPDIR)/main.Po@am__quote@ # am--include-marker @@ -1210,6 +1236,8 @@ distclean-generic: -rm -f main/$(am__dirstamp) -rm -f query/$(DEPDIR)/$(am__dirstamp) -rm -f query/$(am__dirstamp) + -rm -f realpath/$(DEPDIR)/$(am__dirstamp) + -rm -f realpath/$(am__dirstamp) -rm -f split/$(DEPDIR)/$(am__dirstamp) -rm -f split/$(am__dirstamp) -rm -f statoverride/$(DEPDIR)/$(am__dirstamp) @@ -1254,6 +1282,7 @@ distclean: distclean-am -rm -f main/$(DEPDIR)/update.Po -rm -f main/$(DEPDIR)/verify.Po -rm -f query/$(DEPDIR)/main.Po + -rm -f realpath/$(DEPDIR)/main.Po -rm -f split/$(DEPDIR)/info.Po -rm -f split/$(DEPDIR)/join.Po -rm -f split/$(DEPDIR)/main.Po @@ -1335,6 +1364,7 @@ maintainer-clean: maintainer-clean-am -rm -f main/$(DEPDIR)/update.Po -rm -f main/$(DEPDIR)/verify.Po -rm -f query/$(DEPDIR)/main.Po + -rm -f realpath/$(DEPDIR)/main.Po -rm -f split/$(DEPDIR)/info.Po -rm -f split/$(DEPDIR)/join.Po -rm -f split/$(DEPDIR)/main.Po @@ -1389,12 +1419,12 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ .sh: Makefile @test -d `dirname $@` || $(MKDIR_P) `dirname $@` - $(do_shell_subst) <$< >$@ + $(AM_V_GEN) $(subst_shell_filter) <$< >$@ $(AM_V_at) chmod +x $@ .pl: Makefile @test -d `dirname $@` || $(MKDIR_P) `dirname $@` - $(do_perl_subst) <$< >$@ + $(AM_V_GEN) $(subst_perl_filter) <$< >$@ $(AM_V_at) chmod +x $@ install-data-local: @@ -1403,6 +1433,9 @@ install-data-local: $(MKDIR_P) $(DESTDIR)$(admindir)/parts $(MKDIR_P) $(DESTDIR)$(admindir)/updates +TEST_VERBOSE ?= 0 +TEST_PARALLEL ?= 1 + # The ":;" works around a Bash 3.2 bug when the output is not writable. $(srcdir)/at/package.m4: $(top_srcdir)/configure.ac :;{ \ diff --git a/src/at/deb-format.at b/src/at/deb-format.at index 13654d4..8c1ec27 100644 --- a/src/at/deb-format.at +++ b/src/at/deb-format.at @@ -198,7 +198,7 @@ m4_define([DPKG_GEN_PKG_DEB_FORMAT_TEMPL], [ dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + DPKG_AR_EXTRACT([pkg-templ.deb]) gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz ]) @@ -224,9 +224,9 @@ DPKG_GEN_PKG_DEB_FORMAT_TEMPL() AT_CHECK([ # Test debian-binary with 2.x versions echo 2.999 >debian-binary -ar qSc pkg-version-2x.deb debian-binary control.tar data.tar -ar t pkg-version-2x.deb -ar x pkg-templ.deb debian-binary +DPKG_AR_GEN([pkg-version-2x.deb], [debian-binary control.tar data.tar]) +DPKG_AR_LIST([pkg-version-2x.deb]) +DPKG_AR_EXTRACT([pkg-templ.deb], [debian-binary]) dpkg-deb -I pkg-version-2x.deb ], [], [debian-binary control.tar @@ -246,9 +246,9 @@ data.tar AT_CHECK([ # Test debian-binary with extra lines echo "extra line" >>debian-binary -ar qSc pkg-magic-extra.deb debian-binary control.tar data.tar -ar t pkg-magic-extra.deb -ar x pkg-templ.deb debian-binary +DPKG_AR_GEN([pkg-magic-extra.deb], [debian-binary control.tar data.tar]) +DPKG_AR_LIST([pkg-magic-extra.deb]) +DPKG_AR_EXTRACT([pkg-templ.deb], [debian-binary]) dpkg-deb -I pkg-magic-extra.deb ], [], [debian-binary control.tar @@ -267,9 +267,8 @@ data.tar AT_CHECK([ # Test missing debian-binary member -cp pkg-templ.deb pkg-missing-magic.deb -ar d pkg-missing-magic.deb debian-binary -ar t pkg-missing-magic.deb +DPKG_AR_GEN([pkg-missing-magic.deb], [control.tar data.tar]) +DPKG_AR_LIST([pkg-missing-magic.deb]) dpkg-deb -I pkg-missing-magic.deb ], [2], [control.tar data.tar @@ -278,9 +277,8 @@ data.tar AT_CHECK([ # Test missing control member -cp pkg-templ.deb pkg-missing-control.deb -ar d pkg-missing-control.deb control.tar -ar t pkg-missing-control.deb +DPKG_AR_GEN([pkg-missing-control.deb], [debian-binary data.tar]) +DPKG_AR_LIST([pkg-missing-control.deb]) dpkg-deb -I pkg-missing-control.deb ], [2], [debian-binary data.tar @@ -289,9 +287,8 @@ data.tar AT_CHECK([ # Test missing data member -cp pkg-templ.deb pkg-missing-data.deb -ar d pkg-missing-data.deb data.tar -ar t pkg-missing-data.deb +DPKG_AR_GEN([pkg-missing-data.deb], [debian-binary control.tar]) +DPKG_AR_LIST([pkg-missing-data.deb]) dpkg-deb -c pkg-missing-data.deb ], [2], [debian-binary control.tar @@ -300,8 +297,8 @@ control.tar AT_CHECK([ # Test duplicate debian-binary member -ar qSc pkg-duplicate-magic.deb debian-binary debian-binary control.tar data.tar -ar t pkg-duplicate-magic.deb +DPKG_AR_GEN([pkg-duplicate-magic.deb], [debian-binary debian-binary control.tar data.tar]) +DPKG_AR_LIST([pkg-duplicate-magic.deb]) dpkg-deb -I pkg-duplicate-magic.deb ], [2], [debian-binary debian-binary @@ -312,8 +309,8 @@ data.tar AT_CHECK([ # Test duplicate control member -ar qSc pkg-duplicate-control.deb debian-binary control.tar control.tar data.tar -ar t pkg-duplicate-control.deb +DPKG_AR_GEN([pkg-duplicate-control.deb], [debian-binary control.tar control.tar data.tar]) +DPKG_AR_LIST([pkg-duplicate-control.deb]) dpkg-deb -c pkg-duplicate-control.deb ], [2], [debian-binary control.tar @@ -324,8 +321,8 @@ data.tar AT_CHECK([ # Test mixed member (index 1) -ar qSc pkg-mixed-1-member.deb debian-binary unknown control.tar data.tar -ar t pkg-mixed-1-member.deb +DPKG_AR_GEN([pkg-mixed-1-member.deb], [debian-binary unknown control.tar data.tar]) +DPKG_AR_LIST([pkg-mixed-1-member.deb]) dpkg-deb -I pkg-mixed-1-member.deb ], [2], [debian-binary unknown @@ -336,8 +333,8 @@ data.tar AT_CHECK([ # Test mixed member (index 2) -ar qSc pkg-mixed-2-member.deb debian-binary control.tar unknown data.tar -ar t pkg-mixed-2-member.deb +DPKG_AR_GEN([pkg-mixed-2-member.deb], [debian-binary control.tar unknown data.tar]) +DPKG_AR_LIST([pkg-mixed-2-member.deb]) dpkg-deb -c pkg-mixed-2-member.deb ], [2], [debian-binary control.tar @@ -348,9 +345,8 @@ data.tar AT_CHECK([ # Test swapped control and data members -cp pkg-templ.deb pkg-swap-members.deb -ar ma data.tar pkg-swap-members.deb control.tar -ar t pkg-swap-members.deb +DPKG_AR_GEN([pkg-swap-members.deb], [debian-binary data.tar control.tar]) +DPKG_AR_LIST([pkg-swap-members.deb]) dpkg-deb -I pkg-swap-members.deb ], [2], [debian-binary data.tar @@ -360,9 +356,8 @@ control.tar AT_CHECK([ # Test extra member -cp pkg-templ.deb pkg-extra-member.deb -ar qS pkg-extra-member.deb unknown -ar t pkg-extra-member.deb +DPKG_AR_GEN([pkg-extra-member.deb], [debian-binary control.tar data.tar unknown]) +DPKG_AR_LIST([pkg-extra-member.deb]) dpkg-deb -I pkg-extra-member.deb ], [], [debian-binary control.tar @@ -383,8 +378,8 @@ unknown AT_DATA([_ignore], []) AT_CHECK([ # Test _ member -ar qSc pkg-under-member.deb debian-binary _ignore control.tar data.tar -ar t pkg-under-member.deb +DPKG_AR_GEN([pkg-under-member.deb], [debian-binary _ignore control.tar data.tar]) +DPKG_AR_LIST([pkg-under-member.deb]) dpkg-deb -I pkg-under-member.deb ], [], [debian-binary _ignore @@ -405,8 +400,8 @@ data.tar AT_CHECK([ # Test data.tar.bad member $PERL -E 'print "\0" x 4096' >data.tar.bad -ar qSc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad -ar t pkg-data-bad.deb +DPKG_AR_GEN([pkg-data-bad.deb], [debian-binary control.tar.gz data.tar.bad]) +DPKG_AR_LIST([pkg-data-bad.deb]) dpkg-deb -c pkg-data-bad.deb ], [2], [debian-binary control.tar.gz @@ -416,8 +411,8 @@ data.tar.bad AT_CHECK([ # Test control.tar member -ar qSc pkg-control-none.deb debian-binary control.tar data.tar -ar t pkg-control-none.deb +DPKG_AR_GEN([pkg-control-none.deb], [debian-binary control.tar data.tar]) +DPKG_AR_LIST([pkg-control-none.deb]) dpkg-deb -I pkg-control-none.deb ], [], [debian-binary control.tar @@ -436,8 +431,8 @@ data.tar AT_CHECK([ # Test data.tar member -ar qSc pkg-data-none.deb debian-binary control.tar.gz data.tar -ar t pkg-data-none.deb +DPKG_AR_GEN([pkg-data-none.deb], [debian-binary control.tar.gz data.tar]) +DPKG_AR_LIST([pkg-data-none.deb]) dpkg-deb -c pkg-data-none.deb ], [], [debian-binary control.tar.gz @@ -449,8 +444,8 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ AT_CHECK([ # Test data.tar.gz member -ar qSc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz -ar t pkg-data-gz.deb +DPKG_AR_GEN([pkg-data-gz.deb], [debian-binary control.tar.gz data.tar.gz]) +DPKG_AR_LIST([pkg-data-gz.deb]) dpkg-deb -c pkg-data-gz.deb ], [], [debian-binary control.tar.gz @@ -461,12 +456,12 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ ]) # Create .deb with non-uniform data.tar/control.tar member compression -ar qSc pkg-mixed-comp.deb debian-binary control.tar data.tar.gz +DPKG_AR_GEN([pkg-mixed-comp.deb], [debian-binary control.tar data.tar.gz]) DEB_MIXED_COMP_SIZE=$(DPKG_FILE_SIZE([pkg-mixed-comp.deb])) AT_CHECK_UNQUOTED([ # Test non-uniform data.tar/control.tar member compression -ar t pkg-mixed-comp.deb +DPKG_AR_LIST([pkg-mixed-comp.deb]) dpkg-deb -I pkg-mixed-comp.deb dpkg-deb -c pkg-mixed-comp.deb ], [], [debian-binary @@ -517,17 +512,14 @@ AT_SKIP_IF([! command -v xz >/dev/null]) DPKG_GEN_PKG_DEB_FORMAT_TEMPL() AT_CHECK([ # Extract the base members -# 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 +xz -c control.tar >control.tar.xz +xz -c data.tar >data.tar.xz ]) AT_CHECK([ # 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_AR_GEN([pkg-control-xz.deb], [debian-binary control.tar.xz data.tar.xz]) +DPKG_AR_LIST([pkg-control-xz.deb]) dpkg-deb -c pkg-control-xz.deb ], [], [debian-binary control.tar.xz @@ -539,8 +531,8 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ AT_CHECK([ # 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_AR_GEN([pkg-data-xz.deb], [debian-binary control.tar.gz data.tar.xz]) +DPKG_AR_LIST([pkg-data-xz.deb]) dpkg-deb -c pkg-data-xz.deb ], [], [debian-binary control.tar.gz @@ -577,8 +569,8 @@ zstd -c data.tar >data.tar.zst AT_CHECK([ # 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_AR_GEN([pkg-control-zst.deb], [debian-binary control.tar.zst data.tar.zst]) +DPKG_AR_LIST([pkg-control-zst.deb]) dpkg-deb -c pkg-control-zst.deb ], [], [debian-binary control.tar.zst @@ -590,8 +582,8 @@ drwxr-xr-x root/root 0 1970-01-01 00:00 ./ AT_CHECK([ # 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_AR_GEN([pkg-data-zst.deb], [debian-binary control.tar.gz data.tar.zst]) +DPKG_AR_LIST([pkg-data-zst.deb]) dpkg-deb -c pkg-data-zst.deb ], [], [debian-binary control.tar.gz @@ -627,8 +619,8 @@ bzip2 -c data.tar >data.tar.bz2 AT_CHECK([ # 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_AR_GEN([pkg-data-bz2.deb], [debian-binary control.tar.gz data.tar.bz2]) +DPKG_AR_LIST([pkg-data-bz2.deb]) dpkg-deb -c pkg-data-bz2.deb ], [], [debian-binary control.tar.gz @@ -655,8 +647,8 @@ lzma -c data.tar >data.tar.lzma AT_CHECK([ # 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_AR_GEN([pkg-data-lzma.deb], [debian-binary control.tar.gz data.tar.lzma]) +DPKG_AR_LIST([pkg-data-lzma.deb]) dpkg-deb -c pkg-data-lzma.deb ], [], [debian-binary control.tar.gz diff --git a/src/at/deb-split.at b/src/at/deb-split.at index 69e777b..5165bff 100644 --- a/src/at/deb-split.at +++ b/src/at/deb-split.at @@ -26,7 +26,7 @@ dpkg-split -S 210 -s pkg-split.deb pkg-split-part for p in DPKG_SEQ([10]); do test -f pkg-split-part.${p}of10.deb done -ar x pkg-split-part.1of10.deb data.1 +DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [data.1]) ], [], [Splitting package pkg-split into 10 parts: 1 2 3 4 5 6 7 8 9 10 done ]) @@ -41,10 +41,10 @@ DEB_SPLIT_PART_SIZE_VERSION=$((DEB_SPLIT_PART_SIZE + 2)) AT_CHECK_UNQUOTED([ # Test debian-split with 2.x version -ar x pkg-split-part.1of10.deb debian-split +DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [debian-split]) $PERL -p -i -E 's/.*/2.999/ if $. == 1' debian-split -ar qSc pkg-split-part-version-2x.deb debian-split data.1 -ar t pkg-split-part-version-2x.deb +DPKG_AR_GEN([pkg-split-part-version-2x.deb], [debian-split data.1]) +DPKG_AR_LIST([pkg-split-part-version-2x.deb]) dpkg-split -I pkg-split-part-version-2x.deb ], [], [debian-split data.1 @@ -67,10 +67,10 @@ DEB_SPLIT_PART_SIZE_MAGIC_EXTRA=$((DEB_SPLIT_PART_SIZE + 10)) AT_CHECK_UNQUOTED([ # Test debian-split with extra lines -ar x pkg-split-part.1of10.deb debian-split +DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [debian-split]) echo "extra line" >>debian-split -ar qSc pkg-split-part-magic-extra.deb debian-split data.1 -ar t pkg-split-part-magic-extra.deb +DPKG_AR_GEN([pkg-split-part-magic-extra.deb], [debian-split data.1]) +DPKG_AR_LIST([pkg-split-part-magic-extra.deb]) dpkg-split -I pkg-split-part-magic-extra.deb ], [], [debian-split data.1 @@ -91,9 +91,9 @@ pkg-split-part-magic-extra.deb: AT_CHECK([ # Test missing debian-split -cp pkg-split-part.1of10.deb pkg-split-part-missing-magic.deb -ar d pkg-split-part-missing-magic.deb debian-split -ar t pkg-split-part-missing-magic.deb +DPKG_AR_EXTRACT([pkg-split-part.1of10.deb]) +DPKG_AR_GEN([pkg-split-part-missing-magic.deb], [data.1]) +DPKG_AR_LIST([pkg-split-part-missing-magic.deb]) dpkg-split -I pkg-split-part-missing-magic.deb ], [], [data.1 file 'pkg-split-part-missing-magic.deb' is not an archive part @@ -101,9 +101,9 @@ file 'pkg-split-part-missing-magic.deb' is not an archive part AT_CHECK([ # Test missing data part member -cp pkg-split-part.1of10.deb pkg-split-part-missing-data.deb -ar d pkg-split-part-missing-data.deb data.1 -ar t pkg-split-part-missing-data.deb +DPKG_AR_EXTRACT([pkg-split-part.1of10.deb]) +DPKG_AR_GEN([pkg-split-part-missing-data.deb], [debian-split]) +DPKG_AR_LIST([pkg-split-part-missing-data.deb]) dpkg-split -I pkg-split-part-missing-data.deb ], [2], [debian-split ], [dpkg-split: error: unexpected end of file in reading data part member ar header in pkg-split-part-missing-data.deb @@ -111,9 +111,9 @@ dpkg-split -I pkg-split-part-missing-data.deb AT_CHECK([ # Test duplicate debian-split member -ar x pkg-split-part.1of10.deb debian-split data.1 -ar qSc pkg-split-part-duplicate-magic.deb debian-split debian-split data.1 -ar t pkg-split-part-duplicate-magic.deb +DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [debian-split data.1]) +DPKG_AR_GEN([pkg-split-part-duplicate-magic.deb], [debian-split debian-split data.1]) +DPKG_AR_LIST([pkg-split-part-duplicate-magic.deb]) dpkg-split -I pkg-split-part-duplicate-magic.deb ], [2], [debian-split debian-split @@ -123,10 +123,9 @@ data.1 AT_CHECK_UNQUOTED([ # Test unknown extra member -cp pkg-split-part.1of10.deb pkg-split-part-extra-member.deb echo "some content" >unknown -ar qS pkg-split-part-extra-member.deb unknown -ar t pkg-split-part-extra-member.deb +DPKG_AR_GEN([pkg-split-part-extra-member.deb], [debian-split data.1 unknown]) +DPKG_AR_LIST([pkg-split-part-extra-member.deb]) dpkg-split -I pkg-split-part-extra-member.deb ], [], [debian-split data.1 diff --git a/src/at/divert.at b/src/at/divert.at index 667ccaf..031728a 100644 --- a/src/at/divert.at +++ b/src/at/divert.at @@ -171,7 +171,7 @@ AT_CHECK([DPKG_DIVERT --rename --add /testdir/foo], [], [stdout]) AT_CHECK([$GREP -q "Adding.*local.*diversion.* /testdir/foo.* /testdir/foo.distrib" stdout]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -189,7 +189,7 @@ AT_CHECK([DPKG_DIVERT --no-rename --add /testdir/foo], [], [stdout]) AT_CHECK([$GREP -q "Adding.*local.*diversion.* /testdir/foo.* /testdir/foo.distrib" stdout]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -206,7 +206,7 @@ AT_DATA([ref-diversions], [/testdir/foo AT_CHECK([DPKG_DIVERT --quiet --rename --add /testdir/foo]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -236,7 +236,7 @@ AT_DATA([ref-diversions], [/testdir/foo AT_CHECK([DPKG_DIVERT --quiet --rename /testdir/foo]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -253,7 +253,7 @@ AT_DATA([ref-diversions], [/testdir/foo AT_CHECK([DPKG_DIVERT --quiet --local --rename /testdir/foo]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -267,7 +267,7 @@ bash ]) AT_CHECK([DPKG_DIVERT --quiet --rename --package bash /testdir/foo]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -285,7 +285,7 @@ AT_DATA([ref-diversions], [/testdir/foo AT_CHECK([DPKG_DIVERT --quiet --rename /testdir/foo]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -312,7 +312,7 @@ AT_DATA([ref-diversions], [/testdir/zoo/foo ]) AT_CHECK([DPKG_DIVERT --quiet --rename --add /testdir/zoo/foo]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -440,7 +440,7 @@ coreutils AT_CHECK([DPKG_DIVERT --quiet --rename --package coreutils --add /testdir/foo]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -487,7 +487,7 @@ AT_CHECK([DPKG_DIVERT --rename --divert /testdir/foo.distrib --remove /testdir/f [], [stdout]) AT_CHECK([$EGREP -q 'Removing .*/testdir/foo' stdout]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -510,7 +510,7 @@ AT_CHECK([DPKG_DIVERT --quiet --no-rename --add /testdir/baz]) AT_CHECK([DPKG_DIVERT --no-rename --remove /testdir/bar], [], [stdout]) AT_CHECK([$EGREP -q 'Removing .* /testdir/bar' stdout]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -532,7 +532,7 @@ AT_CHECK([DPKG_DIVERT --quiet --no-rename --package bash /testdir/baz]) AT_CHECK([DPKG_DIVERT --no-rename --quiet --package bash --remove /testdir/baz]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CLEANUP @@ -552,7 +552,7 @@ AT_CHECK([DPKG_DIVERT --test --rename --remove /testdir/foo], [], [stdout]) AT_CHECK([$GREP -q 'Removing .*/testdir/foo' stdout]) DPKG_CHECK_FSYS_PATH_MISSING([/testdir/foo]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo.distrib]) -AT_CHECK([diff -u ref-diversions DPKG_DIR_ADMIN/diversions]) +DPKG_CHECK_DIFF([DPKG_DIR_ADMIN/diversions], [ref-diversions]) AT_CHECK([DPKG_DIVERT --quiet --rename --remove /testdir/foo]) DPKG_CHECK_FSYS_PATH_EXISTS([/testdir/foo]) diff --git a/src/at/local.at b/src/at/local.at index a49311c..8f5fc88 100644 --- a/src/at/local.at +++ b/src/at/local.at @@ -52,6 +52,32 @@ m4_define([DPKG_FILE_SIZE], [ $PERL -E 'say -s shift' "$1" dnl ]) +# DPKG_AR() +m4_define([DPKG_AR], [dnl + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl dnl +]) + +# DPKG_AR_GEN() +m4_define([DPKG_AR_GEN], [ + DPKG_AR --create $1 $2 +]) + +# DPKG_AR_LIST() +m4_define([DPKG_AR_LIST], [ + DPKG_AR --list $1 +]) + +# DPKG_AR_EXTRACT() +m4_define([DPKG_AR_EXTRACT], [ + DPKG_AR --extract $1 $2 +]) + +# DPKG_CHECK_DIFF($file_out, $file_exp) +m4_define([DPKG_CHECK_DIFF], [ + cp "$2" expout + AT_CHECK([cat "$1"], [], [expout]) +]) + # DPKG_GEN_FSYS() m4_define([DPKG_GEN_DB], [ mkdir -p DPKG_DIR_INST diff --git a/src/at/package.m4 b/src/at/package.m4 index e581dd3..46b2384 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.6]) -m4_define([AT_PACKAGE_STRING], [dpkg 1.22.6]) +m4_define([AT_PACKAGE_VERSION], [1.22.7]) +m4_define([AT_PACKAGE_STRING], [dpkg 1.22.7]) 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 e982e45..c335b8d 100755 --- a/src/at/testsuite +++ b/src/at/testsuite @@ -613,10 +613,10 @@ at_format='??' 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: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; +4;deb-format.at:506;dpkg-deb .deb format 2.x (xz);dpkg-deb deb; +5;deb-format.at:557;dpkg-deb .deb format 2.x (zstd);dpkg-deb deb; +6;deb-format.at:608;dpkg-deb .deb format 2.x (bzip2);dpkg-deb deb; +7;deb-format.at:636;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.6 test suite: dpkg tools functional test suite test groups: +dpkg 1.22.7 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.6)" && + printf "%s\n" "$as_me (dpkg 1.22.7)" && 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.6 test suite: dpkg tools functional test suite. ## +## dpkg 1.22.7 test suite: dpkg tools functional test suite. ## ## --------------------------------------------------------- ##" { printf "%s\n" "## --------------------------------------------------------- ## -## dpkg 1.22.6 test suite: dpkg tools functional test suite. ## +## dpkg 1.22.7 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.6] $as_me: $at_msg1$at_msg2 + Subject: [dpkg 1.22.7] $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 @@ -2660,7 +2660,9 @@ printf "%s\n" "$at_srcdir/deb-format.at:222: dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-templ.deb + gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz " @@ -2675,7 +2677,9 @@ at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:222" dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-templ.deb + gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz @@ -2694,18 +2698,30 @@ $at_traceon; } printf "%s\n" "$at_srcdir/deb-format.at:224: # Test debian-binary with 2.x versions echo 2.999 >debian-binary -ar qSc pkg-version-2x.deb debian-binary control.tar data.tar -ar t pkg-version-2x.deb -ar x pkg-templ.deb debian-binary + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-version-2x.deb debian-binary control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-version-2x.deb + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-templ.deb debian-binary + dpkg-deb -I pkg-version-2x.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:224" ( $at_check_trace; # Test debian-binary with 2.x versions echo 2.999 >debian-binary -ar qSc pkg-version-2x.deb debian-binary control.tar data.tar -ar t pkg-version-2x.deb -ar x pkg-templ.deb debian-binary + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-version-2x.deb debian-binary control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-version-2x.deb + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-templ.deb debian-binary + dpkg-deb -I pkg-version-2x.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2736,18 +2752,30 @@ $at_traceon; } printf "%s\n" "$at_srcdir/deb-format.at:246: # Test debian-binary with extra lines echo \"extra line\" >>debian-binary -ar qSc pkg-magic-extra.deb debian-binary control.tar data.tar -ar t pkg-magic-extra.deb -ar x pkg-templ.deb debian-binary + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-magic-extra.deb debian-binary control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-magic-extra.deb + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-templ.deb debian-binary + dpkg-deb -I pkg-magic-extra.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:246" ( $at_check_trace; # Test debian-binary with extra lines echo "extra line" >>debian-binary -ar qSc pkg-magic-extra.deb debian-binary control.tar data.tar -ar t pkg-magic-extra.deb -ar x pkg-templ.deb debian-binary + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-magic-extra.deb debian-binary control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-magic-extra.deb + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-templ.deb debian-binary + dpkg-deb -I pkg-magic-extra.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2777,17 +2805,23 @@ $at_traceon; } { set +x printf "%s\n" "$at_srcdir/deb-format.at:268: # Test missing debian-binary member -cp pkg-templ.deb pkg-missing-magic.deb -ar d pkg-missing-magic.deb debian-binary -ar t pkg-missing-magic.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-missing-magic.deb control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-missing-magic.deb + dpkg-deb -I pkg-missing-magic.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:268" ( $at_check_trace; # Test missing debian-binary member -cp pkg-templ.deb pkg-missing-magic.deb -ar d pkg-missing-magic.deb debian-binary -ar t pkg-missing-magic.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-missing-magic.deb control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-missing-magic.deb + dpkg-deb -I pkg-missing-magic.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2806,19 +2840,25 @@ $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:279: +printf "%s\n" "$at_srcdir/deb-format.at:278: # Test missing control member -cp pkg-templ.deb pkg-missing-control.deb -ar d pkg-missing-control.deb control.tar -ar t pkg-missing-control.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-missing-control.deb debian-binary data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-missing-control.deb + dpkg-deb -I pkg-missing-control.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:279" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:278" ( $at_check_trace; # Test missing control member -cp pkg-templ.deb pkg-missing-control.deb -ar d pkg-missing-control.deb control.tar -ar t pkg-missing-control.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-missing-control.deb debian-binary data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-missing-control.deb + dpkg-deb -I pkg-missing-control.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2831,25 +2871,31 @@ echo >>"$at_stdout"; printf "%s\n" "debian-binary data.tar " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:279" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:278" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:290: +printf "%s\n" "$at_srcdir/deb-format.at:288: # Test missing data member -cp pkg-templ.deb pkg-missing-data.deb -ar d pkg-missing-data.deb data.tar -ar t pkg-missing-data.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-missing-data.deb debian-binary control.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-missing-data.deb + dpkg-deb -c pkg-missing-data.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:290" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:288" ( $at_check_trace; # Test missing data member -cp pkg-templ.deb pkg-missing-data.deb -ar d pkg-missing-data.deb data.tar -ar t pkg-missing-data.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-missing-data.deb debian-binary control.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-missing-data.deb + dpkg-deb -c pkg-missing-data.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2862,23 +2908,31 @@ echo >>"$at_stdout"; printf "%s\n" "debian-binary control.tar " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:290" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:288" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:301: +printf "%s\n" "$at_srcdir/deb-format.at:298: # Test duplicate debian-binary member -ar qSc pkg-duplicate-magic.deb debian-binary debian-binary control.tar data.tar -ar t pkg-duplicate-magic.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-duplicate-magic.deb debian-binary debian-binary control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-duplicate-magic.deb + dpkg-deb -I pkg-duplicate-magic.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:301" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:298" ( $at_check_trace; # Test duplicate debian-binary member -ar qSc pkg-duplicate-magic.deb debian-binary debian-binary control.tar data.tar -ar t pkg-duplicate-magic.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-duplicate-magic.deb debian-binary debian-binary control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-duplicate-magic.deb + dpkg-deb -I pkg-duplicate-magic.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2893,23 +2947,31 @@ control.tar data.tar " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:301" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:298" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:313: +printf "%s\n" "$at_srcdir/deb-format.at:310: # Test duplicate control member -ar qSc pkg-duplicate-control.deb debian-binary control.tar control.tar data.tar -ar t pkg-duplicate-control.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-duplicate-control.deb debian-binary control.tar control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-duplicate-control.deb + dpkg-deb -c pkg-duplicate-control.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:313" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:310" ( $at_check_trace; # Test duplicate control member -ar qSc pkg-duplicate-control.deb debian-binary control.tar control.tar data.tar -ar t pkg-duplicate-control.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-duplicate-control.deb debian-binary control.tar control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-duplicate-control.deb + dpkg-deb -c pkg-duplicate-control.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2924,23 +2986,31 @@ control.tar data.tar " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:313" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:310" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:325: +printf "%s\n" "$at_srcdir/deb-format.at:322: # Test mixed member (index 1) -ar qSc pkg-mixed-1-member.deb debian-binary unknown control.tar data.tar -ar t pkg-mixed-1-member.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-mixed-1-member.deb debian-binary unknown control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-mixed-1-member.deb + dpkg-deb -I pkg-mixed-1-member.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:325" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:322" ( $at_check_trace; # Test mixed member (index 1) -ar qSc pkg-mixed-1-member.deb debian-binary unknown control.tar data.tar -ar t pkg-mixed-1-member.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-mixed-1-member.deb debian-binary unknown control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-mixed-1-member.deb + dpkg-deb -I pkg-mixed-1-member.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2955,23 +3025,31 @@ control.tar data.tar " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:325" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:322" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:337: +printf "%s\n" "$at_srcdir/deb-format.at:334: # Test mixed member (index 2) -ar qSc pkg-mixed-2-member.deb debian-binary control.tar unknown data.tar -ar t pkg-mixed-2-member.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-mixed-2-member.deb debian-binary control.tar unknown data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-mixed-2-member.deb + dpkg-deb -c pkg-mixed-2-member.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:337" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:334" ( $at_check_trace; # Test mixed member (index 2) -ar qSc pkg-mixed-2-member.deb debian-binary control.tar unknown data.tar -ar t pkg-mixed-2-member.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-mixed-2-member.deb debian-binary control.tar unknown data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-mixed-2-member.deb + dpkg-deb -c pkg-mixed-2-member.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -2986,25 +3064,31 @@ unknown data.tar " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:337" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:334" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:349: +printf "%s\n" "$at_srcdir/deb-format.at:346: # Test swapped control and data members -cp pkg-templ.deb pkg-swap-members.deb -ar ma data.tar pkg-swap-members.deb control.tar -ar t pkg-swap-members.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-swap-members.deb debian-binary data.tar control.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-swap-members.deb + dpkg-deb -I pkg-swap-members.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:349" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:346" ( $at_check_trace; # Test swapped control and data members -cp pkg-templ.deb pkg-swap-members.deb -ar ma data.tar pkg-swap-members.deb control.tar -ar t pkg-swap-members.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-swap-members.deb debian-binary data.tar control.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-swap-members.deb + dpkg-deb -I pkg-swap-members.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3018,25 +3102,31 @@ data.tar control.tar " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:349" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:346" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:361: +printf "%s\n" "$at_srcdir/deb-format.at:357: # Test extra member -cp pkg-templ.deb pkg-extra-member.deb -ar qS pkg-extra-member.deb unknown -ar t pkg-extra-member.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-extra-member.deb debian-binary control.tar data.tar unknown + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-extra-member.deb + dpkg-deb -I pkg-extra-member.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:361" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:357" ( $at_check_trace; # Test extra member -cp pkg-templ.deb pkg-extra-member.deb -ar qS pkg-extra-member.deb unknown -ar t pkg-extra-member.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-extra-member.deb debian-binary control.tar data.tar unknown + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-extra-member.deb + dpkg-deb -I pkg-extra-member.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3059,24 +3149,32 @@ unknown Description: test package - deb format support " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:361" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:357" $at_failed && at_fn_log_failure $at_traceon; } : >_ignore { set +x -printf "%s\n" "$at_srcdir/deb-format.at:384: +printf "%s\n" "$at_srcdir/deb-format.at:379: # Test _ member -ar qSc pkg-under-member.deb debian-binary _ignore control.tar data.tar -ar t pkg-under-member.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-under-member.deb debian-binary _ignore control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-under-member.deb + dpkg-deb -I pkg-under-member.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:384" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:379" ( $at_check_trace; # Test _ member -ar qSc pkg-under-member.deb debian-binary _ignore control.tar data.tar -ar t pkg-under-member.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-under-member.deb debian-binary _ignore control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-under-member.deb + dpkg-deb -I pkg-under-member.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3099,25 +3197,33 @@ data.tar Description: test package - deb format support " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:384" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:379" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:405: +printf "%s\n" "$at_srcdir/deb-format.at:400: # Test data.tar.bad member \$PERL -E 'print \"\\0\" x 4096' >data.tar.bad -ar qSc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad -ar t pkg-data-bad.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-data-bad.deb + dpkg-deb -c pkg-data-bad.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:405" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:400" ( $at_check_trace; # Test data.tar.bad member $PERL -E 'print "\0" x 4096' >data.tar.bad -ar qSc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad -ar t pkg-data-bad.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-data-bad.deb + dpkg-deb -c pkg-data-bad.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3131,23 +3237,31 @@ control.tar.gz data.tar.bad " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:405" +at_fn_check_status 2 $at_status "$at_srcdir/deb-format.at:400" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:417: +printf "%s\n" "$at_srcdir/deb-format.at:412: # Test control.tar member -ar qSc pkg-control-none.deb debian-binary control.tar data.tar -ar t pkg-control-none.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-control-none.deb debian-binary control.tar data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-control-none.deb + dpkg-deb -I pkg-control-none.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:417" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:412" ( $at_check_trace; # Test control.tar member -ar qSc pkg-control-none.deb debian-binary control.tar data.tar -ar t pkg-control-none.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-control-none.deb debian-binary control.tar data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-control-none.deb + dpkg-deb -I pkg-control-none.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3169,23 +3283,31 @@ data.tar Description: test package - deb format support " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:417" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:412" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:437: +printf "%s\n" "$at_srcdir/deb-format.at:432: # Test data.tar member -ar qSc pkg-data-none.deb debian-binary control.tar.gz data.tar -ar t pkg-data-none.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-data-none.deb debian-binary control.tar.gz data.tar + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-data-none.deb + dpkg-deb -c pkg-data-none.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:437" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:432" ( $at_check_trace; # Test data.tar member -ar qSc pkg-data-none.deb debian-binary control.tar.gz data.tar -ar t pkg-data-none.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-data-none.deb debian-binary control.tar.gz data.tar + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-data-none.deb + dpkg-deb -c pkg-data-none.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3200,23 +3322,31 @@ 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:437" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:432" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:450: +printf "%s\n" "$at_srcdir/deb-format.at:445: # Test data.tar.gz member -ar qSc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz -ar t pkg-data-gz.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-data-gz.deb + dpkg-deb -c pkg-data-gz.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:450" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:445" ( $at_check_trace; # Test data.tar.gz member -ar qSc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz -ar t pkg-data-gz.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-data-gz.deb + dpkg-deb -c pkg-data-gz.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3231,27 +3361,33 @@ 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:450" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:445" $at_failed && at_fn_log_failure $at_traceon; } # Create .deb with non-uniform data.tar/control.tar member compression -ar qSc pkg-mixed-comp.deb debian-binary control.tar data.tar.gz + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-mixed-comp.deb debian-binary control.tar data.tar.gz + DEB_MIXED_COMP_SIZE=$( $PERL -E 'say -s shift' "pkg-mixed-comp.deb" ) { set +x -printf "%s\n" "$at_srcdir/deb-format.at:467: +printf "%s\n" "$at_srcdir/deb-format.at:462: # Test non-uniform data.tar/control.tar member compression -ar t pkg-mixed-comp.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-mixed-comp.deb + dpkg-deb -I pkg-mixed-comp.deb dpkg-deb -c pkg-mixed-comp.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:467" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:462" ( $at_check_trace; # Test non-uniform data.tar/control.tar member compression -ar t pkg-mixed-comp.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-mixed-comp.deb + dpkg-deb -I pkg-mixed-comp.deb dpkg-deb -c pkg-mixed-comp.deb @@ -3277,13 +3413,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:467" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:462" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:490: +printf "%s\n" "$at_srcdir/deb-format.at:485: # Test building and extracting none compressed archive dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ pkg-comp-none.deb >/dev/null dpkg-deb --ctrl-tarfile pkg-comp-none.deb >ctrl-none.tar @@ -3291,7 +3427,7 @@ dpkg-deb --fsys-tarfile pkg-comp-none.deb >fsys-none.tar cmp ctrl-none.tar control.tar cmp fsys-none.tar data.tar " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:490" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:485" ( $at_check_trace; # Test building and extracting none compressed archive dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ pkg-comp-none.deb >/dev/null @@ -3305,13 +3441,13 @@ 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:490" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:485" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:499: +printf "%s\n" "$at_srcdir/deb-format.at:494: # Test building and extracting gzip compressed archive dpkg-deb --uniform-compression --root-owner-group -Zgzip -b pkg-templ pkg-comp-gzip.deb >/dev/null dpkg-deb --ctrl-tarfile pkg-comp-gzip.deb >ctrl-gzip.tar @@ -3319,7 +3455,7 @@ dpkg-deb --fsys-tarfile pkg-comp-gzip.deb >fsys-gzip.tar cmp ctrl-gzip.tar control.tar cmp fsys-gzip.tar data.tar " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:499" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:494" ( $at_check_trace; # Test building and extracting gzip compressed archive dpkg-deb --uniform-compression --root-owner-group -Zgzip -b pkg-templ pkg-comp-gzip.deb >/dev/null @@ -3333,7 +3469,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:499" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:494" $at_failed && at_fn_log_failure $at_traceon; } @@ -3344,7 +3480,7 @@ $at_traceon; } read at_status <"$at_status_file" #AT_STOP_3 #AT_START_4 -at_fn_group_banner 4 'deb-format.at:511' \ +at_fn_group_banner 4 'deb-format.at:506' \ "dpkg-deb .deb format 2.x (xz)" " " 1 at_xfail=no ( @@ -3353,12 +3489,12 @@ at_xfail=no -printf "%s\n" "deb-format.at:514" >"$at_check_line_file" +printf "%s\n" "deb-format.at:509" >"$at_check_line_file" (! command -v gzip >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:514" -printf "%s\n" "deb-format.at:515" >"$at_check_line_file" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:509" +printf "%s\n" "deb-format.at:510" >"$at_check_line_file" (! command -v xz >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:515" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:510" @@ -3384,7 +3520,7 @@ test _ATEOF { set +x -printf "%s\n" "$at_srcdir/deb-format.at:517: +printf "%s\n" "$at_srcdir/deb-format.at:512: # Initialize the template package mv pkg-deb-format pkg-templ cp \$top_srcdir/ChangeLog.old pkg-templ/ @@ -3394,11 +3530,13 @@ printf "%s\n" "$at_srcdir/deb-format.at:517: dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-templ.deb + 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:517" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:512" ( $at_check_trace; # Initialize the template package mv pkg-deb-format pkg-templ @@ -3409,7 +3547,9 @@ at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:517" dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-templ.deb + gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz @@ -3418,51 +3558,53 @@ 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:517" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:512" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:518: +printf "%s\n" "$at_srcdir/deb-format.at:513: # Extract the base members -# 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 +xz -c control.tar >control.tar.xz +xz -c data.tar >data.tar.xz " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:518" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:513" ( $at_check_trace; # Extract the base members -# 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 +xz -c control.tar >control.tar.xz +xz -c data.tar >data.tar.xz ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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:518" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:513" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:527: +printf "%s\n" "$at_srcdir/deb-format.at:519: # 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 + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-control-xz.deb + dpkg-deb -c pkg-control-xz.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:527" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:519" ( $at_check_trace; # 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 + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-control-xz.deb + dpkg-deb -c pkg-control-xz.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3477,23 +3619,31 @@ 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:527" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:519" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:540: +printf "%s\n" "$at_srcdir/deb-format.at:532: # 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 + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-data-xz.deb + dpkg-deb -c pkg-data-xz.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:540" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:532" ( $at_check_trace; # 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 + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-data-xz.deb + dpkg-deb -c pkg-data-xz.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3508,13 +3658,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:540" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:532" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:553: +printf "%s\n" "$at_srcdir/deb-format.at:545: # 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 @@ -3522,7 +3672,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:553" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:545" ( $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 @@ -3536,7 +3686,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:553" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:545" $at_failed && at_fn_log_failure $at_traceon; } @@ -3547,7 +3697,7 @@ $at_traceon; } read at_status <"$at_status_file" #AT_STOP_4 #AT_START_5 -at_fn_group_banner 5 'deb-format.at:565' \ +at_fn_group_banner 5 'deb-format.at:557' \ "dpkg-deb .deb format 2.x (zstd)" " " 1 at_xfail=no ( @@ -3556,12 +3706,12 @@ at_xfail=no -printf "%s\n" "deb-format.at:568" >"$at_check_line_file" +printf "%s\n" "deb-format.at:560" >"$at_check_line_file" (! command -v gzip >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:568" -printf "%s\n" "deb-format.at:569" >"$at_check_line_file" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:560" +printf "%s\n" "deb-format.at:561" >"$at_check_line_file" (! command -v zstd >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:569" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:561" @@ -3587,7 +3737,7 @@ test _ATEOF { set +x -printf "%s\n" "$at_srcdir/deb-format.at:571: +printf "%s\n" "$at_srcdir/deb-format.at:563: # Initialize the template package mv pkg-deb-format pkg-templ cp \$top_srcdir/ChangeLog.old pkg-templ/ @@ -3597,11 +3747,13 @@ printf "%s\n" "$at_srcdir/deb-format.at:571: dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-templ.deb + 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:571" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:563" ( $at_check_trace; # Initialize the template package mv pkg-deb-format pkg-templ @@ -3612,7 +3764,9 @@ at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:571" dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-templ.deb + gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz @@ -3621,18 +3775,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:571" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:563" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:572: +printf "%s\n" "$at_srcdir/deb-format.at:564: # 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:572" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:564" ( $at_check_trace; # Extract the base members zstd -c control.tar >control.tar.zst @@ -3643,23 +3797,31 @@ 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:572" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:564" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:578: +printf "%s\n" "$at_srcdir/deb-format.at:570: # 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 + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-control-zst.deb debian-binary control.tar.zst data.tar.zst + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-control-zst.deb + dpkg-deb -c pkg-control-zst.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:578" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:570" ( $at_check_trace; # 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 + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-control-zst.deb debian-binary control.tar.zst data.tar.zst + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-control-zst.deb + dpkg-deb -c pkg-control-zst.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3674,23 +3836,31 @@ 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:578" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:570" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:591: +printf "%s\n" "$at_srcdir/deb-format.at:583: # 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 + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-data-zst.deb debian-binary control.tar.gz data.tar.zst + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-data-zst.deb + dpkg-deb -c pkg-data-zst.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:591" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:583" ( $at_check_trace; # 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 + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-data-zst.deb debian-binary control.tar.gz data.tar.zst + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-data-zst.deb + dpkg-deb -c pkg-data-zst.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3705,13 +3875,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:591" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:583" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:604: +printf "%s\n" "$at_srcdir/deb-format.at:596: # 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 @@ -3719,7 +3889,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:604" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:596" ( $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 @@ -3733,7 +3903,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:604" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:596" $at_failed && at_fn_log_failure $at_traceon; } @@ -3744,7 +3914,7 @@ $at_traceon; } read at_status <"$at_status_file" #AT_STOP_5 #AT_START_6 -at_fn_group_banner 6 'deb-format.at:616' \ +at_fn_group_banner 6 'deb-format.at:608' \ "dpkg-deb .deb format 2.x (bzip2)" " " 1 at_xfail=no ( @@ -3753,12 +3923,12 @@ at_xfail=no -printf "%s\n" "deb-format.at:619" >"$at_check_line_file" +printf "%s\n" "deb-format.at:611" >"$at_check_line_file" (! command -v gzip >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:619" -printf "%s\n" "deb-format.at:620" >"$at_check_line_file" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:611" +printf "%s\n" "deb-format.at:612" >"$at_check_line_file" (! command -v bzip2 >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:620" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:612" @@ -3784,7 +3954,7 @@ test _ATEOF { set +x -printf "%s\n" "$at_srcdir/deb-format.at:622: +printf "%s\n" "$at_srcdir/deb-format.at:614: # Initialize the template package mv pkg-deb-format pkg-templ cp \$top_srcdir/ChangeLog.old pkg-templ/ @@ -3794,11 +3964,13 @@ printf "%s\n" "$at_srcdir/deb-format.at:622: dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-templ.deb + 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:622" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:614" ( $at_check_trace; # Initialize the template package mv pkg-deb-format pkg-templ @@ -3809,7 +3981,9 @@ at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:622" dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-templ.deb + gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz @@ -3818,17 +3992,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:622" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:614" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:623: +printf "%s\n" "$at_srcdir/deb-format.at:615: # Extract the base members bzip2 -c data.tar >data.tar.bz2 " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:623" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:615" ( $at_check_trace; # Extract the base members bzip2 -c data.tar >data.tar.bz2 @@ -3838,23 +4012,31 @@ 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:623" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:615" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:628: +printf "%s\n" "$at_srcdir/deb-format.at:620: # 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 + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-data-bz2.deb + dpkg-deb -c pkg-data-bz2.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:628" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:620" ( $at_check_trace; # 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 + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-data-bz2.deb + dpkg-deb -c pkg-data-bz2.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -3869,7 +4051,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:628" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:620" $at_failed && at_fn_log_failure $at_traceon; } @@ -3880,7 +4062,7 @@ $at_traceon; } read at_status <"$at_status_file" #AT_STOP_6 #AT_START_7 -at_fn_group_banner 7 'deb-format.at:644' \ +at_fn_group_banner 7 'deb-format.at:636' \ "dpkg-deb .deb format 2.x (lzma)" " " 1 at_xfail=no ( @@ -3889,12 +4071,12 @@ at_xfail=no -printf "%s\n" "deb-format.at:647" >"$at_check_line_file" +printf "%s\n" "deb-format.at:639" >"$at_check_line_file" (! command -v gzip >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:647" -printf "%s\n" "deb-format.at:648" >"$at_check_line_file" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:639" +printf "%s\n" "deb-format.at:640" >"$at_check_line_file" (! command -v lzma >/dev/null) \ - && at_fn_check_skip 77 "$at_srcdir/deb-format.at:648" + && at_fn_check_skip 77 "$at_srcdir/deb-format.at:640" @@ -3920,7 +4102,7 @@ test _ATEOF { set +x -printf "%s\n" "$at_srcdir/deb-format.at:650: +printf "%s\n" "$at_srcdir/deb-format.at:642: # Initialize the template package mv pkg-deb-format pkg-templ cp \$top_srcdir/ChangeLog.old pkg-templ/ @@ -3930,11 +4112,13 @@ printf "%s\n" "$at_srcdir/deb-format.at:650: dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-templ.deb + 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:650" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:642" ( $at_check_trace; # Initialize the template package mv pkg-deb-format pkg-templ @@ -3945,7 +4129,9 @@ at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:650" dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null # Extract the base members - ar x pkg-templ.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-templ.deb + gzip -cn control.tar >control.tar.gz gzip -cn data.tar >data.tar.gz @@ -3954,17 +4140,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:650" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:642" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:651: +printf "%s\n" "$at_srcdir/deb-format.at:643: # Extract the base members lzma -c data.tar >data.tar.lzma " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:651" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:643" ( $at_check_trace; # Extract the base members lzma -c data.tar >data.tar.lzma @@ -3974,23 +4160,31 @@ 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:651" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:643" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-format.at:656: +printf "%s\n" "$at_srcdir/deb-format.at:648: # 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 + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-data-lzma.deb + dpkg-deb -c pkg-data-lzma.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:656" +at_fn_check_prepare_notrace 'an embedded newline' "deb-format.at:648" ( $at_check_trace; # 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 + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-data-lzma.deb + dpkg-deb -c pkg-data-lzma.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -4005,7 +4199,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:656" +at_fn_check_status 0 $at_status "$at_srcdir/deb-format.at:648" $at_failed && at_fn_log_failure $at_traceon; } @@ -4883,7 +5077,9 @@ dpkg-split -S 210 -s pkg-split.deb pkg-split-part for p in 1 2 3 4 5 6 7 8 9 10 ; do test -f pkg-split-part.\${p}of10.deb done -ar x pkg-split-part.1of10.deb data.1 + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb data.1 + " at_fn_check_prepare_notrace 'a ${...} parameter expansion' "deb-split.at:23" ( $at_check_trace; @@ -4892,7 +5088,9 @@ dpkg-split -S 210 -s pkg-split.deb pkg-split-part for p in 1 2 3 4 5 6 7 8 9 10 ; do test -f pkg-split-part.${p}of10.deb done -ar x pkg-split-part.1of10.deb data.1 + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb data.1 + ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false @@ -4918,19 +5116,31 @@ DEB_SPLIT_PART_SIZE_VERSION=$((DEB_SPLIT_PART_SIZE + 2)) { set +x printf "%s\n" "$at_srcdir/deb-split.at:42: # Test debian-split with 2.x version -ar x pkg-split-part.1of10.deb debian-split + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb debian-split + \$PERL -p -i -E 's/.*/2.999/ if \$. == 1' debian-split -ar qSc pkg-split-part-version-2x.deb debian-split data.1 -ar t pkg-split-part-version-2x.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-split-part-version-2x.deb debian-split data.1 + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-split-part-version-2x.deb + dpkg-split -I pkg-split-part-version-2x.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:42" ( $at_check_trace; # Test debian-split with 2.x version -ar x pkg-split-part.1of10.deb debian-split + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb debian-split + $PERL -p -i -E 's/.*/2.999/ if $. == 1' debian-split -ar qSc pkg-split-part-version-2x.deb debian-split data.1 -ar t pkg-split-part-version-2x.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-split-part-version-2x.deb debian-split data.1 + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-split-part-version-2x.deb + dpkg-split -I pkg-split-part-version-2x.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -4964,19 +5174,31 @@ DEB_SPLIT_PART_SIZE_MAGIC_EXTRA=$((DEB_SPLIT_PART_SIZE + 10)) { set +x printf "%s\n" "$at_srcdir/deb-split.at:68: # Test debian-split with extra lines -ar x pkg-split-part.1of10.deb debian-split + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb debian-split + echo \"extra line\" >>debian-split -ar qSc pkg-split-part-magic-extra.deb debian-split data.1 -ar t pkg-split-part-magic-extra.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-split-part-magic-extra.deb debian-split data.1 + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-split-part-magic-extra.deb + dpkg-split -I pkg-split-part-magic-extra.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:68" ( $at_check_trace; # Test debian-split with extra lines -ar x pkg-split-part.1of10.deb debian-split + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb debian-split + echo "extra line" >>debian-split -ar qSc pkg-split-part-magic-extra.deb debian-split data.1 -ar t pkg-split-part-magic-extra.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-split-part-magic-extra.deb debian-split data.1 + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-split-part-magic-extra.deb + dpkg-split -I pkg-split-part-magic-extra.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -5008,17 +5230,29 @@ $at_traceon; } { set +x printf "%s\n" "$at_srcdir/deb-split.at:92: # Test missing debian-split -cp pkg-split-part.1of10.deb pkg-split-part-missing-magic.deb -ar d pkg-split-part-missing-magic.deb debian-split -ar t pkg-split-part-missing-magic.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-split-part-missing-magic.deb data.1 + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-split-part-missing-magic.deb + dpkg-split -I pkg-split-part-missing-magic.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:92" ( $at_check_trace; # Test missing debian-split -cp pkg-split-part.1of10.deb pkg-split-part-missing-magic.deb -ar d pkg-split-part-missing-magic.deb debian-split -ar t pkg-split-part-missing-magic.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-split-part-missing-magic.deb data.1 + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-split-part-missing-magic.deb + dpkg-split -I pkg-split-part-missing-magic.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -5037,17 +5271,29 @@ $at_traceon; } { set +x printf "%s\n" "$at_srcdir/deb-split.at:102: # Test missing data part member -cp pkg-split-part.1of10.deb pkg-split-part-missing-data.deb -ar d pkg-split-part-missing-data.deb data.1 -ar t pkg-split-part-missing-data.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-split-part-missing-data.deb debian-split + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-split-part-missing-data.deb + dpkg-split -I pkg-split-part-missing-data.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:102" ( $at_check_trace; # Test missing data part member -cp pkg-split-part.1of10.deb pkg-split-part-missing-data.deb -ar d pkg-split-part-missing-data.deb data.1 -ar t pkg-split-part-missing-data.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-split-part-missing-data.deb debian-split + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-split-part-missing-data.deb + dpkg-split -I pkg-split-part-missing-data.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -5067,17 +5313,29 @@ $at_traceon; } { set +x printf "%s\n" "$at_srcdir/deb-split.at:112: # Test duplicate debian-split member -ar x pkg-split-part.1of10.deb debian-split data.1 -ar qSc pkg-split-part-duplicate-magic.deb debian-split debian-split data.1 -ar t pkg-split-part-duplicate-magic.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb debian-split data.1 + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-split-part-duplicate-magic.deb debian-split debian-split data.1 + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-split-part-duplicate-magic.deb + dpkg-split -I pkg-split-part-duplicate-magic.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:112" ( $at_check_trace; # Test duplicate debian-split member -ar x pkg-split-part.1of10.deb debian-split data.1 -ar qSc pkg-split-part-duplicate-magic.deb debian-split debian-split data.1 -ar t pkg-split-part-duplicate-magic.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --extract pkg-split-part.1of10.deb debian-split data.1 + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-split-part-duplicate-magic.deb debian-split debian-split data.1 + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-split-part-duplicate-magic.deb + dpkg-split -I pkg-split-part-duplicate-magic.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -5099,19 +5357,25 @@ $at_traceon; } { set +x printf "%s\n" "$at_srcdir/deb-split.at:124: # Test unknown extra member -cp pkg-split-part.1of10.deb pkg-split-part-extra-member.deb echo \"some content\" >unknown -ar qS pkg-split-part-extra-member.deb unknown -ar t pkg-split-part-extra-member.deb + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --create pkg-split-part-extra-member.deb debian-split data.1 unknown + + + \"\$top_srcdir/build-aux/run-script\" scripts/dpkg-ar.pl --list pkg-split-part-extra-member.deb + dpkg-split -I pkg-split-part-extra-member.deb " at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:124" ( $at_check_trace; # Test unknown extra member -cp pkg-split-part.1of10.deb pkg-split-part-extra-member.deb echo "some content" >unknown -ar qS pkg-split-part-extra-member.deb unknown -ar t pkg-split-part-extra-member.deb + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --create pkg-split-part-extra-member.deb debian-split data.1 unknown + + + "$top_srcdir/build-aux/run-script" scripts/dpkg-ar.pl --list pkg-split-part-extra-member.deb + dpkg-split -I pkg-split-part-extra-member.deb ) >>"$at_stdout" 2>>"$at_stderr" 5>&- @@ -5142,11 +5406,11 @@ $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-split.at:149: +printf "%s\n" "$at_srcdir/deb-split.at:148: # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.1of10.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:149" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:148" ( $at_check_trace; # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.1of10.deb @@ -5170,16 +5434,16 @@ echo >>"$at_stdout"; printf "%s\n" "pkg-split-part.1of10.deb: " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:149" +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:148" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-split.at:166: +printf "%s\n" "$at_srcdir/deb-split.at:165: # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.2of10.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:166" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:165" ( $at_check_trace; # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.2of10.deb @@ -5203,16 +5467,16 @@ echo >>"$at_stdout"; printf "%s\n" "pkg-split-part.2of10.deb: " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:166" +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:165" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-split.at:183: +printf "%s\n" "$at_srcdir/deb-split.at:182: # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.9of10.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:183" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:182" ( $at_check_trace; # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.9of10.deb @@ -5236,16 +5500,16 @@ echo >>"$at_stdout"; printf "%s\n" "pkg-split-part.9of10.deb: " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:183" +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:182" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-split.at:200: +printf "%s\n" "$at_srcdir/deb-split.at:199: # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.10of10.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:200" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:199" ( $at_check_trace; # Test getting information about the split parts (parsing verification) dpkg-split -I pkg-split-part.10of10.deb @@ -5269,18 +5533,18 @@ echo >>"$at_stdout"; printf "%s\n" "pkg-split-part.10of10.deb: " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:200" +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:199" $at_failed && at_fn_log_failure $at_traceon; } { set +x -printf "%s\n" "$at_srcdir/deb-split.at:218: +printf "%s\n" "$at_srcdir/deb-split.at:217: # Test joining the split parts back together dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb cmp pkg-split.deb pkg-joined.deb " -at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:218" +at_fn_check_prepare_notrace 'an embedded newline' "deb-split.at:217" ( $at_check_trace; # Test joining the split parts back together dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb @@ -5293,7 +5557,7 @@ at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Putting package pkg-split together from 10 parts: 1 2 3 4 5 6 7 8 9 10 done " | \ $at_diff - "$at_stdout" || at_failed=: -at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:218" +at_fn_check_status 0 $at_status "$at_srcdir/deb-split.at:217" $at_failed && at_fn_log_failure $at_traceon; } @@ -6857,20 +7121,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:174: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:174: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:174" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:174" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -6957,20 +7224,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:192: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:192: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:192" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:192" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -7044,20 +7314,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:209: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:209: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:209" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:209" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -7211,20 +7484,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:239: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:239: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:239" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:239" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -7298,20 +7574,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:256: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:256: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:256" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:256" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -7351,20 +7630,23 @@ at_fn_check_status 0 $at_status "$at_srcdir/divert.at:269" $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:270: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:270: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:270" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:270" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -7441,20 +7723,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:288: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:288: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:288" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:288" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -7562,20 +7847,23 @@ at_fn_check_status 0 $at_status "$at_srcdir/divert.at:314" $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:315: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:315: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:315" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:315" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -8251,20 +8539,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:443: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:443: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:443" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:443" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -8503,20 +8794,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:490: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:490: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:490" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:490" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -8613,20 +8907,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:513: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:513: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:513" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:513" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -8710,20 +9007,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:535: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:535: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:535" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:535" $at_failed && at_fn_log_failure $at_traceon; } + set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe @@ -8824,20 +9124,23 @@ $at_failed && at_fn_log_failure $at_traceon; } -{ set +x -printf "%s\n" "$at_srcdir/divert.at:555: diff -u ref-diversions dpkgdb/diversions" + + cp "ref-diversions" expout + { set +x +printf "%s\n" "$at_srcdir/divert.at:555: cat \"dpkgdb/diversions\"" at_fn_check_prepare_trace "divert.at:555" -( $at_check_trace; diff -u ref-diversions dpkgdb/diversions +( $at_check_trace; cat "dpkgdb/diversions" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- 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_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/divert.at:555" $at_failed && at_fn_log_failure $at_traceon; } + { set +x printf "%s\n" "$at_srcdir/divert.at:557: dpkg-divert --admindir=dpkgdb --instdir=dpkginst --quiet --rename --remove /testdir/foo" at_fn_check_prepare_trace "divert.at:557" diff --git a/src/common/force.c b/src/common/force.c index c4401f0..992dc93 100644 --- a/src/common/force.c +++ b/src/common/force.c @@ -254,7 +254,6 @@ get_force_string(void) varbuf_add_char(&vb, ','); varbuf_add_str(&vb, fip->name); } - varbuf_end_str(&vb); return varbuf_detach(&vb); } diff --git a/src/common/force.h b/src/common/force.h index c232c7f..c85544b 100644 --- a/src/common/force.h +++ b/src/common/force.h @@ -22,6 +22,8 @@ #ifndef DPKG_FORCE_H #define DPKG_FORCE_H +#include <stdbool.h> + #include <dpkg/dpkg.h> #include <dpkg/options.h> diff --git a/src/common/selinux.c b/src/common/selinux.c index b5d29d8..2b0a8bc 100644 --- a/src/common/selinux.c +++ b/src/common/selinux.c @@ -130,7 +130,7 @@ dpkg_selabel_set_context(const char *matchpath, const char *path, mode_t mode) /* Do nothing if we can't figure out what the context is, or if it has * no context; in which case the default context shall be applied. */ ret = selabel_lookup_raw(sehandle, &scontext, matchpath, mode & S_IFMT); - if (ret == -1 || (ret == 0 && scontext == NULL)) + if (ret < 0 || (ret == 0 && scontext == NULL)) return; ret = lsetfilecon_raw(path, scontext); diff --git a/src/deb/build.c b/src/deb/build.c index 1f0c050..a418dd1 100644 --- a/src/deb/build.c +++ b/src/deb/build.c @@ -544,7 +544,9 @@ parse_timestamp(const char *value) errno = 0; timestamp = strtoimax(value, &end, 10); - if (value == end || *end || errno != 0) + if (value == end || *end) + ohshit(_("unable to parse timestamp '%.255s'"), value); + else if (errno != 0) ohshite(_("unable to parse timestamp '%.255s'"), value); return timestamp; @@ -597,7 +599,7 @@ do_build(const char *const *argv) m_output(stdout, _("<standard output>")); timestamp_str = getenv("SOURCE_DATE_EPOCH"); - if (timestamp_str) + if (str_is_set(timestamp_str)) timestamp = parse_timestamp(timestamp_str); else timestamp = time(NULL); @@ -614,7 +616,7 @@ do_build(const char *const *argv) * unlink our temporary file so others can't mess with it. */ tfbuf = path_make_temp_template("dpkg-deb"); gzfd = mkstemp(tfbuf); - if (gzfd == -1) + if (gzfd < 0) ohshite(_("failed to make temporary file (%s)"), _("control member")); /* Make sure it's gone, the fd will remain until we close it. */ if (unlink(tfbuf)) @@ -686,7 +688,7 @@ do_build(const char *const *argv) * temporary file so others can't mess with it. */ tfbuf = path_make_temp_template("dpkg-deb"); gzfd = mkstemp(tfbuf); - if (gzfd == -1) + if (gzfd < 0) ohshite(_("failed to make temporary file (%s)"), _("data member")); /* Make sure it's gone, the fd will remain until we close it. */ if (unlink(tfbuf)) diff --git a/src/deb/extract.c b/src/deb/extract.c index 8b78a7e..08b2815 100644 --- a/src/deb/extract.c +++ b/src/deb/extract.c @@ -364,7 +364,7 @@ extracthalf(const char *debar, const char *dir, } subproc_reap(c2, _("<decompress>"), SUBPROC_NOPIPE); - if (c1 != -1) + if (c1 >= 0) subproc_reap(c1, _("paste"), 0); if (version.major == 0 && admininfo) { /* Handle the version as a float to preserve the behavior of old code, diff --git a/src/deb/info.c b/src/deb/info.c index 6598663..d2d72cf 100644 --- a/src/deb/info.c +++ b/src/deb/info.c @@ -93,11 +93,11 @@ info_spew(const char *debar, const char *dir, const char *const *argv) varbuf_reset(&controlfile); varbuf_printf(&controlfile, "%s/%s", dir, component); - fd = open(controlfile.buf, O_RDONLY); + fd = open(varbuf_str(&controlfile), O_RDONLY); if (fd >= 0) { if (fd_fd_copy(fd, 1, -1, &err) < 0) ohshit(_("cannot extract control file '%s' from '%s': %s"), - controlfile.buf, debar, err.str); + varbuf_str(&controlfile), debar, err.str); close(fd); } else if (errno == ENOENT) { notice(_("'%.255s' contains no control component '%.255s'"), @@ -159,7 +159,7 @@ info_list(const char *debar, const char *dir) FILE *cc; cdn = scandir(dir, &cdlist, &ilist_select, alphasort); - if (cdn == -1) + if (cdn < 0) ohshite(_("cannot scan directory '%.255s'"), dir); for (n = 0; n < cdn; n++) { @@ -259,12 +259,11 @@ info_field(const char *debar, const char *dir, const char *const *fields, if (arbfield) varbuf_add_arbfield(&str, arbfield, fieldflags); } - varbuf_end_str(&str); if (fieldflags & fw_printheader) - printf("%s", str.buf); + printf("%s", varbuf_str(&str)); else - printf("%s\n", str.buf); + printf("%s\n", varbuf_str(&str)); } m_output(stdout, _("<standard output>")); diff --git a/src/deb/main.c b/src/deb/main.c index 2c53811..b7fe11c 100644 --- a/src/deb/main.c +++ b/src/deb/main.c @@ -26,7 +26,7 @@ #include <sys/wait.h> #include <limits.h> -#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <errno.h> diff --git a/src/divert/main.c b/src/divert/main.c index 23a0cd0..0266abf 100644 --- a/src/divert/main.c +++ b/src/divert/main.c @@ -28,7 +28,7 @@ #include <sys/stat.h> #include <errno.h> -#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <fcntl.h> @@ -147,7 +147,6 @@ file_init(struct file *f, const char *filename) varbuf_add_str(&usefilename, dpkg_fsys_get_dir()); varbuf_add_str(&usefilename, filename); - varbuf_end_str(&usefilename); f->name = varbuf_detach(&usefilename); f->stat_state = FILE_STAT_INVALID; @@ -329,7 +328,7 @@ varbuf_diversion(struct varbuf *str, const char *pkgname, filename, divertto, pkgname); } - return str->buf; + return varbuf_str(str); } static const char * @@ -349,7 +348,7 @@ diversion_current(const char *filename) return varbuf_diversion(&str, opt_pkgname, filename, opt_divertto); } - return str.buf; + return varbuf_str(&str); } static const char * diff --git a/src/dpkg-realpath.sh b/src/dpkg-realpath.sh deleted file mode 100755 index 84438b4..0000000 --- a/src/dpkg-realpath.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/sh -# -# Copyright © 2020 Helmut Grohne <helmut@subdivi.de> -# Copyright © 2020 Guillem Jover <guillem@debian.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# 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 <https://www.gnu.org/licenses/>. - -set -e - -PROGNAME=$(basename "$0") -version="unknown" -EOL="\n" - -PKGDATADIR_DEFAULT=src -PKGDATADIR="${DPKG_DATADIR:-$PKGDATADIR_DEFAULT}" - -# shellcheck source=src/sh/dpkg-error.sh -. "$PKGDATADIR/sh/dpkg-error.sh" - -show_version() -{ - cat <<END -Debian $PROGNAME version $version. - -This is free software; see the GNU General Public License version 2 or -later for copying conditions. There is NO warranty. -END -} - -show_usage() -{ - cat <<END -Usage: $PROGNAME [<option>...] <pathname> - -Options: - -z, --zero end output line with NUL, not newline. - --instdir <directory> set the root directory. - --root <directory> set the root directory. - --version show the version. - -?, --help show this help message. -END -} - -canonicalize() { - local src="$1" - local root="$DPKG_ROOT" - local loop=0 - local result="$root" - local dst - - # Check whether the path is relative and make it absolute otherwise. - if [ "$src" = "${src#/}" ]; then - src="$(pwd)/$src" - src="${src#"$root"}" - fi - - # Remove prefixed slashes. - while [ "$src" != "${src#/}" ]; do - src=${src#/} - done - while [ -n "$src" ]; do - # Get the first directory component. - prefix=${src%%/*} - # Remove the first directory component from src. - src=${src#"$prefix"} - # Remove prefixed slashes. - while [ "$src" != "${src#/}" ]; do - src=${src#/} - done - # Resolve the first directory component. - if [ "$prefix" = . ]; then - # Ignore, stay at the same directory. - : - elif [ "$prefix" = .. ]; then - # Go up one directory. - result=${result%/*} - if [ -n "$root" ] && [ "${result#"$root"}" = "$result" ]; then - result="$root" - fi - elif [ -h "$result/$prefix" ]; then - loop=$((loop + 1)) - if [ "$loop" -gt 25 ]; then - error "too many levels of symbolic links" - fi - # Resolve the symlink within $result. - dst=$(readlink "$result/$prefix") - case "$dst" in - /*) - # Absolute pathname, reset result back to $root. - result=$root - src="$dst${src:+/$src}" - # Remove prefixed slashes. - while [ "$src" != "${src#/}" ]; do - src=${src#/} - done - ;; - *) - # Relative pathname. - src="$dst${src:+/$src}" - ;; - esac - else - # Otherwise append the prefix. - result="$result/$prefix" - fi - done - # We are done, print the resolved pathname, w/o $root. - result="${result#"$root"}" - printf "%s$EOL" "${result:-/}" -} - -setup_colors - -DPKG_ROOT="${DPKG_ROOT:-}" -export DPKG_ROOT - -while [ $# -ne 0 ]; do - case "$1" in - -z|--zero) - EOL="\0" - ;; - --instdir|--root) - shift - DPKG_ROOT=$1 - ;; - --instdir=*) - DPKG_ROOT="${1#--instdir=}" - ;; - --root=*) - DPKG_ROOT="${1#--root=}" - ;; - --version) - show_version - exit 0 - ;; - --help|-\?) - show_usage - exit 0 - ;; - --) - shift - pathname="$1" - ;; - -*) - badusage "unknown option: $1" - ;; - *) - pathname="$1" - ;; - esac - shift -done - -# Normalize root directory. -DPKG_ROOT="${DPKG_ROOT:+$(realpath "$DPKG_ROOT")}" -# Remove default root dir. -if [ "$DPKG_ROOT" = "/" ]; then - DPKG_ROOT="" -fi - -[ -n "$pathname" ] || badusage "missing pathname" -if [ "${pathname#"$DPKG_ROOT"}" != "$pathname" ]; then - error "link '$pathname' includes root prefix '$DPKG_ROOT'" -fi - -canonicalize "$pathname" - -exit 0 diff --git a/src/main/archives.c b/src/main/archives.c index 7e399f9..d7279e1 100644 --- a/src/main/archives.c +++ b/src/main/archives.c @@ -240,7 +240,7 @@ md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash, const char *oldname, &otherpkg->configversion) != 0) continue; for (conff = otherpkg->installed.conffiles; conff; conff = conff->next) { - if (conff->obsolete || conff->remove_on_upgrade) + if (conffile_is_disappearing(conff)) continue; if (strcmp(conff->name, namenode->name) == 0) break; @@ -431,7 +431,6 @@ tarobject_extract(struct tarcontext *tc, struct tar_entry *te, namenodetouse(linknode, tc->pkg, &tc->pkg->available)->name); if (linknode->flags & (FNNF_DEFERRED_RENAME | FNNF_NEW_CONFF)) varbuf_add_str(&hardlinkfn, DPKGNEWEXT); - varbuf_end_str(&hardlinkfn); if (link(hardlinkfn.buf, path)) ohshite(_("error creating hard link '%.255s'"), te->name); namenode->newhash = linknode->newhash; @@ -598,17 +597,14 @@ tarobject_matches(struct tarcontext *tc, void setupfnamevbs(const char *filename) { varbuf_rollback(&fname_state); varbuf_add_str(&fnamevb, filename); - varbuf_end_str(&fnamevb); varbuf_rollback(&fnametmp_state); varbuf_add_str(&fnametmpvb, filename); varbuf_add_str(&fnametmpvb, DPKGTEMPEXT); - varbuf_end_str(&fnametmpvb); varbuf_rollback(&fnamenew_state); varbuf_add_str(&fnamenewvb, filename); varbuf_add_str(&fnamenewvb, DPKGNEWEXT); - varbuf_end_str(&fnamenewvb); debug(dbg_eachfiledetail, "setupvnamevbs main='%s' tmp='%s' new='%s'", fnamevb.buf, fnametmpvb.buf, fnamenewvb.buf); @@ -643,7 +639,6 @@ linktosameexistingdir(const struct tar_entry *ti, const char *fname, varbuf_set_buf(symlinkfn, fname, (lastslash - fname) + 1); } varbuf_add_str(symlinkfn, ti->linkname); - varbuf_end_str(symlinkfn); statr= stat(symlinkfn->buf, &newstab); if (statr) { @@ -892,7 +887,7 @@ tarobject(struct tar_archive *tar, struct tar_entry *ti) for (conff = otherpkg->installed.conffiles; conff; conff = conff->next) { - if (!conff->obsolete) + if (!(conff->flags & CONFFILE_OBSOLETE)) continue; if (strcmp(conff->name, nifd->namenode->name) == 0) break; @@ -1322,7 +1317,6 @@ void check_breaks(struct dependency *dep, struct pkginfo *pkg, return; } - varbuf_end_str(&why); if (fixbydeconf && f_autodeconf) { ensure_package_clientdata(fixbydeconf); @@ -1336,7 +1330,7 @@ void check_breaks(struct dependency *dep, struct pkginfo *pkg, pkg_name(fixbydeconf, pnaw_nonambig), pkgbin_name(pkg, &pkg->available, pnaw_nonambig)); - ok = try_deconfigure_can(fixbydeconf, dep->list, pkg, why.buf); + ok = try_deconfigure_can(fixbydeconf, dep->list, pkg, varbuf_str(&why)); if (ok == 1) { notice(_("yes, will deconfigure %s (broken by %s)"), pkg_name(fixbydeconf, pnaw_nonambig), @@ -1344,7 +1338,8 @@ void check_breaks(struct dependency *dep, struct pkginfo *pkg, } } else { notice(_("regarding %s containing %s:\n%s"), pfilename, - pkgbin_name(pkg, &pkg->available, pnaw_nonambig), why.buf); + pkgbin_name(pkg, &pkg->available, pnaw_nonambig), + varbuf_str(&why)); ok= 0; } varbuf_destroy(&why); @@ -1415,8 +1410,7 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg, continue; if (depisok(pdep->up, &removalwhy, NULL, NULL, false)) continue; - varbuf_end_str(&removalwhy); - if (!try_remove_can(pdep,fixbyrm,removalwhy.buf)) + if (!try_remove_can(pdep, fixbyrm, varbuf_str(&removalwhy))) break; } if (!pdep) { @@ -1432,11 +1426,10 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg, continue; if (depisok(pdep->up, &removalwhy, NULL, NULL, false)) continue; - varbuf_end_str(&removalwhy); notice(_("may have trouble removing %s, as it provides %s ..."), pkg_name(fixbyrm, pnaw_nonambig), providecheck->list->ed->name); - if (!try_remove_can(pdep,fixbyrm,removalwhy.buf)) + if (!try_remove_can(pdep, fixbyrm, varbuf_str(&removalwhy))) goto break_from_both_loops_at_once; } } @@ -1470,9 +1463,9 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg, fixbyrm->clientdata->istobe = PKG_ISTOBE_NORMAL; } } - varbuf_end_str(&conflictwhy); notice(_("regarding %s containing %s:\n%s"), pfilename, - pkgbin_name(pkg, &pkg->available, pnaw_nonambig), conflictwhy.buf); + pkgbin_name(pkg, &pkg->available, pnaw_nonambig), + varbuf_str(&conflictwhy)); if (!force_conflicts(dep->list)) ohshit(_("conflicting packages - not installing %.250s"), pkgbin_name(pkg, &pkg->available, pnaw_nonambig)); diff --git a/src/main/configure.c b/src/main/configure.c index f2c9227..889db11 100644 --- a/src/main/configure.c +++ b/src/main/configure.c @@ -356,7 +356,7 @@ deferred_configure_ghost_conffile(struct pkginfo *pkg, struct conffile *conff) for (otherconff = otherpkg->installed.conffiles; otherconff; otherconff = otherconff->next) { - if (otherconff->obsolete || otherconff->remove_on_upgrade) + if (conffile_is_disappearing(otherconff)) continue; /* Check if we need to propagate the new hash from @@ -379,29 +379,31 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) int useredited, distedited; enum conffopt what; struct stat stab; - struct varbuf cdr = VARBUF_INIT, cdr2 = VARBUF_INIT; - char *cdr2rest; + struct varbuf cdr = VARBUF_INIT; + struct varbuf cdr_new = VARBUF_INIT; + struct varbuf cdr_old = VARBUF_INIT; + struct varbuf cdr_dist = VARBUF_INIT; int rc; usenode = namenodetouse(fsys_hash_find_node(conff->name, FHFF_NO_COPY), pkg, &pkg->installed); rc = conffderef(pkg, &cdr, usenode->name); - if (rc == -1) { + if (rc < 0) { conff->hash = EMPTYHASHFLAG; return; } md5hash(pkg, currenthash, cdr.buf); - varbuf_set_varbuf(&cdr2, &cdr); - /* XXX: Make sure there's enough room for extensions. */ - varbuf_grow(&cdr2, 50); - cdr2rest = cdr2.buf + strlen(cdr.buf); - /* From now on we can just strcpy(cdr2rest, extension); */ + varbuf_set_varbuf(&cdr_new, &cdr); + varbuf_add_str(&cdr_new, DPKGNEWEXT); + varbuf_set_varbuf(&cdr_old, &cdr); + varbuf_add_str(&cdr_old, DPKGOLDEXT); + varbuf_set_varbuf(&cdr_dist, &cdr); + varbuf_add_str(&cdr_dist, DPKGDISTEXT); - strcpy(cdr2rest, DPKGNEWEXT); /* If the .dpkg-new file is no longer there, ignore this one. */ - if (lstat(cdr2.buf, &stab)) { + if (lstat(cdr_new.buf, &stab)) { if (errno == ENOENT) { /* But, sync the conffile hash value from another * package set instance. */ @@ -409,14 +411,14 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) return; } ohshite(_("unable to stat new distributed conffile '%.250s'"), - cdr2.buf); + cdr_new.buf); } - md5hash(pkg, newdisthash, cdr2.buf); + md5hash(pkg, newdisthash, cdr_new.buf); /* Copy the permissions from the installed version to the new * distributed version. */ if (!stat(cdr.buf, &stab)) - file_copy_perms(cdr.buf, cdr2.buf); + file_copy_perms(cdr.buf, cdr_new.buf); else if (errno != ENOENT) ohshite(_("unable to stat current installed conffile '%.250s'"), cdr.buf); @@ -465,60 +467,52 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) "deferred_configure '%s' (= '%s') useredited=%d distedited=%d what=%o", usenode->name, cdr.buf, useredited, distedited, what); - what = promptconfaction(pkg, usenode->name, cdr.buf, cdr2.buf, + what = promptconfaction(pkg, usenode->name, cdr.buf, cdr_new.buf, useredited, distedited, what); switch (what & ~(CFOF_IS_NEW | CFOF_USER_DEL)) { case CFO_KEEP | CFOF_BACKUP: - strcpy(cdr2rest, DPKGOLDEXT); - if (unlink(cdr2.buf) && errno != ENOENT) + if (unlink(cdr_old.buf) && errno != ENOENT) warning(_("%s: failed to remove old backup '%.250s': %s"), - pkg_name(pkg, pnaw_nonambig), cdr2.buf, + pkg_name(pkg, pnaw_nonambig), cdr_old.buf, strerror(errno)); - varbuf_add_str(&cdr, DPKGDISTEXT); - varbuf_end_str(&cdr); - strcpy(cdr2rest, DPKGNEWEXT); trig_path_activate(usenode, pkg); - if (rename(cdr2.buf, cdr.buf)) + if (rename(cdr_new.buf, cdr_dist.buf)) warning(_("%s: failed to rename '%.250s' to '%.250s': %s"), - pkg_name(pkg, pnaw_nonambig), cdr2.buf, cdr.buf, + pkg_name(pkg, pnaw_nonambig), cdr_new.buf, cdr_dist.buf, strerror(errno)); break; case CFO_KEEP: - strcpy(cdr2rest, DPKGNEWEXT); - if (unlink(cdr2.buf)) + if (unlink(cdr_new.buf)) warning(_("%s: failed to remove '%.250s': %s"), - pkg_name(pkg, pnaw_nonambig), cdr2.buf, + pkg_name(pkg, pnaw_nonambig), cdr_new.buf, strerror(errno)); break; case CFO_INSTALL | CFOF_BACKUP: - strcpy(cdr2rest, DPKGDISTEXT); - if (unlink(cdr2.buf) && errno != ENOENT) + if (unlink(cdr_dist.buf) && errno != ENOENT) warning(_("%s: failed to remove old distributed version '%.250s': %s"), - pkg_name(pkg, pnaw_nonambig), cdr2.buf, + pkg_name(pkg, pnaw_nonambig), cdr_dist.buf, strerror(errno)); - strcpy(cdr2rest, DPKGOLDEXT); - if (unlink(cdr2.buf) && errno != ENOENT) + if (unlink(cdr_old.buf) && errno != ENOENT) warning(_("%s: failed to remove '%.250s' (before overwrite): %s"), - pkg_name(pkg, pnaw_nonambig), cdr2.buf, + pkg_name(pkg, pnaw_nonambig), cdr_old.buf, strerror(errno)); if (!(what & CFOF_USER_DEL)) - if (link(cdr.buf, cdr2.buf)) + if (link(cdr.buf, cdr_old.buf)) warning(_("%s: failed to link '%.250s' to '%.250s': %s"), pkg_name(pkg, pnaw_nonambig), cdr.buf, - cdr2.buf, strerror(errno)); + cdr_old.buf, strerror(errno)); /* Fall through. */ case CFO_INSTALL: printf(_("Installing new version of config file %s ...\n"), usenode->name); /* Fall through. */ case CFO_NEW_CONFF: - strcpy(cdr2rest, DPKGNEWEXT); trig_path_activate(usenode, pkg); - if (rename(cdr2.buf, cdr.buf)) + if (rename(cdr_new.buf, cdr.buf)) ohshite(_("unable to install '%.250s' as '%.250s'"), - cdr2.buf, cdr.buf); + cdr_new.buf, cdr.buf); break; default: internerr("unknown conffopt '%d'", what); @@ -528,7 +522,9 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) modstatdb_note(pkg); varbuf_destroy(&cdr); - varbuf_destroy(&cdr2); + varbuf_destroy(&cdr_new); + varbuf_destroy(&cdr_old); + varbuf_destroy(&cdr_dist); } /** @@ -608,15 +604,13 @@ deferred_configure(struct pkginfo *pkg) ok = breakses_ok(pkg, &aemsgs) ? ok : DEP_CHECK_HALT; if (ok == DEP_CHECK_HALT) { sincenothing = 0; - varbuf_end_str(&aemsgs); notice(_("dependency problems prevent configuration of %s:\n%s"), - pkg_name(pkg, pnaw_nonambig), aemsgs.buf); + pkg_name(pkg, pnaw_nonambig), varbuf_str(&aemsgs)); varbuf_destroy(&aemsgs); ohshit(_("dependency problems - leaving unconfigured")); } else if (aemsgs.used) { - varbuf_end_str(&aemsgs); notice(_("%s: dependency problems, but configuring anyway as you requested:\n%s"), - pkg_name(pkg, pnaw_nonambig), aemsgs.buf); + pkg_name(pkg, pnaw_nonambig), varbuf_str(&aemsgs)); } varbuf_destroy(&aemsgs); sincenothing = 0; @@ -658,7 +652,7 @@ deferred_configure(struct pkginfo *pkg) * ‘*.dpkg-new’ no longer exists we assume that we've * already processed this one. */ for (conff = pkg->installed.conffiles; conff; conff = conff->next) { - if (conff->obsolete || conff->remove_on_upgrade) + if (conffile_is_disappearing(conff)) continue; deferred_configure_conffile(pkg, conff); } @@ -703,7 +697,6 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) varbuf_set_str(result, dpkg_fsys_get_dir()); varbuf_add_str(result, in); - varbuf_end_str(result); loopprotect = 0; @@ -777,11 +770,10 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) r++; varbuf_trunc(result, r); debug(dbg_conffdetail, - "conffderef readlink relative to '%.*s'", - (int)result->used, result->buf); + "conffderef readlink relative to '%s'", + varbuf_str(result)); } varbuf_add_varbuf(result, &target); - varbuf_end_str(result); } else { warning(_("%s: conffile '%.250s' is not a plain file or symlink (= '%s')"), pkg_name(pkg, pnaw_nonambig), in, result->buf); diff --git a/src/main/depcon.c b/src/main/depcon.c index e8efdd3..45f55a8 100644 --- a/src/main/depcon.c +++ b/src/main/depcon.c @@ -176,9 +176,8 @@ findbreakcyclerecursive(struct pkginfo *pkg, struct cyclesofarlink *sofar) varbuf_add_str(&str_pkgs, " <- "); varbuf_add_pkgbin_name(&str_pkgs, sol->pkg, &sol->pkg->installed, pnaw_nonambig); } - varbuf_end_str(&str_pkgs); debug(dbg_depcondetail, "findbreakcyclerecursive %s %s", - pkg_name(pkg, pnaw_always), str_pkgs.buf); + pkg_name(pkg, pnaw_always), varbuf_str(&str_pkgs)); varbuf_destroy(&str_pkgs); } thislink.pkg= pkg; @@ -242,7 +241,6 @@ void describedepcon(struct varbuf *addto, struct dependency *dep) { struct varbuf depstr = VARBUF_INIT; varbufdependency(&depstr, dep); - varbuf_end_str(&depstr); switch (dep->type) { case dep_depends: @@ -285,7 +283,7 @@ void describedepcon(struct varbuf *addto, struct dependency *dep) { * empty though - it will be reset before use. * * If depisok returns false for ‘not OK’ it will contain a description, - * newline-terminated BUT NOT NUL-TERMINATED, of the reason. + * newline and NUL terminated, of the reason. * * If depisok returns true it will contain garbage. * allowunconfigd should be non-zero during the ‘Pre-Depends’ checking diff --git a/src/main/enquiry.c b/src/main/enquiry.c index cc605c2..13dc8c0 100644 --- a/src/main/enquiry.c +++ b/src/main/enquiry.c @@ -565,7 +565,6 @@ predeppackage(const char *const *argv) if (!pkg) { varbuf_reset(&vb); describedepcon(&vb,dep); - varbuf_end_str(&vb); notice(_("cannot see how to satisfy pre-dependency:\n %s"), vb.buf); ohshit(_("cannot satisfy pre-dependencies for %.250s (wanted due to %.250s)"), pkgbin_name(dep->up, &dep->up->available, pnaw_nonambig), diff --git a/src/main/help.c b/src/main/help.c index 59e730e..c6abc8a 100644 --- a/src/main/help.c +++ b/src/main/help.c @@ -196,7 +196,7 @@ dir_has_conffiles(struct fsys_namenode *file, struct pkginfo *pkg) pkg_name(pkg, pnaw_always)); namelen = strlen(file->name); for (conff= pkg->installed.conffiles; conff; conff= conff->next) { - if (conff->obsolete || conff->remove_on_upgrade) + if (conffile_is_disappearing(conff)) continue; if (strncmp(file->name, conff->name, namelen) == 0 && strlen(conff->name) > namelen && conff->name[namelen] == '/') { @@ -272,6 +272,16 @@ dir_is_used_by_pkg(struct fsys_namenode *file, struct pkginfo *pkg, } /** + * Returns whether the conffile is disappearing, because it is obsolete + * or marked for removal on upgrade. + */ +bool +conffile_is_disappearing(struct conffile *conff) +{ + return conff->flags & (CONFFILE_OBSOLETE | CONFFILE_REMOVE_ON_UPGRADE); +} + +/** * Mark a conffile as obsolete. * * @param pkg The package owning the conffile. @@ -286,7 +296,7 @@ conffile_mark_obsolete(struct pkginfo *pkg, struct fsys_namenode *namenode) if (strcmp(conff->name, namenode->name) == 0) { debug(dbg_conff, "marking %s conffile %s as obsolete", pkg_name(pkg, pnaw_always), conff->name); - conff->obsolete = true; + conff->flags |= CONFFILE_OBSOLETE; return; } } diff --git a/src/main/main.c b/src/main/main.c index 02887c2..ecaed5f 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -29,7 +29,7 @@ #include <errno.h> #include <limits.h> -#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <string.h> @@ -337,6 +337,24 @@ is_invoke_action(enum action action) } } +static bool +can_invoke_hooks(enum action action) +{ + if (!is_invoke_action(action)) + return false; + + if (f_noact) + return false; + + if (in_force(FORCE_NON_ROOT)) + return true; + + if (getuid() || geteuid()) + return false; + + return true; +} + static struct invoke_list pre_invoke_hooks = { .head = NULL, .tail = &pre_invoke_hooks.head, @@ -672,7 +690,6 @@ commandfd(const char *const *argv) if (c == EOF) ohshit(_("unexpected end of file before end of line %d"), lno); if (!argc) continue; - varbuf_end_str(&linevb); newargs = m_realloc(newargs, sizeof(const char *) * (argc + 1)); argc= 1; ptr= linevb.buf; @@ -761,14 +778,14 @@ int main(int argc, const char *const *argv) { if (!f_triggers) f_triggers = (cipaction->arg_int == act_triggers && *argv) ? -1 : 1; - if (is_invoke_action(cipaction->arg_int)) { + if (can_invoke_hooks(cipaction->arg_int)) { run_invoke_hooks(cipaction->olong, &pre_invoke_hooks); run_status_loggers(&status_loggers); } ret = cipaction->action(argv); - if (is_invoke_action(cipaction->arg_int)) + if (can_invoke_hooks(cipaction->arg_int)) run_invoke_hooks(cipaction->olong, &post_invoke_hooks); free_invoke_hooks(&pre_invoke_hooks); diff --git a/src/main/main.h b/src/main/main.h index f841e8d..d70e87d 100644 --- a/src/main/main.h +++ b/src/main/main.h @@ -22,6 +22,8 @@ #ifndef MAIN_H #define MAIN_H +#include <stdbool.h> + #include <dpkg/debug.h> #include <dpkg/pkg-list.h> @@ -220,6 +222,8 @@ bool ignore_depends(const struct pkginfo *pkg); bool force_breaks(struct deppossi *possi); bool force_depends(struct deppossi *possi); bool force_conflicts(struct deppossi *possi); +bool +conffile_is_disappearing(struct conffile *conff); void conffile_mark_obsolete(struct pkginfo *pkg, struct fsys_namenode *namenode); void pkg_conffiles_mark_old(struct pkginfo *pkg); diff --git a/src/main/packages.c b/src/main/packages.c index aba9ba7..3fc9db3 100644 --- a/src/main/packages.c +++ b/src/main/packages.c @@ -561,11 +561,10 @@ breaks_check_one(struct varbuf *aemsgs, enum dep_check *ok, return; varbufdependency(&depmsg, breaks->up); - varbuf_end_str(&depmsg); varbuf_printf(aemsgs, _(" %s (%s) breaks %s and is %s.\n"), pkg_name(breaker, pnaw_nonambig), versiondescribe(&breaker->installed.version, vdew_nonambig), - depmsg.buf, gettext(statusstrings[breaker->status])); + varbuf_str(&depmsg), gettext(statusstrings[breaker->status])); varbuf_destroy(&depmsg); if (virtbroken) { @@ -727,7 +726,6 @@ dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing, if (interestingwarnings) { /* Don't print the line about the package to be removed if * that's the only line. */ - varbuf_end_str(&oemsgs); varbuf_add_str(aemsgs, _("; however:\n")); varbuf_add_varbuf(aemsgs, &oemsgs); } else { @@ -755,6 +753,7 @@ dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing, progress_bytrigproc = canfixbytrig; varbuf_destroy(&oemsgs); - debug(dbg_depcon,"ok %d msgs >>%.*s<<", ok, (int)aemsgs->used, aemsgs->buf); + debug(dbg_depcon, "ok %d msgs >>%s<<", ok, varbuf_str(aemsgs)); + return ok; } diff --git a/src/main/remove.c b/src/main/remove.c index 88c01a2..f36d7f9 100644 --- a/src/main/remove.c +++ b/src/main/remove.c @@ -151,14 +151,12 @@ void deferred_remove(struct pkginfo *pkg) { return; } else if (rok == DEP_CHECK_HALT) { sincenothing= 0; - varbuf_end_str(&raemsgs); notice(_("dependency problems prevent removal of %s:\n%s"), - pkg_name(pkg, pnaw_nonambig), raemsgs.buf); + pkg_name(pkg, pnaw_nonambig), varbuf_str(&raemsgs)); ohshit(_("dependency problems - not removing")); } else if (raemsgs.used) { - varbuf_end_str(&raemsgs); notice(_("%s: dependency problems, but removing anyway as you requested:\n%s"), - pkg_name(pkg, pnaw_nonambig), raemsgs.buf); + pkg_name(pkg, pnaw_nonambig), varbuf_str(&raemsgs)); } varbuf_destroy(&raemsgs); sincenothing= 0; @@ -290,7 +288,6 @@ removal_bulk_remove_files(struct pkginfo *pkg) varbuf_set_str(&fnvb, dpkg_fsys_get_dir()); varbuf_add_str(&fnvb, usenode->name); - varbuf_end_str(&fnvb); varbuf_snapshot(&fnvb, &fnvb_state); is_dir = stat(fnvb.buf, &stab) == 0 && S_ISDIR(stab.st_mode); @@ -335,18 +332,15 @@ removal_bulk_remove_files(struct pkginfo *pkg) varbuf_rollback(&fnvb_state); varbuf_add_str(&fnvb, DPKGTEMPEXT); - varbuf_end_str(&fnvb); debug(dbg_eachfiledetail, "removal_bulk cleaning temp '%s'", fnvb.buf); path_remove_tree(fnvb.buf); varbuf_rollback(&fnvb_state); varbuf_add_str(&fnvb, DPKGNEWEXT); - varbuf_end_str(&fnvb); debug(dbg_eachfiledetail, "removal_bulk cleaning new '%s'", fnvb.buf); path_remove_tree(fnvb.buf); varbuf_rollback(&fnvb_state); - varbuf_end_str(&fnvb); debug(dbg_eachfiledetail, "removal_bulk removing '%s'", fnvb.buf); if (!rmdir(fnvb.buf) || errno == ENOENT || errno == ELOOP) continue; @@ -419,7 +413,6 @@ static void removal_bulk_remove_leftover_dirs(struct pkginfo *pkg) { varbuf_set_str(&fnvb, dpkg_fsys_get_dir()); varbuf_add_str(&fnvb, usenode->name); - varbuf_end_str(&fnvb); if (!stat(fnvb.buf,&stab) && S_ISDIR(stab.st_mode)) { debug(dbg_eachfiledetail, "removal_bulk is a directory"); @@ -535,16 +528,20 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { static struct varbuf fnvb, removevb; struct varbuf_state removevb_state; - if (conff->obsolete) { + if (conff->flags & CONFFILE_OBSOLETE) { debug(dbg_conffdetail, "removal_bulk conffile obsolete %s", conff->name); } varbuf_reset(&fnvb); rc = conffderef(pkg, &fnvb, conff->name); - debug(dbg_conffdetail, "removal_bulk conffile '%s' (= '%s')", - conff->name, rc == -1 ? "<rc == -1>" : fnvb.buf); - if (rc == -1) + if (rc < 0) { + debug(dbg_conffdetail, "removal_bulk conffile '%s' (rc < %d)", + conff->name, rc); continue; + } else { + debug(dbg_conffdetail, "removal_bulk conffile '%s' (deref '%s')", + conff->name, fnvb.buf); + } namenode = fsys_hash_find_node(conff->name, FHFF_NONE); usenode = namenodetouse(namenode, pkg, &pkg->installed); @@ -559,7 +556,6 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { *p = '\0'; varbuf_reset(&removevb); varbuf_add_dir(&removevb, fnvb.buf); - varbuf_end_str(&removevb); varbuf_snapshot(&removevb, &removevb_state); dsd= opendir(removevb.buf); @@ -602,7 +598,6 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { yes_remove: varbuf_rollback(&removevb_state); varbuf_add_str(&removevb, de->d_name); - varbuf_end_str(&removevb); debug(dbg_conffdetail, "removal_bulk conffile dsd entry removing '%s'", removevb.buf); if (unlink(removevb.buf) && errno != ENOENT && errno != ENOTDIR) diff --git a/src/main/script.c b/src/main/script.c index 017d92e..e9aee0b 100644 --- a/src/main/script.c +++ b/src/main/script.c @@ -136,9 +136,8 @@ maintscript_pre_exec(struct command *cmd) varbuf_add_char(&args, ' '); varbuf_add_str(&args, *argv); } - varbuf_end_str(&args); debug(dbg_scripts, "fork/exec %s (%s )", cmd->filename, - args.buf); + varbuf_str(&args)); varbuf_destroy(&args); } if (instdirlen == 0 || in_force(FORCE_SCRIPT_CHROOTLESS)) diff --git a/src/main/select.c b/src/main/select.c index d71202e..6e81d97 100644 --- a/src/main/select.c +++ b/src/main/select.c @@ -156,7 +156,6 @@ setselections(const char *const *argv) ohshit(_("unexpected end of file in package name at line %d"), lno); if (c == '\n') ohshit(_("unexpected end of line in package name at line %d"),lno); } - varbuf_end_str(&namevb); while (c != EOF && c_isspace(c)) { c= getchar(); @@ -170,28 +169,29 @@ setselections(const char *const *argv) varbuf_add_char(&selvb, c); c= getchar(); } - varbuf_end_str(&selvb); while (c != EOF && c != '\n') { c= getchar(); if (!c_isspace(c)) ohshit(_("unexpected data after package and selection at line %d"),lno); } - pkg = pkg_spec_parse_pkg(namevb.buf, &err); + pkg = pkg_spec_parse_pkg(varbuf_str(&namevb), &err); if (pkg == NULL) ohshit(_("illegal package name at line %d: %.250s"), lno, err.str); if (!pkg_is_informative(pkg, &pkg->installed) && !pkg_is_informative(pkg, &pkg->available)) { db_possibly_outdated = true; - warning(_("package not in status nor available database at line %d: %.250s"), lno, namevb.buf); + warning(_("package not in status nor available database at line %d: %.250s"), + lno, varbuf_str(&namevb)); lno++; continue; } - nv = namevalue_find_by_name(wantinfos, selvb.buf); + nv = namevalue_find_by_name(wantinfos, varbuf_str(&selvb)); if (nv == NULL) - ohshit(_("unknown wanted status at line %d: %.250s"), lno, selvb.buf); + ohshit(_("unknown wanted status at line %d: %.250s"), + lno, varbuf_str(&selvb)); pkg_set_want(pkg, nv->value); if (c == EOF) break; diff --git a/src/main/trigproc.c b/src/main/trigproc.c index 125eb02..dc8dc83 100644 --- a/src/main/trigproc.c +++ b/src/main/trigproc.c @@ -434,17 +434,17 @@ trigproc(struct pkginfo *pkg, enum trigproc_type type) } sincenothing = 0; - varbuf_end_str(&depwhynot); notice(_("dependency problems prevent processing " "triggers for %s:\n%s"), - pkg_name(pkg, pnaw_nonambig), depwhynot.buf); + pkg_name(pkg, pnaw_nonambig), + varbuf_str(&depwhynot)); varbuf_destroy(&depwhynot); ohshit(_("dependency problems - leaving triggers unprocessed")); } else if (depwhynot.used) { - varbuf_end_str(&depwhynot); notice(_("%s: dependency problems, but processing " "triggers anyway as you requested:\n%s"), - pkg_name(pkg, pnaw_nonambig), depwhynot.buf); + pkg_name(pkg, pnaw_nonambig), + varbuf_str(&depwhynot)); varbuf_destroy(&depwhynot); } @@ -462,7 +462,6 @@ trigproc(struct pkginfo *pkg, enum trigproc_type type) varbuf_add_char(&namesarg, ' '); varbuf_add_str(&namesarg, tp->name); } - varbuf_end_str(&namesarg); /* Setting the status to half-configured * causes modstatdb_note to clear pending triggers. */ @@ -472,7 +471,7 @@ trigproc(struct pkginfo *pkg, enum trigproc_type type) if (!f_noact) { sincenothing = 0; maintscript_postinst(pkg, "triggered", - namesarg.buf + 1, NULL); + varbuf_str(&namesarg) + 1, NULL); } post_postinst_tasks(pkg, PKG_STAT_INSTALLED); diff --git a/src/main/unpack.c b/src/main/unpack.c index 02c2681..e57a6e3 100644 --- a/src/main/unpack.c +++ b/src/main/unpack.c @@ -244,10 +244,9 @@ pkg_check_depcon(struct pkginfo *pkg, const char *pfilename) while (fixbytrigaw->trigaw.head) trigproc(fixbytrigaw->trigaw.head->pend, TRIGPROC_REQUIRED); } else { - varbuf_end_str(&depprobwhy); notice(_("regarding %s containing %s, pre-dependency problem:\n%s"), pfilename, pkgbin_name(pkg, &pkg->available, pnaw_nonambig), - depprobwhy.buf); + varbuf_str(&depprobwhy)); if (!force_depends(dsearch->list)) ohshit(_("pre-dependency problem - not installing %.250s"), pkgbin_name(pkg, &pkg->available, pnaw_nonambig)); @@ -608,7 +607,7 @@ pkg_remove_conffile_on_upgrade(struct pkginfo *pkg, struct fsys_namenode *nameno usenode = namenodetouse(namenode, pkg, &pkg->installed); rc = conffderef(pkg, &cdr, usenode->name); - if (rc == -1) { + if (rc < 0) { debug(dbg_conffdetail, "%s: '%s' conffile dereference error: %s", __func__, namenode->name, strerror(errno)); namenode->oldhash = EMPTYHASHFLAG; @@ -636,7 +635,6 @@ pkg_remove_conffile_on_upgrade(struct pkginfo *pkg, struct fsys_namenode *nameno /* Remove DPKGDISTEXT variant if still present. */ varbuf_rollback(&cdrext_state); varbuf_add_str(&cdrext, DPKGDISTEXT); - varbuf_end_str(&cdrext); if (unlink(cdrext.buf) < 0 && errno != ENOENT) warning(_("%s: failed to remove '%.250s': %s"), @@ -661,7 +659,6 @@ pkg_remove_conffile_on_upgrade(struct pkginfo *pkg, struct fsys_namenode *nameno /* Otherwise, preserve the modified conffile. */ varbuf_rollback(&cdrext_state); varbuf_add_str(&cdrext, DPKGOLDEXT); - varbuf_end_str(&cdrext); printf(_("Obsolete conffile '%s' has been modified by you.\n"), cdr.buf); printf(_("Saving as %s ...\n"), cdrext.buf); @@ -710,7 +707,6 @@ pkg_remove_old_files(struct pkginfo *pkg, varbuf_rollback(&fname_state); varbuf_add_str(&fnamevb, usenode->name); - varbuf_end_str(&fnamevb); if (!stat(fnamevb.buf, &stab) && S_ISDIR(stab.st_mode)) { debug(dbg_eachfiledetail, "process_archive: %s is a directory", @@ -719,10 +715,10 @@ pkg_remove_old_files(struct pkginfo *pkg, continue; } - if (lstat(fnamevb.buf, &oldfs)) { + if (lstat(varbuf_str(&fnamevb), &oldfs)) { if (!(errno == ENOENT || errno == ELOOP || errno == ENOTDIR)) warning(_("could not stat old file '%.250s' so not deleting it: %s"), - fnamevb.buf, strerror(errno)); + varbuf_str(&fnamevb), strerror(errno)); continue; } if (S_ISDIR(oldfs.st_mode)) { @@ -732,7 +728,7 @@ pkg_remove_old_files(struct pkginfo *pkg, if (strcmp(usenode->name, "/.") == 0) continue; - if (rmdir(fnamevb.buf)) { + if (rmdir(varbuf_str(&fnamevb))) { warning(_("unable to delete old directory '%.250s': %s"), namenode->name, strerror(errno)); } else if ((namenode->flags & FNNF_OLD_CONFF)) { @@ -762,7 +758,7 @@ pkg_remove_old_files(struct pkginfo *pkg, /* If we can't stat the old or new file, or it's a directory, * we leave it up to the normal code. */ debug(dbg_eachfile, "process_archive: checking %s for same files on " - "upgrade/downgrade", fnamevb.buf); + "upgrade/downgrade", varbuf_str(&fnamevb)); for (cfile = newfiles_queue->head; cfile; cfile = cfile->next) { /* If the file has been filtered then treat it as if it didn't exist @@ -775,9 +771,8 @@ pkg_remove_old_files(struct pkginfo *pkg, varbuf_set_str(&cfilename, dpkg_fsys_get_dir()); varbuf_add_str(&cfilename, cfile->namenode->name); - varbuf_end_str(&cfilename); - if (lstat(cfilename.buf, &tmp_stat) == 0) { + if (lstat(varbuf_str(&cfilename), &tmp_stat) == 0) { struct file_ondisk_id *file_ondisk_id; file_ondisk_id = nfmalloc(sizeof(*file_ondisk_id)); @@ -800,11 +795,11 @@ pkg_remove_old_files(struct pkginfo *pkg, oldfs.st_ino == cfile->namenode->file_ondisk_id->id_ino) { if (sameas) warning(_("old file '%.250s' is the same as several new files! " - "(both '%.250s' and '%.250s')"), fnamevb.buf, + "(both '%.250s' and '%.250s')"), varbuf_str(&fnamevb), sameas->namenode->name, cfile->namenode->name); sameas = cfile; debug(dbg_eachfile, "process_archive: not removing %s, " - "since it matches %s", fnamevb.buf, cfile->namenode->name); + "since it matches %s", varbuf_str(&fnamevb), cfile->namenode->name); } } @@ -839,7 +834,7 @@ pkg_remove_old_files(struct pkginfo *pkg, trig_path_activate(usenode, pkg); - if (secure_unlink_statted(fnamevb.buf, &oldfs)) { + if (secure_unlink_statted(varbuf_str(&fnamevb), &oldfs)) { warning(_("unable to securely remove old file '%.250s': %s"), namenode->name, strerror(errno)); } @@ -924,9 +919,11 @@ pkg_update_fields(struct pkginfo *pkg, struct fsys_namenode_queue *newconffiles) newiconff->next = NULL; newiconff->name = nfstrsave(cfile->namenode->name); newiconff->hash = nfstrsave(cfile->namenode->oldhash); - newiconff->obsolete = !!(cfile->namenode->flags & FNNF_OBS_CONFF); - newiconff->remove_on_upgrade = !!( - cfile->namenode->flags & FNNF_RM_CONFF_ON_UPGRADE); + newiconff->flags = CONFFILE_NONE; + if (cfile->namenode->flags & FNNF_OBS_CONFF) + newiconff->flags |= CONFFILE_OBSOLETE; + if (cfile->namenode->flags & FNNF_RM_CONFF_ON_UPGRADE) + newiconff->flags |= CONFFILE_REMOVE_ON_UPGRADE; *iconffileslastp = newiconff; iconffileslastp = &newiconff->next; } @@ -1036,9 +1033,8 @@ pkg_disappear_others(struct pkginfo *pkg) if (depisok(pdep->up, &depprobwhy, NULL, NULL, false)) continue; - varbuf_end_str(&depprobwhy); debug(dbg_veryverbose,"process_archive cannot disappear: %s", - depprobwhy.buf); + varbuf_str(&depprobwhy)); break; } if (!pdep) { @@ -1060,10 +1056,9 @@ pkg_disappear_others(struct pkginfo *pkg) if (depisok(pdep->up, &depprobwhy, NULL, NULL, false)) continue; - varbuf_end_str(&depprobwhy); debug(dbg_veryverbose, "process_archive cannot disappear (provides %s): %s", - providecheck->list->ed->name, depprobwhy.buf); + providecheck->list->ed->name, varbuf_str(&depprobwhy)); goto break_from_both_loops_at_once; } } @@ -1193,8 +1188,7 @@ pkg_remove_backup_files(struct pkginfo *pkg, struct fsys_namenode_list *newfiles varbuf_rollback(&fnametmp_state); varbuf_add_str(&fnametmpvb, usenode->name); varbuf_add_str(&fnametmpvb, DPKGTEMPEXT); - varbuf_end_str(&fnametmpvb); - path_remove_tree(fnametmpvb.buf); + path_remove_tree(varbuf_str(&fnametmpvb)); } } diff --git a/src/main/verify.c b/src/main/verify.c index 6a5d733..68b8493 100644 --- a/src/main/verify.c +++ b/src/main/verify.c @@ -192,11 +192,10 @@ verify_package(struct pkginfo *pkg) varbuf_set_str(&filename, dpkg_fsys_get_dir()); varbuf_add_str(&filename, fnn->name); - varbuf_end_str(&filename); memset(&checks, 0, sizeof(checks)); - if (verify_file(filename.buf, fnn, pkg, &checks) > 0) + if (verify_file(varbuf_str(&filename), fnn, pkg, &checks) > 0) verify_output(fnn, &checks); } diff --git a/src/query/main.c b/src/query/main.c index 6674896..c625957 100644 --- a/src/query/main.c +++ b/src/query/main.c @@ -28,7 +28,7 @@ #include <sys/types.h> #include <sys/stat.h> -#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <errno.h> @@ -355,7 +355,6 @@ searchfiles(const char *const *argv) varbuf_add_char(&vb, '*'); varbuf_add_str(&vb, thisarg); varbuf_add_char(&vb, '*'); - varbuf_end_str(&vb); thisarg= vb.buf; } if (!strpbrk(thisarg, "*[?\\")) { diff --git a/src/realpath/main.c b/src/realpath/main.c new file mode 100644 index 0000000..bfa2aa2 --- /dev/null +++ b/src/realpath/main.c @@ -0,0 +1,247 @@ +/* + * dpkg-realpath - print the resolved pathname with DPKG_ROOT support + * + * Copyright © 2020 Helmut Grohne <helmut@subdivi.de> + * Copyright © 2020-2024 Guillem Jover <guillem@debian.org> + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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 <https://www.gnu.org/licenses/>. + */ + +#include <config.h> +#include <compat.h> + +#include <sys/types.h> +#include <sys/stat.h> + +#include <errno.h> +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif +#include <string.h> +#include <unistd.h> +#include <stdint.h> +#include <stdlib.h> +#include <stdio.h> + +#include <dpkg/i18n.h> +#include <dpkg/dpkg.h> +#include <dpkg/dpkg-db.h> +#include <dpkg/debug.h> +#include <dpkg/string.h> +#include <dpkg/db-fsys.h> +#include <dpkg/options.h> + +static const char printforhelp[] = N_( +"Use --help for help about this utility."); + +static void DPKG_ATTR_NORET +printversion(const struct cmdinfo *cip, const char *value) +{ + printf(_("Debian %s version %s.\n"), dpkg_get_progname(), + PACKAGE_RELEASE); + + printf(_( +"This is free software; see the GNU General Public License version 2 or\n" +"later for copying conditions. There is NO warranty.\n")); + + m_output(stdout, _("<standard output>")); + + exit(0); +} + +static void DPKG_ATTR_NORET +usage(const struct cmdinfo *cip, const char *value) +{ + printf(_( +"Usage: %s [<option>...] <pathname>\n" +"\n"), dpkg_get_progname()); + + printf(_( +"Options:\n" +" -z, --zero end output line with NUL, not newline.\n" +" --instdir <directory> set the root directory.\n" +" --root <directory> set the root directory.\n" +" --version show the version.\n" +" --help show this help message.\n" +"\n")); + + m_output(stdout, _("<standard output>")); + + exit(0); +} + +static int opt_eol = '\n'; + +static char * +realpath_relative_to(const char *pathname, const char *rootdir) +{ + struct varbuf root = VARBUF_INIT; + struct varbuf src = VARBUF_INIT; + struct varbuf dst = VARBUF_INIT; + struct varbuf slink = VARBUF_INIT; + struct varbuf result = VARBUF_INIT; + struct varbuf prefix = VARBUF_INIT; + int loop = 0; + + varbuf_init(&root, 32); + varbuf_init(&src, 32); + varbuf_init(&dst, 32); + varbuf_init(&result, 32); + + varbuf_set_str(&root, rootdir); + varbuf_set_str(&src, pathname); + varbuf_set_str(&result, rootdir); + + /* Check whether the path is relative, make it absolute otherwise. */ + if (src.buf[0] != '/') { + struct varbuf abs_src = VARBUF_INIT; + + file_getcwd(&abs_src); + varbuf_add_char(&abs_src, '/'); + varbuf_add_varbuf(&abs_src, &src); + + varbuf_set_varbuf(&src, &abs_src); + varbuf_destroy(&abs_src); + + varbuf_trim_varbuf_prefix(&src, &root); + } + + /* Remove prefixed slashes. */ + varbuf_trim_char_prefix(&src, '/'); + + while (src.used) { + struct stat st; + const char *slash; + + /* Get the first directory component. */ + varbuf_set_varbuf(&prefix, &src); + slash = strchrnul(prefix.buf, '/'); + varbuf_trunc(&prefix, slash - prefix.buf); + + /* Remove the first directory component from src. */ + varbuf_trim_varbuf_prefix(&src, &prefix); + + /* Remove prefixed slashes. */ + varbuf_trim_char_prefix(&src, '/'); + + varbuf_set_varbuf(&slink, &result); + varbuf_add_char(&slink, '/'); + varbuf_add_varbuf(&slink, &prefix); + + /* Resolve the first directory component. */ + if (strcmp(prefix.buf, ".") == 0) { + /* Ignore, stay at the same directory. */ + } else if (strcmp(prefix.buf, "..") == 0) { + /* Go up one directory. */ + slash = strrchr(result.buf, '/'); + if (slash != NULL) + varbuf_trunc(&result, slash - result.buf); + + if (root.used && !varbuf_has_prefix(&result, &root)) + varbuf_set_varbuf(&result, &root); + } else if (lstat(slink.buf, &st) == 0 && S_ISLNK(st.st_mode)) { + ssize_t linksize; + + loop++; + if (loop > 25) + ohshit(_("too many levels of symbolic links")); + + /* Resolve the symlink within result. */ + linksize = file_readlink(slink.buf, &dst, st.st_size); + if (linksize < 0) + ohshite(_("cannot read link '%s'"), slink.buf); + else if ((off_t)linksize != st.st_size) + ohshit(_("symbolic link '%s' size has changed from %jd to %zd"), + slink.buf, (intmax_t)st.st_size, linksize); + + if (dst.buf[0] == '/') { + /* Absolute pathname, reset result back to + * root. */ + varbuf_set_varbuf(&result, &root); + + if (src.used) { + varbuf_add_char(&dst, '/'); + varbuf_add_varbuf(&dst, &src); + } + varbuf_set_varbuf(&src, &dst); + + /* Remove prefixed slashes. */ + varbuf_trim_char_prefix(&src, '/'); + } else { + /* Relative pathname. */ + if (src.used) { + varbuf_add_char(&dst, '/'); + varbuf_add_varbuf(&dst, &src); + } + varbuf_set_varbuf(&src, &dst); + } + } else { + /* Otherwise append the prefix. */ + varbuf_add_char(&result, '/'); + varbuf_add_varbuf(&result, &prefix); + } + } + + /* We are done, return the resolved pathname, w/o root. */ + varbuf_trim_varbuf_prefix(&result, &root); + + varbuf_destroy(&root); + varbuf_destroy(&src); + varbuf_destroy(&dst); + varbuf_destroy(&slink); + varbuf_destroy(&prefix); + + return varbuf_detach(&result); +} + +static const struct cmdinfo cmdinfos[] = { + { "zero", 'z', 0, &opt_eol, NULL, NULL, '\0' }, + { "instdir", 0, 1, NULL, NULL, set_instdir, 0 }, + { "root", 0, 1, NULL, NULL, set_instdir, 0 }, + { "version", 0, 0, NULL, NULL, printversion }, + { "help", '?', 0, NULL, NULL, usage }, + { NULL, 0 } +}; + +int +main(int argc, const char *const *argv) +{ + const char *instdir; + const char *pathname; + char *real_pathname; + + dpkg_locales_init(PACKAGE); + dpkg_program_init("dpkg-realpath"); + dpkg_options_parse(&argv, cmdinfos, printforhelp); + + debug(dbg_general, "root=%s admindir=%s", dpkg_fsys_get_dir(), dpkg_db_get_dir()); + + pathname = argv[0]; + if (str_is_unset(pathname)) + badusage(_("need a pathname argument")); + + instdir = dpkg_fsys_get_dir(); + if (strlen(instdir) && strncmp(pathname, instdir, strlen(instdir)) == 0) + badusage(_("link '%s' includes root prefix '%s'"), + pathname, instdir); + + real_pathname = realpath_relative_to(pathname, instdir); + printf("%s%c", real_pathname, opt_eol); + free(real_pathname); + + dpkg_program_done(); + dpkg_locales_done(); + + return 0; +} diff --git a/src/split/main.c b/src/split/main.c index eba2333..729f1c5 100644 --- a/src/split/main.c +++ b/src/split/main.c @@ -26,7 +26,7 @@ #include <errno.h> #include <limits.h> #include <inttypes.h> -#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <string.h> diff --git a/src/split/split.c b/src/split/split.c index 771de62..d218ab7 100644 --- a/src/split/split.c +++ b/src/split/split.c @@ -99,7 +99,9 @@ parse_timestamp(const char *value) errno = 0; timestamp = strtoimax(value, &end, 10); - if (value == end || *end || errno != 0) + if (value == end || *end) + ohshit(_("unable to parse timestamp '%.255s'"), value); + else if (errno != 0) ohshite(_("unable to parse timestamp '%.255s'"), value); return timestamp; @@ -162,7 +164,7 @@ mksplit(const char *file_src, const char *prefix, off_t maxpartsize, version = versiondescribe(&pkg->available.version, vdew_nonambig); timestamp_str = getenv("SOURCE_DATE_EPOCH"); - if (timestamp_str) + if (str_is_set(timestamp_str)) timestamp = parse_timestamp(timestamp_str); else timestamp = time(NULL); diff --git a/src/statoverride/main.c b/src/statoverride/main.c index 07c8757..1ba091f 100644 --- a/src/statoverride/main.c +++ b/src/statoverride/main.c @@ -26,7 +26,7 @@ #include <sys/stat.h> #include <errno.h> -#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <string.h> @@ -280,14 +280,13 @@ statoverride_add(const char *const *argv) varbuf_add_str(&realfilename, dpkg_fsys_get_dir()); varbuf_add_str(&realfilename, filename); - varbuf_end_str(&realfilename); - if (stat(realfilename.buf, &st) == 0) { + if (stat(varbuf_str(&realfilename), &st) == 0) { (*filestat)->mode |= st.st_mode & S_IFMT; - statdb_node_apply(realfilename.buf, *filestat); + statdb_node_apply(varbuf_str(&realfilename), *filestat); } else if (opt_verbose) { warning(_("--update given but %s does not exist"), - realfilename.buf); + varbuf_str(&realfilename)); } varbuf_destroy(&realfilename); diff --git a/src/trigger/main.c b/src/trigger/main.c index 2bba56d..7eb1b5a 100644 --- a/src/trigger/main.c +++ b/src/trigger/main.c @@ -25,7 +25,7 @@ #include <sys/types.h> #include <fcntl.h> -#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <string.h> |