summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:40:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:40:28 +0000
commit774e54c8927088c60617dc9345f55eaabb23256a (patch)
tree7d82ddb667eaec624064c430b57818c78184e3c7 /lib
parentAdding upstream version 1.22.4. (diff)
downloaddpkg-774e54c8927088c60617dc9345f55eaabb23256a.tar.xz
dpkg-774e54c8927088c60617dc9345f55eaabb23256a.zip
Adding upstream version 1.22.5.upstream/1.22.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.in7
-rw-r--r--lib/compat/Makefile.in7
-rw-r--r--lib/dpkg/Makefile.am34
-rw-r--r--lib/dpkg/Makefile.in55
-rw-r--r--lib/dpkg/file.c19
-rw-r--r--lib/dpkg/file.h3
-rw-r--r--lib/dpkg/libdpkg.map1
-rw-r--r--lib/dpkg/parse.c7
-rw-r--r--lib/dpkg/path-remove.c8
-rw-r--r--lib/dpkg/tarfn.c9
-rw-r--r--lib/dpkg/version.c4
11 files changed, 101 insertions, 53 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in
index e0644ac..a1a17a6 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -336,6 +336,7 @@ ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aclocaldir = @aclocaldir@
admindir = @admindir@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
@@ -343,6 +344,7 @@ am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
backupsdir = @backupsdir@
+bashcompletionsdir = @bashcompletionsdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -354,6 +356,7 @@ datadir = @datadir@
datarootdir = @datarootdir@
devlibdir = @devlibdir@
docdir = @docdir@
+docspecdir = @docspecdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@@ -371,10 +374,14 @@ localedir = @localedir@
localstatedir = @localstatedir@
logdir = @logdir@
mandir = @mandir@
+methodsdir = @methodsdir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+perllibdir = @perllibdir@
pkgconfdir = @pkgconfdir@
+pkgconfigdir = @pkgconfigdir@
+polkitactionsdir = @polkitactionsdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
diff --git a/lib/compat/Makefile.in b/lib/compat/Makefile.in
index 05e090b..9b3c41c 100644
--- a/lib/compat/Makefile.in
+++ b/lib/compat/Makefile.in
@@ -399,6 +399,7 @@ ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aclocaldir = @aclocaldir@
admindir = @admindir@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
@@ -406,6 +407,7 @@ am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
backupsdir = @backupsdir@
+bashcompletionsdir = @bashcompletionsdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -417,6 +419,7 @@ datadir = @datadir@
datarootdir = @datarootdir@
devlibdir = @devlibdir@
docdir = @docdir@
+docspecdir = @docspecdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@@ -434,10 +437,14 @@ localedir = @localedir@
localstatedir = @localstatedir@
logdir = @logdir@
mandir = @mandir@
+methodsdir = @methodsdir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+perllibdir = @perllibdir@
pkgconfdir = @pkgconfdir@
+pkgconfigdir = @pkgconfigdir@
+polkitactionsdir = @polkitactionsdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index 9482e32..9ef3a37 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -17,16 +17,10 @@ LDADD = \
../compat/libcompat.la \
# EOL
-DISTCLEANFILES =
-EXTRA_DIST = \
- $(test_scripts) \
- $(test_data) \
- libdpkg.map \
- libdpkg.pc.in \
- # EOL
+EXTRA_DIST =
+DISTCLEANFILES =
-pkgconfigdir = $(devlibdir)/pkgconfig
pkgconfig_DATA = libdpkg.pc
devlib_LTLIBRARIES = libdpkg.la
@@ -38,6 +32,7 @@ EXTRA_libdpkg_la_DEPENDENCIES = \
libdpkg_la_LDFLAGS = \
-no-undefined \
# EOL
+
if HAVE_LINKER_VERSION_SCRIPT
libdpkg_la_LDFLAGS += \
-Wl,--version-script=$(srcdir)/libdpkg.map \
@@ -46,23 +41,22 @@ else
libdpkg_la_LDFLAGS += \
-export-symbols libdpkg.sym \
# EOL
+
EXTRA_libdpkg_la_DEPENDENCIES += \
libdpkg.sym \
# EOL
endif
-libdpkg_la_LDFLAGS += $(MD_LIBS)
+
libdpkg_la_LIBADD = \
- ../compat/libcompat.la \
- # EOL
-if BUILD_SHARED
-libdpkg_la_LIBADD += \
- $(LIBINTL) \
$(Z_LIBS) \
$(LZMA_LIBS) \
$(ZSTD_LIBS) \
$(BZ2_LIBS) \
+ $(MD_LIBS) \
+ $(LIBINTL) \
+ ../compat/libcompat.la \
# EOL
-endif
+
libdpkg_la_SOURCES = \
dlist.h \
ar.c \
@@ -193,6 +187,11 @@ pkginclude_HEADERS = \
version.h \
# EOL
+EXTRA_DIST += \
+ libdpkg.map \
+ libdpkg.pc.in \
+ # EOL
+
DISTCLEANFILES += \
libdpkg.sym \
# EOL
@@ -266,6 +265,11 @@ test_data = \
t/data/meminfo-ok \
# EOL
+EXTRA_DIST += \
+ $(test_scripts) \
+ $(test_data) \
+ # EOL
+
BENCHMARK_LDADD_FLAGS = \
$(RT_LIBS) \
$(LDADD) \
diff --git a/lib/dpkg/Makefile.in b/lib/dpkg/Makefile.in
index a03e3d3..07f9005 100644
--- a/lib/dpkg/Makefile.in
+++ b/lib/dpkg/Makefile.in
@@ -113,14 +113,6 @@ host_triplet = @host@
@HAVE_LINKER_VERSION_SCRIPT_FALSE@ libdpkg.sym \
@HAVE_LINKER_VERSION_SCRIPT_FALSE@ # EOL
-@BUILD_SHARED_TRUE@am__append_4 = \
-@BUILD_SHARED_TRUE@ $(LIBINTL) \
-@BUILD_SHARED_TRUE@ $(Z_LIBS) \
-@BUILD_SHARED_TRUE@ $(LZMA_LIBS) \
-@BUILD_SHARED_TRUE@ $(ZSTD_LIBS) \
-@BUILD_SHARED_TRUE@ $(BZ2_LIBS) \
-@BUILD_SHARED_TRUE@ # EOL
-
check_PROGRAMS = $(am__EXEEXT_1) t/b-fsys-hash$(EXEEXT) \
t/b-pkg-hash$(EXEEXT) t/c-tarextract$(EXEEXT) \
t/c-treewalk$(EXEEXT) t/c-trigdeferred$(EXEEXT)
@@ -196,10 +188,10 @@ am__installdirs = "$(DESTDIR)$(devlibdir)" "$(DESTDIR)$(pkgconfigdir)" \
"$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(devlib_LTLIBRARIES)
am__DEPENDENCIES_1 =
-@BUILD_SHARED_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \
-@BUILD_SHARED_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-@BUILD_SHARED_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-libdpkg_la_DEPENDENCIES = ../compat/libcompat.la $(am__DEPENDENCIES_2)
+libdpkg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ ../compat/libcompat.la
am_libdpkg_la_OBJECTS = ar.lo arch.lo atomic-file.lo buffer.lo \
c-ctype.lo cleanup.lo color.lo command.lo compress.lo dbdir.lo \
dbmodify.lo db-ctrl-access.lo db-ctrl-format.lo \
@@ -227,13 +219,13 @@ libdpkg_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
t_b_fsys_hash_SOURCES = t/b-fsys-hash.c
am__dirstamp = $(am__leading_dot)dirstamp
t_b_fsys_hash_OBJECTS = t/b-fsys-hash.$(OBJEXT)
-am__DEPENDENCIES_3 = libdpkg.la $(am__DEPENDENCIES_1) \
+am__DEPENDENCIES_2 = libdpkg.la $(am__DEPENDENCIES_1) \
../compat/libcompat.la
-am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_3)
-t_b_fsys_hash_DEPENDENCIES = $(am__DEPENDENCIES_4)
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+t_b_fsys_hash_DEPENDENCIES = $(am__DEPENDENCIES_3)
t_b_pkg_hash_SOURCES = t/b-pkg-hash.c
t_b_pkg_hash_OBJECTS = t/b-pkg-hash.$(OBJEXT)
-t_b_pkg_hash_DEPENDENCIES = $(am__DEPENDENCIES_4)
+t_b_pkg_hash_DEPENDENCIES = $(am__DEPENDENCIES_3)
t_c_tarextract_SOURCES = t/c-tarextract.c
t_c_tarextract_OBJECTS = t/c-tarextract.$(OBJEXT)
t_c_tarextract_LDADD = $(LDADD)
@@ -712,6 +704,7 @@ ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aclocaldir = @aclocaldir@
admindir = @admindir@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
@@ -719,6 +712,7 @@ am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
backupsdir = @backupsdir@
+bashcompletionsdir = @bashcompletionsdir@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -730,6 +724,7 @@ datadir = @datadir@
datarootdir = @datarootdir@
devlibdir = @devlibdir@
docdir = @docdir@
+docspecdir = @docspecdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
@@ -747,10 +742,14 @@ localedir = @localedir@
localstatedir = @localstatedir@
logdir = @logdir@
mandir = @mandir@
+methodsdir = @methodsdir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+perllibdir = @perllibdir@
pkgconfdir = @pkgconfdir@
+pkgconfigdir = @pkgconfigdir@
+polkitactionsdir = @polkitactionsdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
@@ -782,21 +781,23 @@ LDADD = \
../compat/libcompat.la \
# EOL
+EXTRA_DIST = libdpkg.map libdpkg.pc.in $(test_scripts) $(test_data) # \
+ EOL
DISTCLEANFILES = libdpkg.sym # EOL
-EXTRA_DIST = \
- $(test_scripts) \
- $(test_data) \
- libdpkg.map \
- libdpkg.pc.in \
- # EOL
-
-pkgconfigdir = $(devlibdir)/pkgconfig
pkgconfig_DATA = libdpkg.pc
devlib_LTLIBRARIES = libdpkg.la
EXTRA_libdpkg_la_DEPENDENCIES = libdpkg.map $(am__append_3)
-libdpkg_la_LDFLAGS = -no-undefined $(am__append_1) $(am__append_2) \
- $(MD_LIBS)
-libdpkg_la_LIBADD = ../compat/libcompat.la $(am__append_4)
+libdpkg_la_LDFLAGS = -no-undefined $(am__append_1) $(am__append_2)
+libdpkg_la_LIBADD = \
+ $(Z_LIBS) \
+ $(LZMA_LIBS) \
+ $(ZSTD_LIBS) \
+ $(BZ2_LIBS) \
+ $(MD_LIBS) \
+ $(LIBINTL) \
+ ../compat/libcompat.la \
+ # EOL
+
libdpkg_la_SOURCES = \
dlist.h \
ar.c \
diff --git a/lib/dpkg/file.c b/lib/dpkg/file.c
index 4d02520..0da51d6 100644
--- a/lib/dpkg/file.c
+++ b/lib/dpkg/file.c
@@ -37,6 +37,25 @@
#include <dpkg/file.h>
/**
+ * Read the symlink content into a varbuf.
+ *
+ */
+ssize_t
+file_readlink(const char *slink, struct varbuf *content, size_t content_len)
+{
+ ssize_t linksize;
+
+ varbuf_reset(content);
+ varbuf_grow(content, content_len + 1);
+
+ linksize = readlink(slink, content->buf, content->size);
+ varbuf_trunc(content, linksize);
+ varbuf_end_str(content);
+
+ return linksize;
+}
+
+/**
* Check whether a filename is executable.
*
* @param filename The filename to check.
diff --git a/lib/dpkg/file.h b/lib/dpkg/file.h
index 0136f69..c1c25fa 100644
--- a/lib/dpkg/file.h
+++ b/lib/dpkg/file.h
@@ -48,6 +48,9 @@ struct file_stat {
char *gname;
};
+ssize_t
+file_readlink(const char *slink, struct varbuf *content, size_t content_len);
+
bool file_is_exec(const char *filename);
void file_copy_perms(const char *src, const char *dst);
diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map
index e0b1152..b7bedef 100644
--- a/lib/dpkg/libdpkg.map
+++ b/lib/dpkg/libdpkg.map
@@ -161,6 +161,7 @@ LIBDPKG_PRIVATE {
treewalk_close;
treewalk;
+ file_readlink;
file_is_exec;
file_copy_perms;
file_show;
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index a28983e..96af147 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -896,11 +896,10 @@ void copy_dependency_links(struct pkginfo *pkg,
for (dop= dyp->list; dop; dop= dop->next) {
if (dop->rev_prev)
dop->rev_prev->rev_next = dop->rev_next;
+ else if (available)
+ dop->ed->depended.available = dop->rev_next;
else
- if (available)
- dop->ed->depended.available = dop->rev_next;
- else
- dop->ed->depended.installed = dop->rev_next;
+ dop->ed->depended.installed = dop->rev_next;
if (dop->rev_next)
dop->rev_next->rev_prev = dop->rev_prev;
}
diff --git a/lib/dpkg/path-remove.c b/lib/dpkg/path-remove.c
index 6afb376..e4d6ebe 100644
--- a/lib/dpkg/path-remove.c
+++ b/lib/dpkg/path-remove.c
@@ -37,9 +37,11 @@
int
secure_unlink_statted(const char *pathname, const struct stat *stab)
{
- if (S_ISREG(stab->st_mode) ? (stab->st_mode & 07000) :
- !(S_ISLNK(stab->st_mode) || S_ISDIR(stab->st_mode) ||
- S_ISFIFO(stab->st_mode) || S_ISSOCK(stab->st_mode))) {
+ mode_t mode = stab->st_mode;
+
+ if (S_ISREG(mode) ? (mode & 07000) :
+ !(S_ISLNK(mode) || S_ISDIR(mode) ||
+ S_ISFIFO(mode) || S_ISSOCK(mode))) {
if (chmod(pathname, 0600))
return -1;
}
diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index d999db6..48e3c38 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -348,10 +348,15 @@ tar_header_decode(struct tar_header *h, struct tar_entry *d, struct dpkg_error *
* The way the GNU long{link,name} stuff works is like this:
*
* - The first header is a “dummy” header that contains the size of the
- * filename.
- * - The next N headers contain the filename.
+ * filename (GNU tar includes the terminating NUL character in the size,
+ * but other implementations do not).
+ * - The next N headers contain the filename (GNU tar terminates the string
+ * with a NUL character, but other implementations do not).
* - After the headers with the filename comes the “real” header with a
* bogus name or link.
+ *
+ * To be robust against any input, we need to always terminate the filename
+ * with a NUL character.
*/
static int
tar_gnu_long(struct tar_archive *tar, struct tar_entry *te, char **longp)
diff --git a/lib/dpkg/version.c b/lib/dpkg/version.c
index e9bc4bb..f29c520 100644
--- a/lib/dpkg/version.c
+++ b/lib/dpkg/version.c
@@ -74,8 +74,8 @@ order(int c)
return -1;
else if (c)
return c + 256;
- else
- return 0;
+
+ return 0;
}
static int