Bug#251865: dpkg: Format strings, etc.
Package: dpkg
Version: 1.10.21
Severity: normal
There are several places in current source that could cause problems and
gcc nicely warns about them. Attached patches fixes (most of) them.
Michal
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.4-54.5-default
Locale: LANG=C, LC_CTYPE=cs_CZ.UTF-8
Versions of packages dpkg depends on:
ii dselect 1.10.21 a user tool to manage Debian packa
ii libc6 2.3.2.ds1-12 GNU C Library: Shared libraries an
-- no debconf information
diff -ru dpkg-1.10.18-orig/lib/mlib.c dpkg-1.10.18/lib/mlib.c
--- dpkg-1.10.18-orig/lib/mlib.c 2003-10-25 22:05:12.000000000 +0200
+++ dpkg-1.10.18/lib/mlib.c 2004-01-26 13:23:44.000000000 +0100
@@ -196,7 +196,7 @@
break;
case BUFFER_WRITE_FD:
if((ret= write(data->data.i, buf, length)) < 0 && errno != EINTR)
- ohshite(_("failed in buffer_write(fd) (%i, ret=%li %s): %s"), data->data.i, (long)ret, desc);
+ ohshite(_("failed in buffer_write(fd) (%i, ret=%li): %s"), data->data.i, (long)ret, desc);
break;
case BUFFER_WRITE_NULL:
break;
--- dpkg-1.10.18-orig/dpkg-deb/extract.c 2003-10-25 22:03:20.000000000 +0200
+++ dpkg-1.10.18/dpkg-deb/extract.c 2004-01-26 14:50:01.000000000 +0100
@@ -191,7 +191,7 @@
if (admininfo >= 2)
if (printf(_(" old debian package, version %s.\n"
- " size %ld bytes: control archive= %ld, main archive= %zi.\n"),
+ " size %ld bytes: control archive= %zi, main archive= %ld.\n"),
versionbuf, (long)stab.st_size, ctrllennum,
(long) (stab.st_size - ctrllennum - strlen(ctrllenbuf) - l)) == EOF ||
fflush(stdout)) werr("stdout");
--- dpkg-1.10.18-orig/split/info.c 2003-10-25 22:03:21.000000000 +0200
+++ dpkg-1.10.18/split/info.c 2004-01-26 14:59:00.000000000 +0100
@@ -193,9 +193,9 @@
" ... length: %lu bytes\n"
" ... split every: %lu bytes\n"
" Part number: %d/%d\n"
- " Part length: %lu bytes\n"
+ " Part length: %zi bytes\n"
" Part offset: %lu bytes\n"
- " Part file size (used portion): %zi bytes\n\n"),
+ " Part file size (used portion): %lu bytes\n\n"),
pi->filename,
pi->fmtversion,
pi->package,
@@ -207,7 +207,7 @@
pi->maxpartn,
pi->thispartlen,
pi->thispartoffset,
- pi->filesize);
+ (unsigned long)pi->filesize);
}
void do_info(const char *const *argv) {
--- dpkg-1.10.18-orig/split/main.c 2003-10-25 22:03:21.000000000 +0200
+++ dpkg-1.10.18/split/main.c 2004-01-26 13:31:27.000000000 +0100
@@ -25,6 +25,8 @@
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <dpkg.h>
#include <dpkg-db.h>
Reply to: