[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c88029bab1e02b866848736bf85b1a08ec419d2a
Author: Guillem Jover guil...@debian.org
Date:   Fri Jun 25 18:37:42 2010 +0200

dpkg: Do not use abbreviations for 'distributed'

diff --git a/src/configure.c b/src/configure.c
index 0af95eb..aa2fad5 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -98,7 +98,8 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
if (lstat(cdr2.buf, stab)) {
if (errno == ENOENT)
return;
-   ohshite(_(unable to stat new dist conffile `%.250s'), 
cdr2.buf);
+   ohshite(_(unable to stat new distributed conffile '%.250s'),
+   cdr2.buf);
}
md5hash(pkg, newdisthash, cdr2.buf);
 
@@ -176,7 +177,7 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
case cfo_install | cfof_backup:
strcpy(cdr2rest, DPKGDISTEXT);
if (unlink(cdr2.buf)  errno != ENOENT)
-   warning(_(%s: failed to remove old distrib version 
'%.250s': %s),
+   warning(_(%s: failed to remove old distributed version 
'%.250s': %s),
pkg-name, cdr2.buf, strerror(errno));
strcpy(cdr2rest, DPKGOLDEXT);
if (unlink(cdr2.buf)  errno != ENOENT)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 254b3752d36376de47c2f04fbeb8cd439527c6a0
Author: Guillem Jover guil...@debian.org
Date:   Fri Jun 25 19:16:52 2010 +0200

libdpkg: Remove unused nfields variable

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index fa0a712..75303bc 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -80,8 +80,6 @@ const struct fieldinfo fieldinfos[]= {
   {  NULL   /* sentinel - tells code that list is ended */ 
  }
 };
 
-const int nfields = array_count(fieldinfos);
-
 int parsedb(const char *filename, enum parsedbflags flags,
 struct pkginfo **donep, FILE *warnto, int *warncount) {
   /* warnto, warncount and donep may be null.
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index 5dff80c..0e2fad8 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -85,6 +85,5 @@ struct nickname {
 
 extern const struct fieldinfo fieldinfos[];
 extern const struct nickname nicknames[];
-extern const int nfields; /* = elements in fieldinfos, including the sentinels 
*/
 
 #endif /* LIBDPKG_PARSEDUMP_H */

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 346e694287e999e23e6885e9511bd8503ede1b93
Author: Guillem Jover guil...@debian.org
Date:   Sat Jun 26 03:08:15 2010 +0200

libdpkg: Remove obsolete internal status aliases

The strings are “postinst-failed” for stat_halfconfigured and
“removal-failed” for stat_halfinstalled.

These were used for backward compatibility during upgrades from ancient
dpkg versions. As they should not appear in newer status files, it's
really safe to remove them now.

diff --git a/debian/changelog b/debian/changelog
index 3a3388f..ab691ad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -54,6 +54,8 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 files on package installation. This allows embedded systems to skip
 /usr/share/doc, manpages, etc. Based on work from Tollef Fog Heen and
 Martin Pitt, thanks! Closes: #68788, #68861, #497304, #525567, #583902
+  * Remove obsolete internal status aliases “postinst-failed” for
+stat_halfconfigured and “removal-failed” for stat_halfinstalled.
 
   [ Updated programs translations ]
   * German (Sven Joachim).
diff --git a/lib/dpkg/parsehelp.c b/lib/dpkg/parsehelp.c
index 7542b47..928ffb7 100644
--- a/lib/dpkg/parsehelp.c
+++ b/lib/dpkg/parsehelp.c
@@ -109,11 +109,6 @@ const struct namevalue statusinfos[] = {
   NAMEVALUE_DEF(triggers-awaited, stat_triggersawaited),
   NAMEVALUE_DEF(triggers-pending, stat_triggerspending),
   NAMEVALUE_DEF(installed,stat_installed),
-  /* These are additional entries for reading only, in any order ... */
-  /* XXX: backwards compat., remove. */
-  { .name = postinst-failed, .value = stat_halfconfigured, .length = 15 },
-  /* XXX: backwards compat., remove. */
-  { .name = removal-failed,  .value = stat_halfinstalled, .length = 14 },
   { .name = NULL }
 };
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit edd58fd64fb2f60ab5a2b933c7a9875db0725378
Author: Guillem Jover guil...@debian.org
Date:   Sat Jun 26 03:10:38 2010 +0200

libdpkg: Add missing word in comment to make it grammatical

diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 8e494e5..2f17737 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -217,7 +217,7 @@ trig_enqueue_awaited_pend(struct pkginfo *pend)
  * Fix up packages in state triggers-awaited w/o the corresponding package
  * with pending triggers. This can happen when dpkg was interrupted
  * while in modstatdb_note, and the package in triggers-pending had its
- * state modified but dpkg could not clearing the awaiters.
+ * state modified but dpkg could not finish clearing the awaiters.
  *
  * XXX: possibly get rid of some of the checks done somewhere else for
  *  this condition at run-time.

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0a85d64a50ebb3bb2d5f06f368e68b6f902533fa
Author: Guillem Jover guil...@debian.org
Date:   Sat Jun 26 07:26:25 2010 +0200

dpkg: Place deferred extract rename debug message closer to the action

diff --git a/src/archives.c b/src/archives.c
index ac268bb..2ca526e 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -848,8 +848,6 @@ tar_deferred_extract(struct fileinlist *files, struct 
pkginfo *pkg)
 if (!(cfile-namenode-flags  fnnf_deferred_rename))
   continue;
 
-debug(dbg_eachfiledetail, deferred extract needs rename);
-
 usenode = namenodetouse(cfile-namenode, pkg);
 usename = usenode-name + 1; /* Skip the leading '/'. */
 
@@ -873,6 +871,8 @@ tar_deferred_extract(struct fileinlist *files, struct 
pkginfo *pkg)
 }
 #endif
 
+debug(dbg_eachfiledetail, deferred extract needs rename);
+
 if (rename(fnamenewvb.buf, fnamevb.buf))
   ohshite(_(unable to install new version of `%.255s'),
   cfile-namenode-name);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c838e48663200b40ad13eec3ac5a40d3b12bff2c
Author: Guillem Jover guil...@debian.org
Date:   Sat Jun 26 12:23:09 2010 +0200

libdpkg: Check in test-case that : is an illegal character in revision

diff --git a/lib/dpkg/test/t-version.c b/lib/dpkg/test/t-version.c
index c7dd035..3c37bf4 100644
--- a/lib/dpkg/test/t-version.c
+++ b/lib/dpkg/test/t-version.c
@@ -140,7 +140,8 @@ test_version_parse(void)
test_fail(parseversion(a, 0:!...@$%/|\\()[]{};,=*^'-0) == NULL);
 
/* Test invalid characters in revision. */
-   test_fail(parseversion(a, 0:0...@$%/|\\()[]{};,=*^') == NULL);
+   test_fail(parseversion(a, 0:0-0:0) == NULL);
+   test_fail(parseversion(a, 0:0...@$%/|\\()[]{}:;,=*^') == NULL);
 
/* FIXME: Complete. */
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c69901cdda6500450f026d02b439b941e7cb147a
Author: Guillem Jover guil...@debian.org
Date:   Sat Jun 26 12:38:27 2010 +0200

Remove 'vsnprintf return value check' item from TODO after code review

The few places where the vsnprintf callers are not checking the return
value, are about to ohshit anyway so there's no real damage by not
doing the check, the rest are harmless.

diff --git a/TODO b/TODO
index ffaa013..1957b8b 100644
--- a/TODO
+++ b/TODO
@@ -35,8 +35,6 @@ TODO
- Cleanup status chars - strings hardcoded mappings all over the place.
  (Fix tied field enum with its dselect description (pkgdisplay.cc))
- Refactor src/processarc.c.
-   - Make sure all vsnprintf callers are checking the return value, as the
- system version will not ohsite on us.
- Fix naming consistency of next/prev members.
- Split dpkg.h into independent headers.
- Do more unused header include removal.

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 1079ed11dcbf3d9b20e841fb22fd501740e746b0
Author: Guillem Jover guil...@debian.org
Date:   Sun Jun 27 10:27:10 2010 +0200

build: Add a top-level update-po target

This will ease maintainers and translators job when wanting to update
the po files.

diff --git a/Makefile.am b/Makefile.am
index b1b929c..b6d634e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,6 +75,14 @@ doc: doc/Doxyfile
 clean-local:
rm -rf doc/html/
 
+.PHONY: update-po
+
+update-po:
+   $(MAKE) -C po update-po
+   $(MAKE) -C scripts/po update-po
+   $(MAKE) -C dselect/po update-po
+   $(MAKE) -C man update-po
+
 .PHONY: ChangeLog
 DISTCLEANFILES = ChangeLog
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-115-gad9b46b

2010-06-27 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ad9b46bf8194a68291224d8a7f93af30d74982c9
Author: Guillem Jover guil...@debian.org
Date:   Sun Jun 27 10:48:03 2010 +0200

Update Catalan translation

diff --git a/debian/changelog b/debian/changelog
index 21b21c0..0bf4d10 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 Closes: #574704
 
   [ Updated programs translations ]
+  * Catalan (Guillem Jover).
   * German (Sven Joachim).
   * Russian (Yuri Kozlov). Closes: #579149
   * Swedish (Peter Krefting).
diff --git a/po/ca.po b/po/ca.po
index cc3f294..6b5d946 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -10,7 +10,7 @@ msgstr 
 Project-Id-Version: dpkg 1.15.1\n
 Report-Msgid-Bugs-To: debian-d...@lists.debian.org\n
 POT-Creation-Date: 2010-06-27 10:40+0200\n
-PO-Revision-Date: 2010-03-12 00:09+0100\n
+PO-Revision-Date: 2010-06-27 10:46+0200\n
 Last-Translator: Jordi Mallach jo...@debian.org\n
 Language-Team: Catalan debian-l10n-cata...@lists.debian.org\n
 Language: ca\n
@@ -3127,7 +3127,7 @@ msgstr (no hi ha cap descripció disponible)
 #: src/processarc.c:74
 #, c-format
 msgid .../%s
-msgstr 
+msgstr …/%s
 
 #: src/processarc.c:132
 msgid cannot access archive

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 28ca2d0e5c8d47abf2907b697a7711e6a7689293
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 2 06:07:41 2010 +0200

dpkg-deb: Use new dpkg_ar library functions instead of ad-hoc code

diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index ccaae00..40d6c0f 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -31,7 +31,6 @@
 #include limits.h
 #include ctype.h
 #include string.h
-#include time.h
 #include dirent.h
 #include unistd.h
 #include stdbool.h
@@ -218,9 +217,8 @@ void do_build(const char *const *argv) {
   FILE *ar, *cf;
   int p1[2], p2[2], p3[2], warns, n, c, subdir, gzfd;
   pid_t c1,c2,c3;
-  struct stat controlstab, datastab, mscriptstab, debarstab;
+  struct stat controlstab, mscriptstab, debarstab;
   char conffilename[MAXCONFFILENAME+1];
-  time_t thetime= 0;
   struct file_info *fi;
   struct file_info *symlist = NULL;
   struct file_info *symlist_end = NULL;
@@ -419,33 +417,27 @@ void do_build(const char *const *argv) {
   close(p1[0]);
   subproc_wait_check(c2, gzip -9c, 0);
   subproc_wait_check(c1, tar -cf, 0);
-  if (fstat(gzfd,controlstab)) ohshite(_(failed to fstat tmpfile 
(control)));
+
+  if (lseek(gzfd, 0, SEEK_SET))
+ohshite(_(failed to rewind tmpfile (control)));
+
   /* We have our first file for the ar-archive. Write a header for it to the
* package and insert it.
*/
   if (oldformatflag) {
+if (fstat(gzfd, controlstab))
+  ohshite(_(failed to fstat tmpfile (control)));
 if (fprintf(ar, %-8s\n%ld\n, OLDARCHIVEVERSION, 
(long)controlstab.st_size) == EOF)
   werr(debar);
+fd_fd_copy(gzfd, fileno(ar), -1, _(control));
   } else {
-thetime = time(NULL);
-if (fprintf(ar,
-DPKG_AR_MAGIC
-%-16s%-12lu0 0 100644  %-10ld`\n
-ARCHIVEVERSION \n
-%s
-%-16s%-12lu0 0 100644  %-10ld`\n,
-DEBMAGIC,
-thetime,
-(long)sizeof(ARCHIVEVERSION),
-(sizeof(ARCHIVEVERSION)1) ? \n : ,
-ADMINMEMBER,
-(unsigned long)thetime,
-(long)controlstab.st_size) == EOF)
-  werr(debar);
+const char deb_magic[] = ARCHIVEVERSION \n;
+
+dpkg_ar_put_magic(debar, fileno(ar));
+dpkg_ar_member_put_mem(debar, fileno(ar), DEBMAGIC,
+   deb_magic, strlen(deb_magic));
+dpkg_ar_member_put_file(debar, fileno(ar), ADMINMEMBER, gzfd);
   }
-
-  if (lseek(gzfd,0,SEEK_SET)) ohshite(_(failed to rewind tmpfile (control)));
-  fd_fd_copy(gzfd, fileno(ar), -1, _(control));
 
   /* Control is done, now we need to archive the data. Start by creating
* a new temporary file. Immediately unlink the temporary file so others
@@ -524,23 +516,9 @@ void do_build(const char *const *argv) {
 
 sprintf(datamember, %s%s, DATAMEMBER, compressor-extension);
 
-if (fstat(gzfd, datastab))
-  ohshite(_(failed to fstat tmpfile (data)));
-if (fprintf(ar,
-%s
-%-16s%-12lu0 0 100644  %-10ld`\n,
-(controlstab.st_size  1) ? \n : ,
-datamember,
-(unsigned long)thetime,
-(long)datastab.st_size) == EOF)
-  werr(debar);
-
 if (lseek(gzfd,0,SEEK_SET)) ohshite(_(failed to rewind tmpfile (data)));
-fd_fd_copy(gzfd, fileno(ar), -1, _(cat (data)));
 
-if (datastab.st_size  1)
-  if (putc('\n',ar) == EOF)
-werr(debar);
+dpkg_ar_member_put_file(debar, fileno(ar), datamember, gzfd);
   }
   if (fflush(ar))
 ohshite(_(unable to flush file '%s'), debar);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit f2115151c19ff37b305296c23225807b0832086b
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 2 06:15:26 2010 +0200

dpkg-split: Rewrite mksplit in C

diff --git a/debian/changelog b/debian/changelog
index ff780b7..7bedacf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 stat_halfconfigured and “removal-failed” for stat_halfinstalled.
   * Check version syntax when parsing it from libdpkg based programs.
 Closes: #574704
+  * Rewrite mksplit in C, and merge it into dpkg-split.
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/debian/dpkg.install b/debian/dpkg.install
index 1b1b998..c3106d6 100644
--- a/debian/dpkg.install
+++ b/debian/dpkg.install
@@ -12,7 +12,6 @@ usr/bin/dpkg-split
 usr/bin/dpkg-statoverride
 usr/bin/dpkg-trigger
 usr/bin/update-alternatives
-usr/lib/dpkg/mksplit
 usr/sbin
 usr/share/dpkg
 usr/share/locale/*/LC_MESSAGES/dpkg.mo
diff --git a/dpkg-split/.gitignore b/dpkg-split/.gitignore
index dedc3fc..26aab39 100644
--- a/dpkg-split/.gitignore
+++ b/dpkg-split/.gitignore
@@ -1,2 +1 @@
 dpkg-split
-mksplit
diff --git a/dpkg-split/Makefile.am b/dpkg-split/Makefile.am
index 6f6043c..64a1d27 100644
--- a/dpkg-split/Makefile.am
+++ b/dpkg-split/Makefile.am
@@ -24,20 +24,5 @@ dpkg_split_LDADD = \
../lib/compat/libcompat.a \
$(LIBINTL)
 
-
-pkglib_SCRIPTS = mksplit
-EXTRA_DIST = mksplit.pl
-CLEANFILES = $(pkglib_SCRIPTS)
-
-
-do_perl_subst = $(AM_V_GEN) sed -e s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):
-
-
-%: %.pl Makefile
-   @test -d `dirname $...@` || $(mkdir_p) `dirname $...@`
-   $(do_perl_subst) $ $@
-   $(AM_V_at) chmod +x $@
-
-
 install-data-local:
$(mkdir_p) $(DESTDIR)$(admindir)/parts
diff --git a/dpkg-split/mksplit.pl b/dpkg-split/mksplit.pl
deleted file mode 100644
index 2950b1e..000
--- a/dpkg-split/mksplit.pl
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/perl --
-# This script is only supposed to be called by dpkg-split.
-# Its arguments are:
-#  sourcefile partsize prefix totalsize partsizeallow 
msdostruncyesno
-# Stdin is also redirected from the source archive by dpkg-split.
-
-# Copyright © 1995 Ian Jackson i...@chiark.greenend.org.uk
-#
-# 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 http://www.gnu.org/licenses/.
-
-...@argv == 6 || die mksplit: bad invocation\n;
-
-($sourcefile,$partsize,$prefix,$orgsize,$partsizeallow,$msdos) = @ARGV;
-
-sub output {
-$!=0; $rv= `$_[0]`; $?  die mksplit $_[0]: $! $?\n;
-$rv =~ s/\n$//; $rv =~ s/\s+$//; $rv =~ s/^\s+//;
-$rv;
-}
-
-$myversion='2.1';
-$csum= output(md5sum \$sourcefile\);
-$csum =~ s/\s.*//;
-$package= output(dpkg-deb --field \$sourcefile\ Package);
-$version= output(dpkg-deb --field \$sourcefile\ Version);
-$revision= output(dpkg-deb --field \$sourcefile\ Package_Revision);
-$version.= -$revision if length($revision);
-$nparts=int(($orgsize+$partsize-1)/$partsize);
-$startat=0;
-$showpartnum=1;
-
-$|=1;
-print(Splitting package $package into $nparts parts: );
-
-$msdos= ($msdos eq 'yes');
-if ($msdos) {
-$prefixdir= $prefix; $prefixdir =~ s:(/?)/*[^/]+$:$1:;
-$cleanprefix= $prefix; $cleanprefix =~ s:^.*/+::;
-$cleanprefix =~ y/A-Za-z0-9+/a-za-z0-9x/;
-$cleanprefix =~ y/a-z0-9//cd;
-}
-
-sub add {
-$data .=
-sprintf(%-16s%-12d0 0 100644  %-10d%c\n%s%s,
-$_[0], time, length($_[1]), 0140, $_[1],
-(length($_[1])  1) ? \n : );
-} 
-
-while ($startat  $orgsize) {
-$dsp= $myversion\n$package\n$version\n$csum\n$orgsize\n$partsize\n.
-  $showpartnum/$nparts\n;
-defined($thispartreallen= read(STDIN,$pd,$partsize)) || die mksplit: 
read: $!\n;
-$data= !arch\n;
-print($showpartnum );
-add('debian-split',$dsp);
-add(data.$showpartnum,$pd);
-if ($thispartreallen  $partsizeallow) {
-die Header is too long, making part too long.  Your package name or 
version\n.
-numbers must be extraordinarily long, or something.  Giving 
up.\n;
-}
-if ($msdos) {
-$basename= ${showpartnum}of$nparts.$cleanprefix;
-$basename= substr($basename,0,9);
-$basename =~ s/^([^.]*)\.(.*)$/$2$1/;
-$basename= $prefixdir$basename;
-} else {
-$basename= $prefix.${showpartnum}of$nparts;
-}
-open(O, $basename.deb

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit b7b59ee6ff98188627346998829f1df51a9bbb12
Author: Mikhail Gusarov dotted...@dottedmag.net
Date:   Wed Oct 14 02:36:44 2009 +0700

dpkg-divert: Add new test-case

Devel::Cover reports 97% coverage. Remaining branches are hard-to-test
without root privilege error handling.

[guil...@debian.org:
 - Add new test into test_cases.
 - Run program from builddir.
 - Do not check for usage output on badusage.
 - Use note() instead of diag().
 - Sort database and list output.
 - Skip some tests when under fakeroot. ]

Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index c019619..718f77f 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -179,7 +179,8 @@ test_cases = \
t/750_Dpkg_Substvars.t \
t/800_Dpkg_IPC.t \
t/850_Dpkg_Compression.t \
-   t/910_merge_changelogs.t
+   t/910_merge_changelogs.t \
+   t/950_dpkg_divert.t
 
 check_DATA = \
$(test_tmpdir)/200_Dpkg_Shlibs/objdump.basictags-amd64 \
diff --git a/scripts/t/950_dpkg_divert.t b/scripts/t/950_dpkg_divert.t
new file mode 100644
index 000..f65d1e5
--- /dev/null
+++ b/scripts/t/950_dpkg_divert.t
@@ -0,0 +1,555 @@
+# -*- mode: cperl;-*-
+#
+# 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 http://www.gnu.org/licenses/.
+
+use Test::More;
+use File::Spec;
+use Dpkg::IPC;
+
+use strict;
+use warnings;
+
+my $srcdir = $ENV{srcdir} || '.';
+my $builddir = $ENV{builddir} || '.';
+my $tmpdir = 't.tmp/950_dpkg_divert';
+my $admindir = File::Spec-rel2abs($tmpdir/admindir);
+my $testdir = File::Spec-rel2abs($tmpdir/testdir);
+
+my @dd = ($builddir/dpkg-divert);
+
+plan tests = 235;
+
+sub cleanup {
+system(rm -rf $tmpdir  mkdir -p $testdir  mkdir -p $admindir);
+}
+
+sub install_diversions {
+my ($txt) = @_;
+open(O,  $admindir/diversions);
+print O $txt;
+close(O);
+}
+
+sub call {
+my ($prog, $args, %opts) = @_;
+
+my ($output, $error);
+spawn(exec = [...@$prog, @$args], wait_child = 1, nocheck = 1,
+  to_pipe = \$output, error_to_pipe = \$error, %opts);
+
+if ($opts{'expect_failure'}) {
+ok($? != 0, @$args should fail);
+} else  {
+ok($? == 0, @$args should not fail);
+}
+
+if (defined $opts{'expect_stdout'}) {
+my (@output) = $output;
+my (@expect) = split(/^/, $opts{'expect_stdout'});
+if (defined $opts{'expect_sorted_stdout'}) {
+@output = sort @output;
+@expect = sort @expect;
+}
+is(join('', @output), join('', @expect), @$args stdout);
+}
+if (defined $opts{'expect_stdout_like'}) {
+like(join('', $output), $opts{'expect_stdout_like'}, @$args 
stdout);
+}
+if (defined $opts{'expect_stderr'}) {
+is(join('', $error), $opts{'expect_stderr'}, @$args stderr);
+}
+if (defined $opts{'expect_stderr_like'}) {
+like(join('', $error), $opts{'expect_stderr_like'}, @$args stderr);
+}
+
+close($output);
+close($error);
+}
+
+sub call_divert {
+my ($params, %opts) = @_;
+call([...@dd, '--admindir', $admindir], $params, %opts);
+}
+
+sub call_divert_sort {
+my ($params, %opts) = @_;
+$opts{expect_sorted_stdout} = 1;
+call_divert($params, %opts);
+}
+
+sub diversions_pack {
+my (@data) = @_;
+my @data_packed;
+
+for (my ($i) = 0; $i  $#data; $i += 3) {
+push @data_packed, [ @data[$i .. $i + 2] ];
+}
+
+return sort { $a-[0] cmp $b-[0] } @data_packed;
+}
+
+sub diversions_eq {
+my (@expected) = split /^/, shift;
+open(O, $admindir/diversions);
+my (@contents) = O;
+close(O);
+
+my (@expected_pack) = diversions_pack(@expected);
+my (@contents_pack) = diversions_pack(@contents);
+
+is_deeply(\...@contents_pack, \...@expected_pack, diversions contents);
+}
+
+### Tests
+
+cleanup();
+
+note(Command line parsing testing);
+
+my $usagere = qr/.*Usage.*dpkg-divert.*Commands.*Options.*/s;
+
+sub call_divert_badusage {
+my ($args, $err) = @_;
+call_divert($args, expect_failure = 1, expect_stderr_like = $err);
+}
+
+call_divert(['--help'], expect_stdout_like = $usagere,
+expect_stderr = '');
+call_divert(['--version'], expect_stdout_like = 
qr/.*dpkg-divert.*Copyright.*free software.*/s,
+expect_stderr

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea
Author: Guillem Jover guil...@debian.org
Date:   Fri Feb 19 05:57:29 2010 +0100

dpkg-divert: Rewrite in C

diff --git a/debian/changelog b/debian/changelog
index 7bedacf..eafdc9f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -61,6 +61,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Check version syntax when parsing it from libdpkg based programs.
 Closes: #574704
   * Rewrite mksplit in C, and merge it into dpkg-split.
+  * Rewrite dpkg-divert in C.
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d73536c..f04bfd4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -38,6 +38,7 @@ src/archives.c
 src/cleanup.c
 src/configure.c
 src/depcon.c
+src/divertcmd.c
 src/divertdb.c
 src/enquiry.c
 src/errors.c
@@ -69,5 +70,3 @@ dpkg-split/split.c
 
 utils/start-stop-daemon.c
 utils/update-alternatives.c
-
-scripts/dpkg-divert.pl
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 403beff..d12947c 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -3,7 +3,6 @@ dpkg-buildflags
 dpkg-buildpackage
 dpkg-checkbuilddeps
 dpkg-distaddfile
-dpkg-divert
 dpkg-genchanges
 dpkg-gencontrol
 dpkg-gensymbols
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 718f77f..4589fa9 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -8,7 +8,6 @@ bin_SCRIPTS = \
dpkg-buildpackage \
dpkg-checkbuilddeps \
dpkg-distaddfile \
-   dpkg-divert \
dpkg-genchanges \
dpkg-gencontrol \
dpkg-gensymbols \
@@ -43,7 +42,6 @@ EXTRA_DIST = \
dpkg-scansources.pl \
dpkg-shlibdeps.pl \
dpkg-source.pl \
-   dpkg-divert.pl \
dpkg-vendor.pl \
changelog/debian.pl \
$(test_cases) \
diff --git a/scripts/dpkg-divert.pl b/scripts/dpkg-divert.pl
deleted file mode 100755
index 949a215..000
--- a/scripts/dpkg-divert.pl
+++ /dev/null
@@ -1,369 +0,0 @@
-#!/usr/bin/perl
-#
-# dpkg-divert
-#
-# 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 http://www.gnu.org/licenses/.
-
-BEGIN { # Work-around for bug #479711 in perl
-$ENV{PERL_DL_NONLAZY} = 1;
-}
-
-use strict;
-use warnings;
-
-use POSIX qw(:errno_h);
-use Dpkg;
-use Dpkg::Gettext;
-
-textdomain(dpkg);
-
-sub version {
-printf _g(Debian %s version %s.\n), $progname, $version;
-
-printf _g(
-Copyright (C) 1995 Ian Jackson.
-Copyright (C) 2000,2001 Wichert Akkerman.);
-
-printf \n . _g(
-This is free software; see the GNU General Public License version 2 or
-later for copying conditions. There is NO warranty.
-);
-}
-
-sub usage {
-printf(_g(
-Usage: %s [option ...] command
-
-Commands:
-  [--add] file   add a diversion.
-  --remove file  remove the diversion.
-  --list [glob-pattern]  show file diversions.
-  --listpackage file show what package diverts the file.
-  --truename filereturn the diverted file.
-
-Options:
-  --package package  name of the package whose copy of file will not
- be diverted.
-  --local  all packages' versions are diverted.
-  --divert divert-to the name used by other packages' versions.
-  --rename actually move the file aside (or back).
-  --admindir directory   set the directory with the diversions file.
-  --test   don't do anything, just demonstrate.
-  --quiet  quiet operation, minimal output.
-  --help   show this help message.
-  --versionshow the version.
-
-When adding, default is --local and --divert original.distrib.
-When removing, --package or --local and --divert must match if specified.
-Package preinst/postrm scripts should always specify --package and --divert.
-), $progname);
-}
-
-my $testmode = 0;
-my $dorename = 0;
-my $verbose = 1;
-my $mode = '';
-my $package = undef;
-my $divertto = undef;
-my @contest;
-my @altname;
-my @package;
-my $file;
-$|=1;
-
-
-# FIXME: those should be local.
-my ($rsrc, $rdest);
-my (@ssrc, @sdest);
-
-sub checkmanymodes {
-return unless $mode;
-badusage(sprintf(_g(two commands specified: %s and --%s), $_, $mode));
-}
-
-while (@ARGV) {
-$_= shift(@ARGV);
-last if m/^--$/;
-if (!m/^-/) {
-unshift(@ARGV,$_); last;
-} elsif (m/^--help

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3b8074a91047c3308309f93f1bf344c339044e98
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 2 06:14:04 2010 +0200

Use linux-any wildcard for libselinux1-dev Build-Depends

Instead of using a list of negated architectures. This will make the job
easier for new ports. And it's just more correct.

diff --git a/debian/changelog b/debian/changelog
index eafdc9f..fad8943 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -62,6 +62,8 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 Closes: #574704
   * Rewrite mksplit in C, and merge it into dpkg-split.
   * Rewrite dpkg-divert in C.
+  * Use linux-any wildcard for libselinux1-dev Build-Depends instead of
+using a list of negated architectures.
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/debian/control b/debian/control
index 191c8c6..b2bb177 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,7 @@ Standards-Version: 3.8.4
 Build-Depends: debhelper (= 6.0.7), pkg-config,
  gettext (= 0.18), po4a (= 0.33.1),
  libncursesw5-dev, zlib1g-dev (= 1:1.1.3-19.1), libbz2-dev, flex,
- libselinux1-dev (= 1.28-4) [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64],
+ libselinux1-dev (= 1.28-4) [linux-any],
  libtimedate-perl, libio-string-perl
 
 Package: libdpkg-dev

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0309242811c39aedda81521019ece0b3ffa16cc7
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 2 12:36:06 2010 +0200

Bump Standards-Version to 3.9.0

diff --git a/debian/changelog b/debian/changelog
index 7887666..ae1c951 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -67,6 +67,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Use Breaks instead of Conflicts in dpkg, dpkg-dev and libdpkg-perl binary
 packages.
   * Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl.
+  * Bump Standards-Version to 3.9.0.
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/debian/control b/debian/control
index 5be2306..ae0da12 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Bugs: debbugs://bugs.debian.org
 Homepage: http://wiki.debian.org/Teams/Dpkg
 Vcs-Browser: http://git.debian.org/?p=dpkg/dpkg.git
 Vcs-Git: git://git.debian.org/git/dpkg/dpkg.git
-Standards-Version: 3.8.4
+Standards-Version: 3.9.0
 Build-Depends: debhelper (= 6.0.7), pkg-config,
  gettext (= 0.18), po4a (= 0.33.1),
  libncursesw5-dev, zlib1g-dev (= 1:1.1.3-19.1), libbz2-dev, flex,

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2a2c2ef9188d718c914000fc6ab48f33acc54ddb
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 2 11:56:47 2010 +0200

Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl

diff --git a/debian/changelog b/debian/changelog
index 8e58318..7887666 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -66,6 +66,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 using a list of negated architectures.
   * Use Breaks instead of Conflicts in dpkg, dpkg-dev and libdpkg-perl binary
 packages.
+  * Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl.
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/debian/control b/debian/control
index dca09ba..5be2306 100644
--- a/debian/control
+++ b/debian/control
@@ -32,7 +32,8 @@ Architecture: any
 Essential: yes
 Pre-Depends: ${shlibs:Depends}, coreutils (= 5.93-1), xz-utils
 Depends: ${misc:Depends}
-Breaks: dpkg-dev ( 1.14.16), apt ( 0.7.7), aptitude ( 0.4.7-1),
+Breaks: dpkg-dev ( 1.14.16), libdpkg-perl ( 1.15.8),
+ apt ( 0.7.7), aptitude ( 0.4.7-1),
 # install-info transition
 # see http://wiki.debian.org/Transitions/DpkgToGnuInstallInfo
  jed ( 1:0.99.18+dfsg.1-13), xjed ( 1:0.99.18+dfsg.1-13),
@@ -71,7 +72,7 @@ Depends: dpkg (= 1.15.4), perl, libtimedate-perl, 
${misc:Depends}
 Recommends: bzip2, xz-utils
 Suggests: debian-keyring, gnupg, gpgv, binutils, patch
 Breaks: dpkg-dev ( 1.15.6)
-Replaces: dpkg-dev ( 1.15.6)
+Replaces: dpkg ( 1.15.8), dpkg-dev ( 1.15.6)
 Description: Dpkg perl modules
  This package provides the perl modules used by the scripts
  in dpkg-dev. They cover a wide range of functionalities. Among them
diff --git a/debian/dpkg.install b/debian/dpkg.install
index c3106d6..511effd 100644
--- a/debian/dpkg.install
+++ b/debian/dpkg.install
@@ -26,8 +26,6 @@ usr/share/man/{*/*,*}/dpkg.cfg.5
 usr/share/man/{*/*,*}/dpkg.1
 usr/share/man/{*/*,*}/start-stop-daemon.8
 usr/share/man/{*/*,*}/update-alternatives.8
-usr/share/perl5/Dpkg.pm
-usr/share/perl5/Dpkg/Gettext.pm
 var/lib/dpkg/alternatives
 var/lib/dpkg/info
 var/lib/dpkg/parts
diff --git a/debian/libdpkg-perl.install b/debian/libdpkg-perl.install
index 72438e4..4d4c23d 100644
--- a/debian/libdpkg-perl.install
+++ b/debian/libdpkg-perl.install
@@ -1,4 +1,4 @@
 usr/lib/dpkg/parsechangelog
 usr/share/locale/*/LC_MESSAGES/dpkg-dev.mo
 usr/share/man/man3/Dpkg*.3
-usr/share/perl5/Dpkg
+usr/share/perl5/Dpkg*
diff --git a/debian/rules b/debian/rules
index b362a76..b4b70b8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -108,7 +108,7 @@ binary-arch: install
 binary-indep: install
dh_testdir -i
dh_testroot -i
-   dh_install --sourcedir=debian/tmp -i -XDpkg/Gettext.pm
+   dh_install --sourcedir=debian/tmp -i
dh_installcron -i
dh_installchangelogs -i ChangeLog*
dh_installdocs -i
diff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pm
index b6ba75d..283f041 100644
--- a/scripts/Dpkg.pm
+++ b/scripts/Dpkg.pm
@@ -18,12 +18,6 @@ use warnings;
 
 our $VERSION = 1.00;
 
-# This module is the only one provided by dpkg and not dpkg-dev
-#
-# Don't add things here if you don't need them in dpkg itself.
-# If you do, and also use the new stuff in dpkg-dev, you'll have to bump
-# the dependency of dpkg-dev on dpkg.
-
 use base qw(Exporter);
 our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0238821c66112e5403dd8abbf6eca0962866d944
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 2 13:03:44 2010 +0200

libdpkg: Refactor file lock setup into file_lock_setup()

diff --git a/lib/dpkg/file.c b/lib/dpkg/file.c
index f46d8e7..12a67f2 100644
--- a/lib/dpkg/file.c
+++ b/lib/dpkg/file.c
@@ -54,16 +54,25 @@ file_copy_perms(const char *src, const char *dst)
 }
 
 static void
+file_lock_setup(struct flock *fl, short type)
+{
+   fl-l_type = type;
+   fl-l_whence = SEEK_SET;
+   fl-l_start = 0;
+   fl-l_len = 0;
+   fl-l_pid = 0;
+}
+
+static void
 file_unlock_cleanup(int argc, void **argv)
 {
int lockfd = *(int*)argv[0];
struct flock fl;
 
assert(lockfd = 0);
-   fl.l_type = F_UNLCK;
-   fl.l_whence = SEEK_SET;
-   fl.l_start = 0;
-   fl.l_len = 0;
+
+   file_lock_setup(fl, F_UNLCK);
+
if (fcntl(lockfd, F_SETLK, fl) == -1)
ohshite(_(unable to unlock dpkg status database));
 }
@@ -84,10 +93,7 @@ file_lock(int *lockfd, const char *filename,
 
setcloexec(*lockfd, filename);
 
-   fl.l_type = F_WRLCK;
-   fl.l_whence = SEEK_SET;
-   fl.l_start = 0;
-   fl.l_len = 0;
+   file_lock_setup(fl, F_WRLCK);
 
if (fcntl(*lockfd, emsg_eagain ? F_SETLK : F_SETLKW, fl) == -1) {
if (emsg_eagain  (errno == EACCES || errno == EAGAIN))

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c3d9eea8d03d93eed6e2d87a97acfca5562b2b32
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 2 13:13:01 2010 +0200

dpkg: Detect locked databases on --audit

Detect when another process has locked the database, and mention that
problematic dpkg --audit results might be due to ongoing operations.

Closes: #80252

diff --git a/debian/changelog b/debian/changelog
index ae1c951..a2d130e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -68,6 +68,9 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 packages.
   * Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl.
   * Bump Standards-Version to 3.9.0.
+  * Detect when another process has locked the database, and mention that
+problematic dpkg --audit results might be due to ongoing operations.
+Closes: #80252
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c
index 02c1c35..bc39448 100644
--- a/lib/dpkg/dbmodify.c
+++ b/lib/dpkg/dbmodify.c
@@ -142,10 +142,40 @@ static const struct fni {
   {   NULL, NULL  }
 };
 
+static int dblockfd = -1;
+
+bool
+modstatdb_is_locked(const char *admindir)
+{
+  struct varbuf lockfile = VARBUF_INIT;
+  int lockfd;
+  bool locked;
+
+  varbufprintf(lockfile, %s/%s, admindir, LOCKFILE);
+
+  if (dblockfd == -1) {
+lockfd = open(lockfile.buf, O_RDONLY);
+if (lockfd == -1)
+  ohshite(_(unable to open lock file %s for testing), lockfile.buf);
+  } else {
+lockfd = dblockfd;
+  }
+
+  locked = file_is_locked(lockfd, lockfile.buf);
+
+  /* We only close the file if there was no lock open, otherwise we would
+   * release the existing lock on close. */
+  if (dblockfd == -1)
+close(lockfd);
+
+  varbuf_destroy(lockfile);
+
+  return locked;
+}
+
 void
 modstatdb_lock(const char *admindir)
 {
-  static int dblockfd = -1;
   int n;
   char *dblockfile = NULL;
 
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index c2e57a4..3590d42 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -199,6 +199,7 @@ enum modstatdb_rw {
   msdbrw_noavail= 0100,
 };
 
+bool modstatdb_is_locked(const char *admindir);
 void modstatdb_lock(const char *admindir);
 void modstatdb_unlock(void);
 enum modstatdb_rw modstatdb_init(const char *admindir, enum modstatdb_rw 
reqrwflags);
diff --git a/lib/dpkg/file.c b/lib/dpkg/file.c
index 12a67f2..40fbbea 100644
--- a/lib/dpkg/file.c
+++ b/lib/dpkg/file.c
@@ -83,6 +83,28 @@ file_unlock(void)
pop_cleanup(ehflag_normaltidy); /* Calls file_unlock_cleanup. */
 }
 
+/**
+ * Check if a file has a lock acquired.
+ *
+ * @param lockfd The file descriptor for the lock.
+ * @param filename The file name associated to the file descriptor.
+ */
+bool
+file_is_locked(int lockfd, const char *filename)
+{
+   struct flock fl;
+
+   file_lock_setup(fl, F_WRLCK);
+
+   if (fcntl(lockfd, F_GETLK, fl) == -1)
+   ohshit(_(unable to check file '%s' lock status), filename);
+
+   if (fl.l_type == F_WRLCK  fl.l_pid != getpid())
+   return true;
+   else
+   return false;
+}
+
 /* lockfd must be allocated statically as its addresses is passed to
  * a cleanup handler. */
 void
diff --git a/lib/dpkg/file.h b/lib/dpkg/file.h
index ee14206..24dca2c 100644
--- a/lib/dpkg/file.h
+++ b/lib/dpkg/file.h
@@ -21,6 +21,8 @@
 #ifndef LIBDPKG_FILE_H
 #define LIBDPKG_FILE_H
 
+#include stdbool.h
+
 #include dpkg/macros.h
 
 DPKG_BEGIN_DECLS
@@ -30,6 +32,7 @@ DPKG_BEGIN_DECLS
  */
 void file_copy_perms(const char *src, const char *dst);
 
+bool file_is_locked(int lockfd, const char *filename);
 void file_lock(int *lockfd, const char *filename,
const char *emsg, const char *emsg_eagain);
 void file_unlock(void);
diff --git a/src/enquiry.c b/src/enquiry.c
index af45426..d8e1a4f 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -124,6 +124,7 @@ static void describebriefly(struct pkginfo *pkg) {
 
 void audit(const char *const *argv) {
   const struct badstatinfo *bsi;
+  bool head_running = false;
 
   if (*argv)
 badusage(_(--%s takes no arguments), cipaction-olong);
@@ -138,6 +139,13 @@ void audit(const char *const *argv) {
 it= iterpkgstart(); 
 while ((pkg= iterpkgnext(it))) {
   if (!bsi-yesno(pkg,bsi)) continue;
+  if (!head_running) {
+if (modstatdb_is_locked(admindir))
+  puts(_(
+Another process has locked the database for writing, and might currently be\n
+modifying it, some of the following problems might just be due to that.\n));
+head_running = true;
+  }
   if (!head) {
 fputs(gettext(bsi-explanation),stdout);
 head = true;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a

2010-07-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit bd0ae9a42b06f09223383e67edb262041e2bd98d
Author: Henning Makholm henn...@makholm.net
Date:   Sat Jul 3 04:30:04 2010 +0200

Add new dpkg --force-confask option

The option forces a conffile prompt when the conffile from the new
package does not differ from the previous one version.

Closes: #102609

Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index a2d130e..acf3793 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -71,6 +71,9 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Detect when another process has locked the database, and mention that
 problematic dpkg --audit results might be due to ongoing operations.
 Closes: #80252
+  * Add new dpkg --force-confask option that forces a conffile prompt when
+the conffile from the new package does not differ from the previous one.
+Thanks to Henning Makholm henn...@makholm.net. Closes: #102609
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/man/dpkg.1 b/man/dpkg.1
index d0d6326..d550d11 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -427,6 +427,13 @@ there is no default action it will stop to ask the user 
unless
 \fB\-\-force\-confnew\fP or \fB\-\-force\-confold\fP is also been given, in
 which case it will use that to decide the final action.
 
+\fBconfask\fP:
+If a conffile has been modified always offer to replace it with the
+version in the package, even if the version in the package did not
+change. If one of \fB\-\-force\-confnew\fP, \fB\-\-force\-confold\fP,
+or \fB\-\-force\-confdef\fP is also given, it will be used to decide
+the final action.
+
 \fBoverwrite\fP:
 Overwrite one package's file with another's file.
 
diff --git a/src/configure.c b/src/configure.c
index aa2fad5..f0a7053 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -141,7 +141,12 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
} else {
useredited = strcmp(conff-hash, currenthash) != 0;
distedited = strcmp(conff-hash, newdisthash) != 0;
-   what = conffoptcells[useredited][distedited];
+
+   if (fc_conff_ask  useredited)
+   what = cfo_prompt_keep;
+   else
+   what = conffoptcells[useredited][distedited];
+
if (!strcmp(currenthash, NONEXISTENTFLAG))
what |= cfof_userrmd;
}
diff --git a/src/main.c b/src/main.c
index c933f24..e1fdebb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -183,6 +183,7 @@ int fc_removeessential=0, fc_conflicts=0, fc_depends=0, 
fc_dependsversion=0;
 int fc_breaks=0, fc_badpath=0, fc_overwritediverted=0, fc_architecture=0;
 int fc_nonroot=0, fc_overwritedir=0, fc_conff_new=0, fc_conff_miss=0;
 int fc_conff_old=0, fc_conff_def=0;
+int fc_conff_ask = 0;
 int fc_badverify = 0;
 
 int errabort = 50;
@@ -204,6 +205,7 @@ static const struct forceinfo {
   { confold, fc_conff_old},
   { confdef, fc_conff_def},
   { confmiss,fc_conff_miss   },
+  { confask, fc_conff_ask},
   { depends, fc_depends  },
   { depends-version, fc_dependsversion   },
   { breaks,  fc_breaks   },
@@ -417,6 +419,7 @@ static void setforce(const struct cmdinfo *cip, const char 
*value) {
  you will be prompted unless one of the confold or\n
  confnew options is also given\n
   confmiss [!]   Always install missing config files\n
+  confask [!]Offer to replace config files with no new versions\n
   breaks [!] Install even if it would break another package\n
   conflicts [!]  Allow installation of conflicting packages\n
   architecture [!]   Process even packages with wrong architecture\n
diff --git a/src/main.h b/src/main.h
index 388febe..17ba2d4 100644
--- a/src/main.h
+++ b/src/main.h
@@ -129,6 +129,7 @@ extern int fc_removeessential, fc_conflicts, fc_depends, 
fc_dependsversion;
 extern int fc_breaks, fc_badpath, fc_overwritediverted, fc_architecture;
 extern int fc_nonroot, fc_overwritedir, fc_conff_new, fc_conff_miss;
 extern int fc_conff_old, fc_conff_def;
+extern int fc_conff_ask;
 extern int fc_badverify;
 
 extern bool abort_processing;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-133-g3a544f8

2010-07-03 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3a544f8c59b3f9e46f9cfc624edb5b81d92a
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 3 09:38:48 2010 +0200

man: Clarify --force-confask description

Mention any of the other --force-conf options can be given, not just
one. And that --force-confmiss can also be used with --force-confask.

diff --git a/man/dpkg.1 b/man/dpkg.1
index d550d11..4529267 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -430,9 +430,9 @@ which case it will use that to decide the final action.
 \fBconfask\fP:
 If a conffile has been modified always offer to replace it with the
 version in the package, even if the version in the package did not
-change. If one of \fB\-\-force\-confnew\fP, \fB\-\-force\-confold\fP,
-or \fB\-\-force\-confdef\fP is also given, it will be used to decide
-the final action.
+change. If any of \fB\-\-force\-confmiss\fP, \fB\-\-force\-confnew\fP,
+\fB\-\-force\-confold\fP, or \fB\-\-force\-confdef\fP is also given,
+it will be used to decide the final action.
 
 \fBoverwrite\fP:
 Overwrite one package's file with another's file.

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-142-gfc6fef6

2010-07-08 Thread Guillem Jover
The following commit has been merged in the master branch:
commit fc6fef6d8369fa682f5980fece9f0e481f3c2e15
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 8 07:48:31 2010 +0200

dpkg-divert: Refactor writable directory check into a new function

diff --git a/src/divertcmd.c b/src/divertcmd.c
index 3991181..6e559c9 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -155,12 +155,26 @@ file_stat(struct file *f)
f-stat_state = file_stat_nofile;
 }
 
-static bool
-check_rename(struct file *src, struct file *dst)
+static void
+check_writable_dir(struct file *f)
 {
struct varbuf tmpname = VARBUF_INIT;
int tmpfd;
 
+   varbufprintf(tmpname, %s%s, f-name, .dpkg-divert.tmp);
+
+   tmpfd = creat(tmpname.buf, 0600);
+   if (tmpfd  0)
+   ohshite(_(error checking '%s'), f-name);
+   close(tmpfd);
+   unlink(tmpname.buf);
+
+   varbuf_destroy(tmpname);
+}
+
+static bool
+check_rename(struct file *src, struct file *dst)
+{
file_stat(src);
 
/* If the source file is not present and we are not going to do
@@ -179,26 +193,8 @@ check_rename(struct file *src, struct file *dst)
 * succeeds, we assume a writable filesystem.
 */
 
-   varbufprintf(tmpname, %s%s, src-name, .dpkg-divert.tmp);
-
-   tmpfd = creat(tmpname.buf, 0600);
-   if (tmpfd = 0) {
-   close(tmpfd);
-   unlink(tmpname.buf);
-   } else
-   ohshite(_(error checking '%s'), src-name);
-
-   varbufreset(tmpname);
-   varbufprintf(tmpname, %s%s, dst-name, .dpkg-divert.tmp);
-
-   tmpfd = creat(tmpname.buf, 0600);
-   if (tmpfd = 0) {
-   close(tmpfd);
-   unlink(tmpname.buf);
-   } else
-   ohshite(_(error checking '%s'), dst-name);
-
-   varbuf_destroy(tmpname);
+   check_writable_dir(src);
+   check_writable_dir(dst);
 
if (src-stat_state == file_stat_valid 
dst-stat_state == file_stat_valid 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-142-gfc6fef6

2010-07-08 Thread Guillem Jover
The following commit has been merged in the master branch:
commit dcfb989852466575299e6f6ac505cab8c6476699
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 8 07:29:16 2010 +0200

dpkg-divert: Disable renaming of the source file does not exist

This makes it consistent with the general dpkg behaviour of honouring
file removals by the administrator.

Closes: #550252

As a side effect, this avoids useless errors when the destination
directory is not existent or writable.

Closes: #581544

diff --git a/debian/changelog b/debian/changelog
index dae1d12..844b2f7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -74,6 +74,10 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Add new dpkg --force-confask option that forces a conffile prompt when
 the conffile from the new package does not differ from the previous one.
 Thanks to Henning Makholm henn...@makholm.net. Closes: #102609
+  * On dpkg-divert --rename, check if the source file exists, and disable
+renaming if it does not. Closes: #550252
+As a side effect, this avoids useless errors when the destination
+directory is not existent or writable. Closes: #581544
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/src/divertcmd.c b/src/divertcmd.c
index 383ea3e..3991181 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -162,6 +162,12 @@ check_rename(struct file *src, struct file *dst)
int tmpfd;
 
file_stat(src);
+
+   /* If the source file is not present and we are not going to do
+* the rename anyway there's no point in checking any further. */
+   if (src-stat_state == file_stat_nofile)
+   return false;
+
file_stat(dst);
 
/*
@@ -179,13 +185,6 @@ check_rename(struct file *src, struct file *dst)
if (tmpfd = 0) {
close(tmpfd);
unlink(tmpname.buf);
-   } else if (errno == ENOENT) {
-   varbuf_destroy(tmpname);
-
-   /* If the source file is not present and we are not going
-* to do the rename anyway there's no point in checking the
-* target. */
-   return false;
} else
ohshite(_(error checking '%s'), src-name);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-142-gfc6fef6

2010-07-08 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 66c6a8b54f40cedbd754dd9865fd64a0275e7b72
Author: Guillem Jover guil...@debian.org
Date:   Tue Jul 6 08:30:13 2010 +0200

dpkg-deb: Do not special case old format control member

Initialize memberlen and skip the control member if the filesystem
member was requested, so that the same generic code that feeds the
member to the decompressor can be used for all cases.

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index e5e1f9c..e745191 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -118,9 +118,8 @@ void extracthalf(const char *debar, const char *directory,
   size_t ctrllennum, memberlen= 0;
   int dummy, l= 0;
   pid_t c1=0,c2,c3;
-  void *ctrlarea = NULL;
   int p1[2], p2[2];
-  FILE *ar, *pi;
+  FILE *ar;
   struct stat stab;
   char nlc;
   char *cur;
@@ -225,6 +224,13 @@ void extracthalf(const char *debar, const char *directory,
 if (sscanf(ctrllenbuf,%zi%c%d,ctrllennum,nlc,dummy) !=2 || nlc != 
'\n')
   ohshit(_(archive has malformatted control length `%s'), ctrllenbuf);
 
+if (admininfo) {
+  memberlen = ctrllennum;
+} else {
+  memberlen = stab.st_size - ctrllennum - strlen(ctrllenbuf) - l;
+  stream_null_copy(ar, ctrllennum, _(skipped control area from %s), 
debar);
+}
+
 if (admininfo = 2) {
   printf(_( old debian package, version %s.\n
 size %ld bytes: control archive= %zi, main archive= %ld.\n),
@@ -232,12 +238,6 @@ void extracthalf(const char *debar, const char *directory,
  (long) (stab.st_size - ctrllennum - strlen(ctrllenbuf) - l));
   m_output(stdout, _(standard output));
 }
-
-ctrlarea = m_malloc(ctrllennum);
-
-errno=0; if (fread(ctrlarea,1,ctrllennum,ar) != ctrllennum)
-  readfail(ar, debar, _(control area));
-
   } else {
 
 if (!strncmp(versionbuf,!arch,7)) {
@@ -252,42 +252,18 @@ void extracthalf(const char *debar, const char *directory,
 
   safe_fflush(ar);
 
-  if (oldformat) {
-if (admininfo) {
-  m_pipe(p1);
-  c1 = subproc_fork();
-  if (!c1) {
-close(p1[0]);
-   pi = fdopen(p1[1], w);
-   if (!pi)
- ohshite(_(failed to open pipe descriptor `1' in paste));
-errno=0; if (fwrite(ctrlarea,1,ctrllennum,pi) != ctrllennum)
-  ohshit(_(failed to write to gzip -dc));
-if (fclose(pi)) ohshit(_(failed to close gzip -dc));
-exit(0);
-  }
-  close(p1[1]);
-  readfromfd= p1[0];
-} else {
-  if (lseek(fileno(ar),l+strlen(ctrllenbuf)+ctrllennum,SEEK_SET) == -1)
-ohshite(_(failed to syscall lseek to files archive portion));
-  c1= -1;
-  readfromfd= fileno(ar);
-}
-free(ctrlarea);
-  } else {
-m_pipe(p1);
-c1 = subproc_fork();
-if (!c1) {
-  close(p1[0]);
-  stream_fd_copy(ar, p1[1], memberlen, _(failed to write to pipe in 
copy));
-  if (close(p1[1]) == EOF) ohshite(_(failed to close pipe in copy));
-  exit(0);
-}
-close(p1[1]);
-readfromfd= p1[0];
+  m_pipe(p1);
+  c1 = subproc_fork();
+  if (!c1) {
+close(p1[0]);
+stream_fd_copy(ar, p1[1], memberlen, _(failed to write to pipe in copy));
+if (close(p1[1]) == EOF)
+  ohshite(_(failed to close pipe in copy));
+exit(0);
   }
-  
+  close(p1[1]);
+  readfromfd = p1[0];
+
   if (taroption) m_pipe(p2);
   
   c2 = subproc_fork();

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-142-gfc6fef6

2010-07-08 Thread Guillem Jover
The following commit has been merged in the master branch:
commit df863c9b8ddf377b6cb89ac9079770356bd69c65
Author: Guillem Jover guil...@debian.org
Date:   Tue Jul 6 08:42:13 2010 +0200

dpkg-deb: Do not use EOF on file descriptor calls

The code was working because EOF is usually -1, but that's not
guaranteed by any standard. It's also conceptually wrong to mix this
definition from stream based I/O on file dscriptor based I/O.

For the close() call, just check that the return value is not 0.

Regression introduced in f4f4a1aa8dec678b6f34abcbcb8efd5b75966028.

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index e745191..bf60170 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -257,7 +257,7 @@ void extracthalf(const char *debar, const char *directory,
   if (!c1) {
 close(p1[0]);
 stream_fd_copy(ar, p1[1], memberlen, _(failed to write to pipe in copy));
-if (close(p1[1]) == EOF)
+if (close(p1[1]))
   ohshite(_(failed to close pipe in copy));
 exit(0);
   }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-142-gfc6fef6

2010-07-08 Thread Guillem Jover
The following commit has been merged in the master branch:
commit bc68b3461b939c4104d790ec3246a976fe4d52b3
Author: Guillem Jover guil...@debian.org
Date:   Tue Jul 6 08:49:09 2010 +0200

dpkg-deb: Remove redundant readfromfd variable

This variable always gets assigned the same fd, so there's no point in
keeping it around.

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index bf60170..f290ce5 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -124,7 +124,7 @@ void extracthalf(const char *debar, const char *directory,
   char nlc;
   char *cur;
   struct ar_hdr arh;
-  int readfromfd, adminmember;
+  int adminmember;
   bool oldformat, header_done;
   struct compressor *decompressor = compressor_gzip;
   
@@ -262,18 +262,17 @@ void extracthalf(const char *debar, const char *directory,
 exit(0);
   }
   close(p1[1]);
-  readfromfd = p1[0];
 
   if (taroption) m_pipe(p2);
   
   c2 = subproc_fork();
   if (!c2) {
-m_dup2(readfromfd,0);
+m_dup2(p1[0], 0);
 if (admininfo) close(p1[0]);
 if (taroption) { m_dup2(p2[1],1); close(p2[0]); close(p2[1]); }
 decompress_filter(decompressor, 0, 1, _(data));
   }
-  if (readfromfd != fileno(ar)) close(readfromfd);
+  close(p1[0]);
   fclose(ar);
   if (taroption) close(p2[1]);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-142-gfc6fef6

2010-07-08 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 5cc86959a4719f2426480ccdae2a2b9d72a754e3
Author: Guillem Jover guil...@debian.org
Date:   Tue Jul 6 08:58:04 2010 +0200

dpkg-deb: Reduce scope of several variables in extracthalf()

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index f290ce5..22aea98 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -114,16 +114,13 @@ void extracthalf(const char *debar, const char *directory,
  const char *taroption, int admininfo) {
   char versionbuf[40];
   float versionnum;
-  char ctrllenbuf[40];
   size_t ctrllennum, memberlen= 0;
-  int dummy, l= 0;
+  int dummy;
   pid_t c1=0,c2,c3;
   int p1[2], p2[2];
   FILE *ar;
   struct stat stab;
   char nlc;
-  char *cur;
-  struct ar_hdr arh;
   int adminmember;
   bool oldformat, header_done;
   struct compressor *decompressor = compressor_gzip;
@@ -138,6 +135,8 @@ void extracthalf(const char *debar, const char *directory,
 ctrllennum= 0;
 header_done = false;
 for (;;) {
+  struct ar_hdr arh;
+
   if (fread(arh,1,sizeof(arh),ar) != sizeof(arh))
 readfail(ar,debar,_(between members));
 
@@ -149,6 +148,7 @@ void extracthalf(const char *debar, const char *directory,
debar, _(member length));
   if (!header_done) {
 char *infobuf;
+char *cur;
 
 if (strncmp(arh.ar_name, DEBMAGIC, sizeof(arh.ar_name)) != 0)
   ohshit(_(file `%.250s' is not a debian binary archive (try 
dpkg-split?)),debar);
@@ -214,7 +214,9 @@ void extracthalf(const char *debar, const char *directory,
   } else if (!strncmp(versionbuf,0.93,4) 
  sscanf(versionbuf,%f%c%d,versionnum,nlc,dummy) == 2 
  nlc == '\n') {
-
+char ctrllenbuf[40];
+int l = 0;
+
 oldformat = true;
 l = strlen(versionbuf);
 if (l  versionbuf[l - 1] == '\n')

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0535fac53f385a866946e978fd35a10185d162fc
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 10 09:12:39 2010 +0200

build: Skip all dpkg-divert tests if the binary is not available

diff --git a/scripts/t/950_dpkg_divert.t b/scripts/t/950_dpkg_divert.t
index bff9e1e..8d7b58d 100644
--- a/scripts/t/950_dpkg_divert.t
+++ b/scripts/t/950_dpkg_divert.t
@@ -28,6 +28,11 @@ my $testdir = File::Spec-rel2abs($tmpdir/testdir);
 
 my @dd = ($builddir/../src/dpkg-divert);
 
+if (! -x @dd) {
+plan skip_all = dpkg-divert not available;
+exit(0);
+}
+
 plan tests = 235;
 
 sub cleanup {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0581dda824f26e9eec996ebf4de5f6474336bec2
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 11:44:41 2010 +0200

build: Add optional code coverage support

Enable code coverage support with 'configure --enable-coverage'. Use
gcov and lcov for C code coverage, and Devel::Cover and cover for Perl
code coverage.

diff --git a/.gitignore b/.gitignore
index 4d48623..8052d2a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,10 @@
 # Inherited ignores
 *.a
 *.o
+*.gcno
+*.gcda
+*.gcov
+*.lcov
 .*.swp
 .deps/
 Makefile
diff --git a/Makecheck.am b/Makecheck.am
index b88c1ea..afeeefc 100644
--- a/Makecheck.am
+++ b/Makecheck.am
@@ -4,6 +4,7 @@
 #
 #  TEST_VERBOSE - set to 0 or 1 to control test suite verbosity
 #  TEST_ENV_VARS - environment variables to be set for the test suite
+#  TEST_COVERAGE - set to the perl module in charge of getting test coverage
 #  test_tmpdir - test suite temporary directory
 #  test_cases - list of test case files
 #  test_data - list of test data files
@@ -16,6 +17,7 @@ check-local: $(test_data) $(test_cases)

PATH=$(top_builddir)/src:$(top_builddir)/scripts:$(top_builddir)/utils:$(PATH)
 \
  srcdir=$(srcdir) builddir=$(builddir) \
  PERL5LIB=$(top_srcdir)/scripts PERL_DL_NONLAZY=1 \
+ PERL5OPT=$(TEST_COVERAGE) \
  $(PERL) -I$(top_srcdir)/scripts \
-MExtUtils::Command::MM -e test_harness($(TEST_VERBOSE), '.') \
$(addprefix $(srcdir)/,$(test_cases))
diff --git a/Makefile.am b/Makefile.am
index b6d634e..a18c4e0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,9 +72,50 @@ EXTRA_DIST = \
 doc: doc/Doxyfile
$(DOXYGEN) doc/Doxyfile
 
-clean-local:
+doc-clean:
rm -rf doc/html/
 
+# Code coverage support
+
+.PHONY: coverage coverage-clean
+
+if COVERAGE_ENABLED
+LCOV_OPTS = -q --checksum
+LCOV_CAPTURE_OPTS = $(LCOV_OPTS) --no-recursion \
+   -d $(top_builddir)/lib/dpkg \
+   -d $(top_builddir)/src \
+   -d $(top_builddir)/utils
+
+coverage: all
+   $(RM) -f *.lcov
+   find -name '*.gcda' -o -name '*.gcov' | xargs $(RM) -f
+   
+   $(LCOV) $(LCOV_CAPTURE_OPTS) -c -o dpkg_base.lcov -i
+   $(MAKE) -C lib/dpkg check
+   $(MAKE) -C src check
+   $(MAKE) -C utils check
+   $(LCOV) $(LCOV_CAPTURE_OPTS) -c -o dpkg_test.lcov
+   $(LCOV) $(LCOV_OPTS) -a dpkg_base.lcov -a dpkg_test.lcov \
+ -o dpkg_merge.lcov
+   $(LCOV) $(LCOV_OPTS) -r dpkg_merge.lcov '/usr/include/*' -o dpkg.lcov
+   $(LCOV_GENHTML) -q --legend --title dpkg C code coverage \
+ --html-prolog $(top_srcdir)/doc/lcov-prolog \
+ --html-epilog $(top_srcdir)/doc/lcov-epilog \
+ -o doc/coverage dpkg.lcov
+   
+   $(MAKE) -C scripts $@
+
+coverage-clean:
+   rm -rf doc/coverage/
+   find -name '*.gcno' -o -name '*.gcda' -o \
+-name '*.gcov' -o -name '*.lcov' | xargs rm -f
+else
+coverage:
+   @echo Need to reconfigure with --enable-coverage
+
+coverage-clean:
+endif
+
 .PHONY: update-po
 
 update-po:
@@ -102,3 +143,4 @@ dist-hook:
done ; \
fi
 
+clean-local: doc-clean coverage-clean
diff --git a/configure.ac b/configure.ac
index 6d79ae5..b741769 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,7 @@ AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO])
 DPKG_PROG_PO4A
 DPKG_PROG_PERL
 DPKG_PROG_POD2MAN
+DPKG_CODE_COVERAGE
 
 # Checks for operating system services and capabilities.
 AC_SYS_LARGEFILE
diff --git a/doc/.gitignore b/doc/.gitignore
index acdcabb..5211926 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1,2 +1,3 @@
 Doxyfile
 html
+coverage
diff --git a/doc/lcov-epilog b/doc/lcov-epilog
new file mode 100644
index 000..8bc660c
--- /dev/null
+++ b/doc/lcov-epilog
@@ -0,0 +1,8 @@
+  table width=100% border=0 cellspacing=0 cellpadding=0
+tr
+  td class=coverFilea href=scripts/coverage.htmlscripts/a/td
+/tr
+  /table
+  br /
+/body
+/html
diff --git a/doc/lcov-prolog b/doc/lcov-prolog
new file mode 100644
index 000..49f2a4b
--- /dev/null
+++ b/doc/lcov-prolog
@@ -0,0 +1,8 @@
+!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
+html lang=en
+head
+  meta http-equiv=Content-Type content=text/html; charset=UTF-8
+  title@pagetitle@/title
+  link rel=stylesheet type=text/css href=@base...@gcov.css
+/head
+body
diff --git a/m4/dpkg-coverage.m4 b/m4/dpkg-coverage.m4
new file mode 100644
index 000..7a18795
--- /dev/null
+++ b/m4/dpkg-coverage.m4
@@ -0,0 +1,51 @@
+# Copyright © 2010 Guillem Jover guil...@debian.org
+
+# DPKG_CODE_COVERAGE
+# --
+# Add configuration option to enable code coverage support.
+AC_DEFUN([DPKG_CODE_COVERAGE],
+[
+AC_ARG_ENABLE(coverage,
+   AS_HELP_STRING([--enable-coverage],
+  [whether to enable code coverage]),
+   [],
+   [enable_coverage=no])
+AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit d647c878fb04db22dd0cfa7a57bee8f1d3caeac8
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 15:49:27 2010 +0200

dpkg-split: Namespace global option variables to not shadow local ones

diff --git a/dpkg-split/dpkg-split.h b/dpkg-split/dpkg-split.h
index 64b331a..4fd0bf7 100644
--- a/dpkg-split/dpkg-split.h
+++ b/dpkg-split/dpkg-split.h
@@ -51,10 +51,13 @@ struct partqueue {
 
 extern dofunction *action;
 extern const struct cmdinfo *cipaction;
-extern long maxpartsize;
-extern const char *depotdir, *outputfile;
 extern struct partqueue *queue;
-extern int npquiet, msdos;
+
+extern long opt_maxpartsize;
+extern const char *opt_depotdir;
+extern const char *opt_outputfile;
+extern int opt_npquiet;
+extern int opt_msdos;
 
 void rerr(const char *fn) DPKG_ATTR_NORET;
 void rerreof(FILE *f, const char *fn) DPKG_ATTR_NORET;
diff --git a/dpkg-split/join.c b/dpkg-split/join.c
index 7a4e950..ad9fb06 100644
--- a/dpkg-split/join.c
+++ b/dpkg-split/join.c
@@ -135,13 +135,13 @@ void do_join(const char *const *argv) {
   for (i=0; irefi-maxpartn; i++) {
 if (!partlist[i]) ohshit(_(part %d is missing),i+1);
   }
-  if (!outputfile) {
+  if (!opt_outputfile) {
 p= nfmalloc(strlen(refi-package)+1+strlen(refi-version)+sizeof(DEBEXT));
 strcpy(p,refi-package);
 strcat(p,-);
 strcat(p,refi-version);
 strcat(p,DEBEXT);
-outputfile= p;
+opt_outputfile = p;
   }
-  reassemble(partlist,outputfile);
+  reassemble(partlist, opt_outputfile);
 }
diff --git a/dpkg-split/main.c b/dpkg-split/main.c
index 82a672d..a143eb0 100644
--- a/dpkg-split/main.c
+++ b/dpkg-split/main.c
@@ -98,10 +98,13 @@ const char printforhelp[]= N_(Type dpkg-split --help for 
help.);
 
 dofunction *action=NULL;
 const struct cmdinfo *cipaction=NULL;
-long maxpartsize= SPLITPARTDEFMAX;
-const char *depotdir= ADMINDIR / PARTSDIR, *outputfile= NULL;
 struct partqueue *queue= NULL;
-int npquiet= 0, msdos= 0;
+
+long opt_maxpartsize = SPLITPARTDEFMAX;
+const char *opt_depotdir = ADMINDIR / PARTSDIR;
+const char *opt_outputfile = NULL;
+int opt_npquiet = 0;
+int opt_msdos = 0;
 
 void rerr(const char *fn) {
   ohshite(_(error reading %.250s), fn);
@@ -124,8 +127,8 @@ static void setpartsize(const struct cmdinfo *cip, const 
char *value) {
   if (newpartsize = 0 || newpartsize  (INT_MAX  10))
 badusage(_(part size is far too large or is not positive));
 
-  maxpartsize= newpartsize  10;
-  if (maxpartsize = HEADERALLOWANCE)
+  opt_maxpartsize = newpartsize  10;
+  if (opt_maxpartsize = HEADERALLOWANCE)
 badusage(_(part size must be at least %d KiB (to allow for header)),
  (HEADERALLOWANCE  10) + 1);
 }
@@ -151,11 +154,11 @@ static const struct cmdinfo cmdinfos[]= {
   { discard,  'd',  0,  NULL, NULL, setaction   },
   { help, 'h',  0,  NULL, NULL, usage   },
   { version,   0,   0,  NULL, NULL, printversion},
-  { depotdir,  0,   1,  NULL, depotdir, NULL   },
+  { depotdir,  0,   1,  NULL, opt_depotdir,NULL},
   { partsize, 'S',  1,  NULL, NULL, setpartsize },
-  { output,   'o',  1,  NULL, outputfile,   NULL   },
-  { npquiet,  'Q',  0,  npquiet, NULL,  NULL,  1   },
-  { msdos, 0,   0,  msdos, NULL,NULL,  1   },
+  { output,   'o',  1,  NULL, opt_outputfile,  NULL},
+  { npquiet,  'Q',  0,  opt_npquiet, NULL, NULL,   1   },
+  { msdos, 0,   0,  opt_msdos, NULL,   NULL,   1   },
   {  NULL,  0  }
 };
 
@@ -182,12 +185,12 @@ int main(int argc, const char *const *argv) {
 
   if (!cipaction) badusage(_(need an action option));
 
-  l= strlen(depotdir);
-  if (l  depotdir[l-1] != '/') {
+  l = strlen(opt_depotdir);
+  if (l  opt_depotdir[l - 1] != '/') {
 p= nfmalloc(l+2);
-strcpy(p,depotdir);
+strcpy(p, opt_depotdir);
 strcpy(p+l,/);
-depotdir= p;
+opt_depotdir = p;
   }
 
   setvbuf(stdout,NULL,_IONBF,0);
diff --git a/dpkg-split/queue.c b/dpkg-split/queue.c
index a2ed837..69ac976 100644
--- a/dpkg-split/queue.c
+++ b/dpkg-split/queue.c
@@ -84,16 +84,17 @@ void scandepot(void) {
   char *p;
 
   assert(!queue);
-  depot= opendir(depotdir);
-  if (!depot) ohshite(_(unable to read depot directory `%.250s'),depotdir);
+  depot = opendir(opt_depotdir);
+  if (!depot)
+ohshite(_(unable to read depot directory `%.250s'), opt_depotdir);
   while ((de= readdir(depot))) {
 if (de-d_name[0] == '.') continue;
 pq= nfmalloc(sizeof(struct partqueue));
 pq-info.fmtversion= pq-info.package= pq-info.version= NULL;
 pq-info.orglength= pq-info.thispartoffset= pq-info.thispartlen= 0;
 pq-info.headerlen= 0;
-p= nfmalloc(strlen(depotdir)+strlen(de-d_name)+1);
-strcpy(p

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7562f4ce74a04167ef2e9927304b15ae4b8cb6e9
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 15:50:29 2010 +0200

dpkg: Rename the remove variable to skip to not shadow remove(3)

diff --git a/src/filters.c b/src/filters.c
index 874eb60..d512e10 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -64,7 +64,7 @@ bool
 filter_should_skip(struct TarInfo *ti)
 {
struct filter_node *f;
-   bool remove = false;
+   bool skip = false;
 
if (!filter_head)
return false;
@@ -76,11 +76,11 @@ filter_should_skip(struct TarInfo *ti)
 
if (fnmatch(f-pattern, ti-Name[1], 0) == 0) {
if (f-include) {
-   remove = false;
+   skip = false;
debug(dbg_eachfile, filter including %s,
  ti-Name);
} else {
-   remove = true;
+   skip = true;
debug(dbg_eachfile, filter removing %s,
  ti-Name);
}
@@ -93,7 +93,7 @@ filter_should_skip(struct TarInfo *ti)
 * directories than necessary, but better err on the side of caution
 * than failing with “no such file or directory” (which would leave
 * the package in a very bad state). */
-   if (remove  (ti-Type == Directory || ti-Type == SymbolicLink)) {
+   if (skip  (ti-Type == Directory || ti-Type == SymbolicLink)) {
debug(dbg_eachfile,
  filter seeing if '%s' needs to be reincluded,
  ti-Name[1]);
@@ -124,5 +124,5 @@ filter_should_skip(struct TarInfo *ti)
}
}
 
-   return remove;
+   return skip;
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 20a523e176f4c3c81cdade68ba71c45c421dfadc
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 19:42:02 2010 +0200

dpkg: Rename symlink variable to target to not shadow symlink(2)

diff --git a/src/configure.c b/src/configure.c
index f0a7053..e717cfc 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -368,7 +368,7 @@ deferred_configure(struct pkginfo *pkg)
 int
 conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in)
 {
-   static struct varbuf symlink = VARBUF_INIT;
+   static struct varbuf target = VARBUF_INIT;
struct stat stab;
int r;
int loopprotect;
@@ -405,9 +405,9 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
return -1;
}
 
-   varbufreset(symlink);
-   varbuf_grow(symlink, stab.st_size + 1);
-   r = readlink(result-buf, symlink.buf, symlink.size);
+   varbufreset(target);
+   varbuf_grow(target, stab.st_size + 1);
+   r = readlink(result-buf, target.buf, target.size);
if (r  0) {
warning(_(%s: unable to readlink conffile 
'%s'\n
   (= '%s'): %s),
@@ -415,14 +415,14 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
return -1;
}
assert(r == stab.st_size); /* XXX: debug */
-   symlink.used = r;
-   varbufaddc(symlink, '\0');
+   target.used = r;
+   varbufaddc(target, '\0');
 
debug(dbg_conffdetail,
  conffderef readlink gave %d, '%s',
- r, symlink.buf);
+ r, target.buf);
 
-   if (symlink.buf[0] == '/') {
+   if (target.buf[0] == '/') {
varbufreset(result);
varbufaddstr(result, instdir);
debug(dbg_conffdetail,
@@ -433,7 +433,8 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
if (r  0) {
warning(_(%s: conffile '%.250s' 
resolves to degenerate filename\n
   ('%s' is a symlink to 
'%s')),
-   pkg-name, in, result-buf, 
symlink.buf);
+   pkg-name, in, result-buf,
+   target.buf);
return -1;
}
if (result-buf[r] == '/')
@@ -443,7 +444,7 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
  conffderef readlink relative to '%.*s',
  (int)result-used, result-buf);
}
-   varbufaddbuf(result, symlink.buf, symlink.used);
+   varbufaddbuf(result, target.buf, target.used);
varbufaddc(result, 0);
} else {
warning(_(%s: conffile '%.250s' is not a plain file or 
symlink (= '%s')),

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit f530505861321e8d8a9e70cf5fd86278778b58d1
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 18:51:32 2010 +0200

u-a: Remove unneeded const from fileset_add_slave string arguments

The arguments were later on cast to remove the constness, so just fix
the prototype of the function.

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 41a2062..5c0c939 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -529,7 +529,7 @@ fileset_free(struct fileset *fs)
 
 /* name and file must be allocated with malloc */
 static void
-fileset_add_slave(struct fileset *fs, const char *name, const char *file)
+fileset_add_slave(struct fileset *fs, char *name, char *file)
 {
struct slave_file *sl, *cur, *prev = NULL;
 
@@ -546,8 +546,8 @@ fileset_add_slave(struct fileset *fs, const char *name, 
const char *file)
/* Otherwise add new at the end */
sl = xmalloc(sizeof(*sl));
sl-next = NULL;
-   sl-name = (char *)name;
-   sl-file = (char *)file;
+   sl-name = name;
+   sl-file = file;
if (prev)
prev-next = sl;
else

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit a9746761e3237e4cee5c5c7f5851b62b4de8ed37
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 19:00:56 2010 +0200

u-a: Rename variable index to idx to not shadow index(3)

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 5c0c939..04c333d 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1409,7 +1409,7 @@ alternative_select_choice(struct alternative *a)
 {
char *current, *ret, selection[_POSIX_PATH_MAX];
struct fileset *best, *fs;
-   int len, index;
+   int len, idx;
 
current = alternative_get_current(a);
best = alternative_get_best(a);
@@ -1435,16 +1435,16 @@ alternative_select_choice(struct alternative *a)
mark =  ;
pr(%s %-12d %-*s % -10d %s, mark, 0, len, best-master_file,
   best-priority, _(auto mode));
-   index = 1;
+   idx = 1;
for (fs = a-choices; fs; fs = fs-next) {
if (a-status == ALT_ST_MANUAL  current 
strcmp(current, fs-master_file) == 0)
mark = *;
else
mark =  ;
-   pr(%s %-12d %-*s % -10d %s, mark, index, len,
+   pr(%s %-12d %-*s % -10d %s, mark, idx, len,
   fs-master_file, fs-priority, _(manual mode));
-   index++;
+   idx++;
}
printf(\n);
printf(_(Press enter to keep the current choice[*], 
@@ -1457,16 +1457,16 @@ alternative_select_choice(struct alternative *a)
selection[strlen(selection) - 1] = '\0';
if (strlen(selection) == 0)
return current;
-   index = strtol(selection, ret, 10);
+   idx = strtol(selection, ret, 10);
if (*ret == '\0') {
/* Look up by index */
-   if (index == 0) {
+   if (idx == 0) {
alternative_set_status(a, ALT_ST_AUTO);
free(current);
return xstrdup(best-master_file);
}
-   index--;
-   for (fs = a-choices; index  fs; index--)
+   idx--;
+   for (fs = a-choices; idx  fs; idx--)
fs = fs-next;
if (fs) {
alternative_set_status(a, ALT_ST_MANUAL);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit fa610b5f505c38fad4c7c8d9b86262988a2d793d
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 19:48:22 2010 +0200

u-a: Rename link variable to linkname to not shadow link(2)

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 04c333d..6c4d9c2 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -256,28 +256,28 @@ xstrdup(const char *str)
 }
 
 static char *
-xreadlink(const char *link, bool error_out)
+xreadlink(const char *linkname, bool error_out)
 {
struct stat st;
char *buf;
ssize_t size;
 
/* Allocate required memory to store the value of the symlink */
-   if (lstat(link, st)) {
+   if (lstat(linkname, st)) {
if (!error_out)
return NULL;
-   error(_(cannot stat %s: %s), link, strerror(errno));
+   error(_(cannot stat %s: %s), linkname, strerror(errno));
}
buf = xmalloc(st.st_size + 1);
 
/* Read it and terminate the string properly */
-   size = readlink(link, buf, st.st_size);
+   size = readlink(linkname, buf, st.st_size);
if (size == -1) {
if (!error_out) {
free(buf);
return NULL;
}
-   error(_(readlink(%s) failed: %s), link, strerror(errno));
+   error(_(readlink(%s) failed: %s), linkname, strerror(errno));
}
buf[size] = '\0';
 
@@ -920,13 +920,13 @@ alternative_set_status(struct alternative *a, enum 
alternative_status status)
 
 /* link must be allocated with malloc */
 static void
-alternative_set_link(struct alternative *a, char *link)
+alternative_set_link(struct alternative *a, char *linkname)
 {
-   if (a-master_link == NULL || strcmp(link, a-master_link) != 0)
+   if (a-master_link == NULL || strcmp(linkname, a-master_link) != 0)
a-modified = true;
 
free(a-master_link);
-   a-master_link = link;
+   a-master_link = linkname;
 }
 
 static bool
@@ -1038,7 +1038,7 @@ altdb_print_line(struct altdb_context *ctx, const char 
*line)
 static bool
 alternative_parse_slave(struct alternative *a, struct altdb_context *ctx)
 {
-   char *name, *link;
+   char *name, *linkname;
struct slave_link *sl;
 
name = altdb_get_line(ctx, _(slave name));
@@ -1052,23 +1052,23 @@ alternative_parse_slave(struct alternative *a, struct 
altdb_context *ctx)
ctx-bad_format(ctx, _(duplicate slave %s), sl-name);
}
 
-   link = altdb_get_line(ctx, _(slave link));
-   if (strcmp(link, a-master_link) == 0) {
-   free(link);
+   linkname = altdb_get_line(ctx, _(slave link));
+   if (strcmp(linkname, a-master_link) == 0) {
+   free(linkname);
free(name);
ctx-bad_format(ctx, _(slave link same as main link %s),
a-master_link);
}
for(sl = a-slaves; sl; sl = sl-next) {
-   if (strcmp(link, sl-link) == 0) {
-   free(link);
+   if (strcmp(linkname, sl-link) == 0) {
+   free(linkname);
free(name);
ctx-bad_format(ctx, _(duplicate slave link %s),
sl-link);
}
}
 
-   alternative_add_slave(a, name, link);
+   alternative_add_slave(a, name, linkname);
 
return true;
 }
@@ -1537,7 +1537,7 @@ alternative_commit(struct alternative *a)
 
 static void
 alternative_prepare_install_single(struct alternative *a, const char *name,
-  const char *link, const char *file)
+  const char *linkname, const char *file)
 {
char *fntmp, *fn;
struct stat st;
@@ -1552,22 +1552,23 @@ alternative_prepare_install_single(struct alternative 
*a, const char *name,
free(fntmp);
 
errno = 0;
-   if (lstat(link, st) == -1) {
+   if (lstat(linkname, st) == -1) {
if (errno != ENOENT)
-   error(_(cannot stat %s: %s), link, strerror(errno));
+   error(_(cannot stat %s: %s), linkname,
+ strerror(errno));
create_link = true;
} else {
create_link = S_ISLNK(st.st_mode);
}
if (create_link || opt_force) {
/* Create alternative link. */
-   xasprintf(fntmp, %s DPKG_TMP_EXT, link);
+   xasprintf(fntmp, %s DPKG_TMP_EXT, linkname);
checked_rm(fntmp);
checked_symlink(fn, fntmp);
-   alternative_add_commit_op(a, opcode_mv, fntmp, link);
+   alternative_add_commit_op(a, opcode_mv, fntmp, linkname);
free(fntmp);
} else {
-   warning

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0ffb2352819de51884f80c380819a33cce9333a7
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 11 19:56:05 2010 +0200

u-a: Rename altlnk to sl_altlnk to not shadow altlnk from outter scope

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 6c4d9c2..e4c8fa3 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1710,17 +1710,17 @@ alternative_is_broken(struct alternative *a)
}
free(sl_current);
} else {
-   char *altlnk;
+   char *sl_altlnk;
 
/* Slave link must not exist. */
if (lstat(sl-link, st) == 0)
return true;
-   xasprintf(altlnk, %s/%s, altdir, sl-name);
-   if (lstat(altlnk, st) == 0) {
-   free(altlnk);
+   xasprintf(sl_altlnk, %s/%s, altdir, sl-name);
+   if (lstat(sl_altlnk, st) == 0) {
+   free(sl_altlnk);
return true;
}
-   free(altlnk);
+   free(sl_altlnk);
}
}
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit b4efb601b445580a3a46ce873eec3a80893dd08f
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 16 14:03:41 2010 +0200

Convert limiteddescription() to pkg_summary()

Move clamping of summary size to callers. This makes the function more
generic so that it can be reused in other contexts.

diff --git a/src/enquiry.c b/src/enquiry.c
index d8e1a4f..69e702d 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -118,7 +118,10 @@ static void describebriefly(struct pkginfo *pkg) {
   maxl= 57;
   l= strlen(pkg-name);
   if (l20) maxl -= (l-20);
-  limiteddescription(pkg,maxl,pdesc,l);
+
+  pkg_summary(pkg, pdesc, l);
+  l = min(l, maxl);
+
   printf( %-20s %.*s\n,pkg-name,l,pdesc);
 }
 
diff --git a/src/main.h b/src/main.h
index 17ba2d4..b17810b 100644
--- a/src/main.h
+++ b/src/main.h
@@ -171,8 +171,7 @@ void printarch(const char *const *argv);
 void printinstarch(const char *const *argv);
 void cmpversions(const char *const *argv) DPKG_ATTR_NORET;
 
-void limiteddescription(struct pkginfo *pkg,
-int maxl, const char **pdesc_r, int *l_r);
+void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret);
 
 /* from select.c */
 
diff --git a/src/pkg-show.c b/src/pkg-show.c
index c1b8789..853278e 100644
--- a/src/pkg-show.c
+++ b/src/pkg-show.c
@@ -31,19 +31,20 @@
 #include main.h
 
 void
-limiteddescription(struct pkginfo *pkg,
-   int maxl, const char **pdesc_r, int *l_r)
+pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret)
 {
-   const char *pdesc, *p;
+   const char *pdesc;
+   size_t len;
 
pdesc = pkg-installed.description;
if (!pdesc)
pdesc = _((no description available));
-   p = strchr(pdesc, '\n');
-   if (!p)
-   p = pdesc + strlen(pdesc);
 
-   *l_r = min(p - pdesc, maxl);
+   len = strcspn(pdesc, \n);
+   if (len == 0)
+   len = strlen(pdesc);
+
+   *len_ret = len;
*pdesc_r = pdesc;
 }
 
diff --git a/src/query.c b/src/query.c
index 7eb94e2..9783847 100644
--- a/src/query.c
+++ b/src/query.c
@@ -124,7 +124,9 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\
 *head = true;
   }
 
-  limiteddescription(pkg,dw,pdesc,l);
+  pkg_summary(pkg, pdesc, l);
+  l = min(l, dw);
+
   printf(format,
  uihrp[pkg-want],
  ncHUFWti[pkg-status],

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c5309f8009d14dc6ce05a783ab89acf0c5e2a3ed
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 14 15:23:46 2010 +0200

Switch variables from int to bool where appropriate

diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 40d6c0f..6e03e1f 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -211,11 +211,12 @@ void do_build(const char *const *argv) {
   
   char *m;
   const char *debar, *directory, *const *mscriptp, *versionstring, *arch;
+  bool subdir;
   char *controlfile, *tfbuf;
   struct pkginfo *checkedinfo;
   struct arbitraryfield *field;
   FILE *ar, *cf;
-  int p1[2], p2[2], p3[2], warns, n, c, subdir, gzfd;
+  int p1[2], p2[2], p3[2], warns, n, c, gzfd;
   pid_t c1,c2,c3;
   struct stat controlstab, mscriptstab, debarstab;
   char conffilename[MAXCONFFILENAME+1];
@@ -227,7 +228,7 @@ void do_build(const char *const *argv) {
   directory = *argv++;
   if (!directory)
 badusage(_(--%s needs a directory argument), cipaction-olong);
-  subdir= 0;
+  subdir = false;
   debar = *argv++;
   if (debar != NULL) {
 if (*argv) badusage(_(--build takes at most two arguments));
@@ -236,7 +237,7 @@ void do_build(const char *const *argv) {
 if (errno != ENOENT)
   ohshite(_(unable to check for existence of archive 
`%.250s'),debar);
   } else if (S_ISDIR(debarstab.st_mode)) {
-subdir= 1;
+subdir = true;
   }
 }
   } else {
diff --git a/lib/dpkg/pkg-format.c b/lib/dpkg/pkg-format.c
index 25d8a95..4c44acc 100644
--- a/lib/dpkg/pkg-format.c
+++ b/lib/dpkg/pkg-format.c
@@ -207,10 +207,10 @@ pkg_format_show(const struct pkg_format_node *head,
struct varbuf vb = VARBUF_INIT, fb = VARBUF_INIT, wb = VARBUF_INIT;
 
while (head) {
-   int ok;
+   bool ok;
char fmt[16];
 
-   ok = 0;
+   ok = false;
 
if (head-width  0)
snprintf(fmt, 16, %%%s%zds,
@@ -220,7 +220,7 @@ pkg_format_show(const struct pkg_format_node *head,
 
if (head-type == string) {
varbufprintf(fb, fmt, head-data);
-   ok = 1;
+   ok = true;
} else if (head-type == field) {
const struct fieldinfo *fip;
 
@@ -231,7 +231,7 @@ pkg_format_show(const struct pkg_format_node *head,
varbufaddc(wb, '\0');
varbufprintf(fb, fmt, wb.buf);
varbufreset(wb);
-   ok = 1;
+   ok = true;
break;
}
 
@@ -241,7 +241,7 @@ pkg_format_show(const struct pkg_format_node *head,
for (afp = pif-arbs; afp; afp = afp-next)
if (strcasecmp(head-data, afp-name) 
== 0) {
varbufprintf(fb, fmt, 
afp-value);
-   ok = 1;
+   ok = true;
break;
}
}
diff --git a/src/errors.c b/src/errors.c
index d115ff3..c21fbb6 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -65,7 +65,7 @@ void print_error_perpackage(const char *emsg, const char 
*arg) {
   nr= malloc(sizeof(struct error_report));
   if (!nr) {
 perror(_(dpkg: failed to allocate memory for new entry in list of failed 
packages.));
-abort_processing = 1;
+abort_processing = true;
 nr= emergency;
   }
   nr-what= arg;
@@ -75,7 +75,7 @@ void print_error_perpackage(const char *emsg, const char 
*arg) {
 
   if (nerrs++  errabort) return;
   fprintf(stderr, _(dpkg: too many errors, stopping\n));
-  abort_processing = 1;
+  abort_processing = true;
 }
 
 int reportbroken_retexitstatus(void) {
diff --git a/src/main.c b/src/main.c
index e1fdebb..bdf4029 100644
--- a/src/main.c
+++ b/src/main.c
@@ -608,7 +608,8 @@ void commandfd(const char *const *argv) {
   }
 
   for (;;) {
-int argc= 1, mode= 0;
+bool mode = false;
+int argc= 1;
 lno= 0;
 push_error_handler(ejbuf, print_error_fatal, NULL);
 
@@ -642,15 +643,15 @@ void commandfd(const char *const *argv) {
skipchar = true;
continue;
   } else if (isspace(*ptr)) {
-   if (mode == 1) {
+   if (mode == true) {
  *ptr = '\0';
- mode= 0;
+ mode = false;
}
   } else {
-   if (mode == 0) {
+   if (mode == false) {
  newargs[argc]= ptr;
  argc++;
- mode= 1;
+ mode = true;
}
   }
   ptr++;
diff --git a/src/packages.c b/src/packages.c
index e10f586..71cb50e 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -306,7

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 92838b1a97e20b70c3a450578d2b4271143fd561
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 16 14:19:15 2010 +0200

Move pkg-show module to libdpkg

diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index d41c104..7d4b26a 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -49,6 +49,7 @@ libdpkg_a_SOURCES = \
pkg-format.c \
pkg-list.c \
pkg-queue.c \
+   pkg-show.c \
progress.c \
string.c \
subproc.c \
@@ -78,6 +79,7 @@ pkginclude_HEADERS = \
pkg-format.h \
pkg-list.h \
pkg-queue.h \
+   pkg-show.h \
progress.h \
string.h \
subproc.h \
diff --git a/src/pkg-show.c b/lib/dpkg/pkg-show.c
similarity index 93%
rename from src/pkg-show.c
rename to lib/dpkg/pkg-show.c
index 853278e..d36d9bf 100644
--- a/src/pkg-show.c
+++ b/lib/dpkg/pkg-show.c
@@ -3,6 +3,7 @@
  * pkg-show.c - primitives for pkg information display
  *
  * Copyright © 1995,1996 Ian Jackson i...@chiark.greenend.org.uk
+ * Copyright © 2008-2010 Guillem Jover guil...@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
@@ -25,10 +26,8 @@
 
 #include dpkg/macros.h
 #include dpkg/i18n.h
-#include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
-
-#include main.h
+#include dpkg/pkg-show.h
 
 void
 pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret)
diff --git a/lib/dpkg/pkg.h b/lib/dpkg/pkg-show.h
similarity index 72%
copy from lib/dpkg/pkg.h
copy to lib/dpkg/pkg-show.h
index 9195134..120df80 100644
--- a/lib/dpkg/pkg.h
+++ b/lib/dpkg/pkg-show.h
@@ -1,8 +1,8 @@
 /*
  * dpkg - main program for package management
- * pkg.h - primitives for pkg handling
+ * pkg-show.h - primitives for pkg information display
  *
- * Copyright © 2009 Guillem Jover guil...@debian.org
+ * Copyright © 2010 Guillem Jover guil...@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
@@ -18,17 +18,16 @@
  * along with this program.  If not, see http://www.gnu.org/licenses/.
  */
 
-#ifndef LIBDPKG_PKG_H
-#define LIBDPKG_PKG_H
+#ifndef DPKG_PKG_SHOW_H
+#define DPKG_PKG_SHOW_H
 
 #include dpkg/macros.h
+#include dpkg/dpkg-db.h
 
 DPKG_BEGIN_DECLS
 
-typedef int pkg_sorter_func(const void *a, const void *b);
-
-int pkg_sorter_by_name(const void *a, const void *b);
+void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret);
 
 DPKG_END_DECLS
 
-#endif /* LIBDPKG_PKG_H */
+#endif /* DPKG_PKG_SHOW_H */
diff --git a/src/Makefile.am b/src/Makefile.am
index 7c6b054..d1e432f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,7 +33,6 @@ dpkg_SOURCES = \
help.c \
main.c main.h \
packages.c \
-   pkg-show.c \
processarc.c \
remove.c \
select.c \
@@ -60,7 +59,6 @@ dpkg_divert_LDADD = \
 dpkg_query_SOURCES = \
filesdb.c filesdb.h \
divertdb.c \
-   pkg-show.c \
query.c
 
 dpkg_query_LDADD = \
diff --git a/src/enquiry.c b/src/enquiry.c
index 69e702d..a30b3eb 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -38,6 +38,7 @@
 #include dpkg/i18n.h
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
+#include dpkg/pkg-show.h
 #include dpkg/myopt.h
 
 #include filesdb.h
diff --git a/src/main.h b/src/main.h
index b17810b..6337191 100644
--- a/src/main.h
+++ b/src/main.h
@@ -171,8 +171,6 @@ void printarch(const char *const *argv);
 void printinstarch(const char *const *argv);
 void cmpversions(const char *const *argv) DPKG_ATTR_NORET;
 
-void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret);
-
 /* from select.c */
 
 void getselections(const char *const *argv);
diff --git a/src/query.c b/src/query.c
index 9783847..2ccdf1e 100644
--- a/src/query.c
+++ b/src/query.c
@@ -44,6 +44,7 @@
 #include dpkg/dpkg-db.h
 #include dpkg/pkg-array.h
 #include dpkg/pkg-format.h
+#include dpkg/pkg-show.h
 #include dpkg/path.h
 #include dpkg/myopt.h
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit f45885e71425f23a707250a87e0672ec96d82cf7
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 16 16:28:39 2010 +0200

libdpkg: Make pkg_summary() return the summary instead of void

Change from returning through a pointer argument to returning it from
the function return value.

diff --git a/lib/dpkg/pkg-show.c b/lib/dpkg/pkg-show.c
index d36d9bf..7101153 100644
--- a/lib/dpkg/pkg-show.c
+++ b/lib/dpkg/pkg-show.c
@@ -29,8 +29,8 @@
 #include dpkg/dpkg-db.h
 #include dpkg/pkg-show.h
 
-void
-pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret)
+const char *
+pkg_summary(struct pkginfo *pkg, int *len_ret)
 {
const char *pdesc;
size_t len;
@@ -44,6 +44,7 @@ pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int 
*len_ret)
len = strlen(pdesc);
 
*len_ret = len;
-   *pdesc_r = pdesc;
+
+   return pdesc;
 }
 
diff --git a/lib/dpkg/pkg-show.h b/lib/dpkg/pkg-show.h
index 120df80..4d56091 100644
--- a/lib/dpkg/pkg-show.h
+++ b/lib/dpkg/pkg-show.h
@@ -26,7 +26,7 @@
 
 DPKG_BEGIN_DECLS
 
-void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret);
+const char *pkg_summary(struct pkginfo *pkg, int *len_ret);
 
 DPKG_END_DECLS
 
diff --git a/src/enquiry.c b/src/enquiry.c
index a30b3eb..1f46b22 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -120,7 +120,7 @@ static void describebriefly(struct pkginfo *pkg) {
   l= strlen(pkg-name);
   if (l20) maxl -= (l-20);
 
-  pkg_summary(pkg, pdesc, l);
+  pdesc = pkg_summary(pkg, l);
   l = min(l, maxl);
 
   printf( %-20s %.*s\n,pkg-name,l,pdesc);
diff --git a/src/query.c b/src/query.c
index 2ccdf1e..0607935 100644
--- a/src/query.c
+++ b/src/query.c
@@ -125,7 +125,7 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\
 *head = true;
   }
 
-  pkg_summary(pkg, pdesc, l);
+  pdesc = pkg_summary(pkg, l);
   l = min(l, dw);
 
   printf(format,

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 4def4665267a8249ae2de2594422c18f7a84bc8b
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 16 16:35:03 2010 +0200

dpkg-query: Use pkg_summary in list1package instead of ad-hoc code

diff --git a/src/query.c b/src/query.c
index 0607935..609e24c 100644
--- a/src/query.c
+++ b/src/query.c
@@ -86,16 +86,13 @@ list1package(struct pkginfo *pkg, bool *head, struct 
pkg_array *array)
 if (w == -1) {
   nw=14, vw=14, dw=44;
   for (i = 0; i  array-n_pkgs; i++) {
-   const char *pdesc;
int plen, vlen, dlen;
 
-   pdesc = pkg-installed.description;
-   if (!pdesc) pdesc= _((no description available));
-
plen = strlen(array-pkgs[i]-name);
vlen = strlen(versiondescribe(array-pkgs[i]-installed.version,
  vdew_nonambig));
-   dlen= strcspn(pdesc, \n);
+   pkg_summary(pkg, dlen);
+
if (plen  nw) nw = plen;
if (vlen  vw) vw = vlen;
if (dlen  dw) dw = dlen;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e93fdb82239a07d52a377e5f4158e0ca0c58af7c
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 16 16:49:38 2010 +0200

Fix file names in comment header

diff --git a/dselect/basecmds.cc b/dselect/basecmds.cc
index 27dfdcc..c11c994 100644
--- a/dselect/basecmds.cc
+++ b/dselect/basecmds.cc
@@ -1,6 +1,6 @@
 /*
  * dselect - Debian package maintenance user interface
- * bcommands.cc - base list keyboard commands display
+ * basecmds.cc - base list keyboard commands display
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
  * Copyright © 2000,2001 Wichert Akkerman wakke...@debian.org
diff --git a/dselect/basetop.cc b/dselect/basetop.cc
index 801d002..32d420f 100644
--- a/dselect/basetop.cc
+++ b/dselect/basetop.cc
@@ -1,6 +1,6 @@
 /*
  * dselect - Debian package maintenance user interface
- * bdrawtop.cc - base list class redraw of top
+ * basetop.cc - base list class redraw of top
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
  *
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index 0e2fad8..275c149 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -1,6 +1,6 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * parse.c - declarations for in-core database reading/writing
+ * parsedump.h - declarations for in-core database reading/writing
  *
  * Copyright © 1995 Ian Jackson i...@chiark.greenend.org.uk
  * Copyright © 2001 Wichert Akkerman
diff --git a/lib/dpkg/pkg.c b/lib/dpkg/pkg.c
index 81079c0..f893732 100644
--- a/lib/dpkg/pkg.c
+++ b/lib/dpkg/pkg.c
@@ -1,6 +1,6 @@
 /*
  * dpkg - main program for package management
- * pkg-array.c - primitives for pkg handling
+ * pkg.c - primitives for pkg handling
  *
  * Copyright © 1995, 1996 Ian Jackson i...@chiark.greenend.org.uk
  * Copyright © 2009 Guillem Jover guil...@debian.org
diff --git a/lib/dpkg/progress.h b/lib/dpkg/progress.h
index 5ea6dd2..4968467 100644
--- a/lib/dpkg/progress.h
+++ b/lib/dpkg/progress.h
@@ -1,6 +1,6 @@
 /*
  * dpkg - main program for package management
- * progress.c - generic progress reporting
+ * progress.h - generic progress reporting
  *
  * Copyright © 2009 Guillem Jover guil...@debian.org
  *
diff --git a/src/errors.c b/src/errors.c
index c21fbb6..88c2210 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -1,6 +1,6 @@
 /*
  * dpkg - main program for package management
- * main.c - main program
+ * errors.c - per package error handling
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
  *

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 4b3828ba87359a3a0171a95479834983224b2f73
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 16 17:06:23 2010 +0200

build: Add -Wshadow to default warnings

diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4
index f46f0a7..5a0f791 100644
--- a/m4/dpkg-compiler.m4
+++ b/m4/dpkg-compiler.m4
@@ -13,7 +13,7 @@ AC_DEFUN([DPKG_COMPILER_WARNINGS],
 
 WFLAGS=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers \
 -Wmissing-declarations -Wmissing-format-attribute \
--Wvla -Winit-self -Wwrite-strings -Wcast-align
+-Wvla -Winit-self -Wwrite-strings -Wcast-align -Wshadow
 WCFLAGS=-Wdeclaration-after-statement -Wnested-externs -Wbad-function-cast \
 -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
 # Temporarily here until #542031 gets fixed in ncurses

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-167-g6b62761

2010-07-16 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 6b62761d7c3f0db09371a24e8d32a2600cc91c5a
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 16 20:31:54 2010 +0200

Use earlier/later instead of smaller/bigger for comparison relationships

Closes: #587641

diff --git a/debian/changelog b/debian/changelog
index 3ec70ef..de9672f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -80,6 +80,8 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 directory is not existent or writable. Closes: #581544
   * Properly compute the longest package description from all to be displayed
 on “dpkg-query --list”, so that it does not get incorrectly trimmed.
+  * Consistently use earlier/later instead of smaller/bigger when describing
+comparison relationships. Closes: #587641
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/lib/dpkg/pkg.c b/lib/dpkg/pkg.c
index f893732..7598860 100644
--- a/lib/dpkg/pkg.c
+++ b/lib/dpkg/pkg.c
@@ -34,9 +34,9 @@
  * @param b A pointer of a pointer to a struct pkginfo.
  *
  * @return An integer with the result of the comparison.
- * @retval -1 a is smaller than b.
+ * @retval -1 a is earlier than b.
  * @retval 0 a is equal to b.
- * @retval 1 a is greater than b.
+ * @retval 1 a is later than b.
  */
 int
 pkg_sorter_by_name(const void *a, const void *b)
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index d94761f..4303618 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -252,7 +252,7 @@ sub __sanity_check_range {
 }
 if ((defined($r-{since}) and not exists $versions{$r-{since}})) {
 warning(_g('%s' option specifies non-existing version), since);
-warning(_g(use newest entry that is smaller than the one specified));
+warning(_g(use newest entry that is earlier than the one specified));
 foreach my $v (@versions) {
 if (version_compare_relation($v, REL_LT, $r-{since})) {
 $r-{since} = $v;
@@ -260,7 +260,7 @@ sub __sanity_check_range {
 }
 }
 if (not exists $versions{$r-{since}}) {
-# No version was smaller, include all
+# No version was earlier, include all
 warning(_g(none found, starting from the oldest entry));
 delete $r-{since};
 $r-{from} = $versions[-1];
@@ -268,7 +268,7 @@ sub __sanity_check_range {
 }
 if ((defined($r-{from}) and not exists $versions{$r-{from}})) {
 warning(_g('%s' option specifies non-existing version), from);
-warning(_g(use oldest entry that is bigger than the one specified));
+warning(_g(use oldest entry that is later than the one specified));
 my $oldest;
 foreach my $v (@versions) {
 if (version_compare_relation($v, REL_GT, $r-{from})) {
@@ -279,12 +279,12 @@ sub __sanity_check_range {
 $r-{from} = $oldest;
 } else {
 warning(_g(no such entry found, ignoring '%s' parameter), 
from);
-delete $r-{from}; # No version was bigger
+delete $r-{from}; # No version was oldest
 }
 }
 if (defined($r-{'until'}) and not exists $versions{$r-{'until'}}) {
 warning(_g('%s' option specifies non-existing version), until);
-warning(_g(use oldest entry that is bigger than the one specified));
+warning(_g(use oldest entry that is later than the one specified));
 my $oldest;
 foreach my $v (@versions) {
 if (version_compare_relation($v, REL_GT, $r-{'until'})) {
@@ -295,12 +295,12 @@ sub __sanity_check_range {
 $r-{'until'} = $oldest;
 } else {
 warning(_g(no such entry found, ignoring '%s' parameter), 
until);
-delete $r-{'until'}; # No version was bigger
+delete $r-{'until'}; # No version was oldest
 }
 }
 if (defined($r-{to}) and not exists $versions{$r-{to}}) {
 warning(_g('%s' option specifies non-existing version), to);
-warning(_g(use newest entry that is smaller than the one specified));
+warning(_g(use newest entry that is earlier than the one specified));
 foreach my $v (@versions) {
 if (version_compare_relation($v, REL_LT, $r-{to})) {
 $r-{to} = $v;
@@ -308,7 +308,7 @@ sub __sanity_check_range {
 }
 }
 if (not exists $versions{$r-{to}}) {
-# No version was smaller
+# No version was earlier
 warning(_g(no such entry found, ignoring '%s' parameter), to);
 delete $r-{to};
 }
diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index 2b796d6..75f3d99 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -450,7 +450,7 @@ sub mark_found_in_library {
 # Sanitize the symbol when it is confirmed to be NOT found in
 # the respective library.
 # Mark as deprecated those

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-172-ga58303f

2010-07-21 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0f1bf462adbe67938f2c05712b2f53dc82f0994f
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 17 18:29:38 2010 +0200

Do not include two unused assert.h

diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 6e03e1f..b095a81 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -26,7 +26,6 @@
 #include sys/stat.h
 #include sys/wait.h
 
-#include assert.h
 #include errno.h
 #include limits.h
 #include ctype.h
diff --git a/src/remove.c b/src/remove.c
index eae6557..571e1b0 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -24,7 +24,6 @@
 #include sys/types.h
 #include sys/stat.h
 
-#include assert.h
 #include errno.h
 #include ctype.h
 #include string.h

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-172-ga58303f

2010-07-21 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 1a6633e2d9b8d66eed60a45bfdd86552bf6107e4
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 18 11:44:35 2010 +0200

dpkg: Stop exporting DPKG_LIBDIR to maintainer scripts

Now that the maintainer scripts helper program is under PATH, there's
no need anymore to export the internal dpkg library directory.

diff --git a/debian/changelog b/debian/changelog
index de9672f..c6a4c59 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -82,6 +82,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 on “dpkg-query --list”, so that it does not get incorrectly trimmed.
   * Consistently use earlier/later instead of smaller/bigger when describing
 comparison relationships. Closes: #587641
+  * Stop exporting DPKG_LIBDIR to maintainer scripts, no need for it anymore.
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index dc65740..3e39ccb 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -81,7 +81,6 @@ DPKG_BEGIN_DECLS
 #define MAINTSCRIPTPKGENVVAR DPKG_MAINTSCRIPT_PACKAGE
 #define MAINTSCRIPTARCHENVVAR DPKG_MAINTSCRIPT_ARCH
 #define MAINTSCRIPTNAMEENVVAR DPKG_MAINTSCRIPT_NAME
-#define MAINTSCRIPTLIBDIRENVVAR DPKG_LIBDIR
 #define MAINTSCRIPTDPKGENVVAR DPKG_RUNNING_VERSION
 
 #define SHELLENVSHELL
diff --git a/man/dpkg.1 b/man/dpkg.1
index 4529267..2e064e2 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -690,10 +690,6 @@ examine the situation. Contains the path to the new 
conffile.
 Defined by \fBdpkg\fP on the maintainer script environment to the
 version of the currently running \fBdpkg\fP instance.
 .TP
-.B DPKG_LIBDIR
-Defined by \fBdpkg\fP on the maintainer script environment to the
-private library directory of the currently running \fBdpkg\fP instance.
-.TP
 .B DPKG_MAINTSCRIPT_PACKAGE
 Defined by \fBdpkg\fP on the maintainer script environment to the
 package name being handled.
diff --git a/src/Makefile.am b/src/Makefile.am
index f19e384..34fe0e9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,7 +6,6 @@ pkgconfdir = $(sysconfdir)/@PACKAGE@
 AM_CPPFLAGS = \
-DLOCALEDIR=\$(localedir)\ \
-DADMINDIR=\$(admindir)\ \
-   -DPKGLIBDIR=\$(pkglibdir)\ \
-idirafter $(top_srcdir)/lib/compat \
-I$(top_builddir) \
-I$(top_srcdir)/lib
diff --git a/src/help.c b/src/help.c
index a328f0e..a56cd0a 100644
--- a/src/help.c
+++ b/src/help.c
@@ -261,7 +261,6 @@ do_script(struct pkginfo *pkg, struct pkginfoperfile *pif,
 if (setenv(MAINTSCRIPTPKGENVVAR, pkg-name, 1) ||
 setenv(MAINTSCRIPTARCHENVVAR, pif-architecture, 1) ||
 setenv(MAINTSCRIPTNAMEENVVAR, cmd-argv[0], 1) ||
-setenv(MAINTSCRIPTLIBDIRENVVAR, PKGLIBDIR, 1) ||
 setenv(MAINTSCRIPTDPKGENVVAR, PACKAGE_VERSION, 1))
   ohshite(_(unable to setenv for maintainer script));
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-172-ga58303f

2010-07-21 Thread Guillem Jover
The following commit has been merged in the master branch:
commit a58303f0294dfd9c93dfa4f49f572f1711f947cf
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 21 16:24:15 2010 +0200

build: Add missing TEST_ENV_VARS to check-local target

Missed in commit 939778ab9b4147d42b7250fdb1be9c5fe79392b7.

diff --git a/Makecheck.am b/Makecheck.am
index afeeefc..53bf66b 100644
--- a/Makecheck.am
+++ b/Makecheck.am
@@ -15,6 +15,7 @@ check-clean:
 check-local: $(test_data) $(test_cases)
$(mkdir_p) $(test_tmpdir)

PATH=$(top_builddir)/src:$(top_builddir)/scripts:$(top_builddir)/utils:$(PATH)
 \
+ $(TEST_ENV_VARS) \
  srcdir=$(srcdir) builddir=$(builddir) \
  PERL5LIB=$(top_srcdir)/scripts PERL_DL_NONLAZY=1 \
  PERL5OPT=$(TEST_COVERAGE) \

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-195-gc548891

2010-07-25 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e62eaa93a1eb43c00aa5b9d58ca4ab975dcd53a5
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 17 19:12:24 2010 +0200

Use varbuf_trunc instead of directly assigning to member 'used'

diff --git a/src/archives.c b/src/archives.c
index 5430be9..2b5b87e 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -285,16 +285,16 @@ set_selinux_path_context(const char *matchpath, const 
char *path, mode_t mode)
 }
 
 void setupfnamevbs(const char *filename) {
-  fnamevb.used= fnameidlu;
+  varbuf_trunc(fnamevb, fnameidlu);
   varbufaddstr(fnamevb,filename);
   varbufaddc(fnamevb,0);
 
-  fnametmpvb.used= fnameidlu;
+  varbuf_trunc(fnametmpvb, fnameidlu);
   varbufaddstr(fnametmpvb,filename);
   varbufaddstr(fnametmpvb,DPKGTEMPEXT);
   varbufaddc(fnametmpvb,0);
 
-  fnamenewvb.used= fnameidlu;
+  varbuf_trunc(fnamenewvb, fnameidlu);
   varbufaddstr(fnamenewvb,filename);
   varbufaddstr(fnamenewvb,DPKGNEWEXT);
   varbufaddc(fnamenewvb,0);
@@ -790,7 +790,8 @@ int tarobject(struct TarInfo *ti) {
   if (r  0)
 ohshite(_(unable to read link `%.255s'), ti-Name);
   assert(r == stab.st_size);
-  symlinkfn.used= r; varbufaddc(symlinkfn,0);
+  varbuf_trunc(symlinkfn, r);
+  varbufaddc(symlinkfn, '\0');
   if (symlink(symlinkfn.buf,fnametmpvb.buf))
 ohshite(_(unable to make backup symlink for `%.255s'),ti-Name);
   if (lchown(fnametmpvb.buf,stab.st_uid,stab.st_gid))
diff --git a/src/configure.c b/src/configure.c
index e717cfc..8300738 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -415,7 +415,7 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
return -1;
}
assert(r == stab.st_size); /* XXX: debug */
-   target.used = r;
+   varbuf_trunc(target, r);
varbufaddc(target, '\0');
 
debug(dbg_conffdetail,
@@ -439,7 +439,7 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
}
if (result-buf[r] == '/')
r++;
-   result-used = r;
+   varbuf_trunc(result, r);
debug(dbg_conffdetail,
  conffderef readlink relative to '%.*s',
  (int)result-used, result-buf);
diff --git a/src/processarc.c b/src/processarc.c
index 6a177f9..d955e8a 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -688,7 +688,7 @@ void process_archive(const char *filename) {
 usenode = namenodetouse(namenode, pkg);
 trig_file_activate(usenode, pkg);
 
-fnamevb.used= fnameidlu;
+varbuf_trunc(fnamevb, fnameidlu);
 varbufaddstr(fnamevb, usenode-name);
 varbufaddc(fnamevb,0);
 
@@ -854,7 +854,7 @@ void process_archive(const char *filename) {
 if (strlen(p)  MAXCONTROLFILENAME)
   ohshit(_(old version of package has overly-long info file name starting 
`%.250s'),
  de-d_name);
-infofnvb.used= infodirlen;
+varbuf_trunc(infofnvb, infodirlen);
 varbufaddstr(infofnvb,de-d_name);
 varbufaddc(infofnvb,0);
 strcpy(cidirrest,p);
@@ -1120,7 +1120,7 @@ void process_archive(const char *filename) {
   if (strlen(otherpkg-name) != (size_t)(p-de-d_name) ||
   strncmp(de-d_name,otherpkg-name,p-de-d_name)) continue;
   debug(dbg_stupidlyverbose, process_archive info this pkg);
-  fnvb.used= infodirbaseused;
+  varbuf_trunc(fnvb, infodirbaseused);
   varbufaddstr(fnvb,de-d_name);
   varbufaddc(fnvb,0);
   if (unlink(fnvb.buf))
@@ -1218,7 +1218,7 @@ void process_archive(const char *filename) {
*/
   for (cfile= newfileslist; cfile; cfile= cfile-next) {
 if (cfile-namenode-flags  fnnf_new_conff) continue;
-fnametmpvb.used= fnameidlu;
+varbuf_trunc(fnametmpvb, fnameidlu);
 varbufaddstr(fnametmpvb,namenodetouse(cfile-namenode,pkg)-name);
 varbufaddstr(fnametmpvb,DPKGTEMPEXT);
 varbufaddc(fnametmpvb,0);
diff --git a/src/querycmd.c b/src/querycmd.c
index 0cb54ca..d0cfe86 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -258,7 +258,8 @@ searchfiles(const char *const *argv)
   varbufaddstr(path, thisarg);
   varbufaddc(path, '\0');
 
-  path.used = path_rtrim_slash_slashdot(path.buf);
+  varbuf_trunc(path, path_rtrim_slash_slashdot(path.buf));
+
   thisarg = path.buf;
 }
 
@@ -528,7 +529,7 @@ control_path_pkg(struct pkginfo *pkg)
 if (strlen(p)  MAXCONTROLFILENAME)
   continue;
 
-db_path.used = db_path_len;
+varbuf_trunc(db_path, db_path_len);
 varbufaddstr(db_path, db_de-d_name);
 varbufaddc(db_path, '\0');
 
diff --git a/src/remove.c b/src/remove.c
index 571e1b0..2508ba9 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -66,7 +66,9

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-195-gc548891

2010-07-25 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 1433317d2fe83290ef02dbf54a6e4e650cb691d6
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 17 19:12:01 2010 +0200

libdpkg: Add new varbuf_trunc() function

diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index 11cd126..4846daf 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -50,6 +50,7 @@ LIBDPKG_PRIVATE {
varbufinit;
varbufreset;
varbuf_grow;
+   varbuf_trunc;
varbufaddc;
varbufdupc;
varbufsubstc;
diff --git a/lib/dpkg/test/t-varbuf.c b/lib/dpkg/test/t-varbuf.c
index cc1772d..637c6cc 100644
--- a/lib/dpkg/test/t-varbuf.c
+++ b/lib/dpkg/test/t-varbuf.c
@@ -92,6 +92,26 @@ test_varbuf_grow(void)
 }
 
 static void
+test_varbuf_trunc(void)
+{
+   struct varbuf vb;
+
+   varbufinit(vb, 50);
+
+   /* Test that we truncate (grow). */
+   varbuf_trunc(vb, 20);
+   test_pass(vb.used == 20);
+   test_pass(vb.size = 50);
+
+   /* Test that we truncate (shrink). */
+   varbuf_trunc(vb, 10);
+   test_pass(vb.used == 10);
+   test_pass(vb.size = 50);
+
+   varbuf_destroy(vb);
+}
+
+static void
 test_varbuf_addbuf(void)
 {
struct varbuf vb;
@@ -252,6 +272,7 @@ test(void)
test_varbuf_init();
test_varbuf_prealloc();
test_varbuf_grow();
+   test_varbuf_trunc();
test_varbuf_addbuf();
test_varbuf_addc();
test_varbuf_dupc();
diff --git a/lib/dpkg/varbuf.c b/lib/dpkg/varbuf.c
index 9bdd07f..2fce13e 100644
--- a/lib/dpkg/varbuf.c
+++ b/lib/dpkg/varbuf.c
@@ -128,6 +128,16 @@ varbuf_grow(struct varbuf *v, size_t need_size)
   v-buf = m_realloc(v-buf, v-size);
 }
 
+void
+varbuf_trunc(struct varbuf *v, size_t used_size)
+{
+  /* Make sure the caller does not claim more than available. */
+  if (v-size  used_size)
+internerr(varbuf: claimed used(%zu)  size(%zu), v-used, v-size);
+
+  v-used = used_size;
+}
+
 char *
 varbuf_detach(struct varbuf *v)
 {
diff --git a/lib/dpkg/varbuf.h b/lib/dpkg/varbuf.h
index f866afb..7d62037 100644
--- a/lib/dpkg/varbuf.h
+++ b/lib/dpkg/varbuf.h
@@ -66,6 +66,7 @@ struct varbuf {
 
 void varbufinit(struct varbuf *v, size_t size);
 void varbuf_grow(struct varbuf *v, size_t need_size);
+void varbuf_trunc(struct varbuf *v, size_t used_size);
 char *varbuf_detach(struct varbuf *v);
 void varbufreset(struct varbuf *v);
 void varbuf_destroy(struct varbuf *v);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-195-gc548891

2010-07-25 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e759410b2e9eb1c48bb344d2ad17bfc420ddf57a
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 25 14:51:11 2010 +0200

libdpkg: Fix buffer overflow in path_quote_filename

When the string was longer than the size limit, the loop would continue
as the unsigned size would wrap around 0 to SIZE_MAX, and subsequently
segfault on the out-of-bounds access. Use ssize_t for the size variable.

Regression introduced in f35d66dbc228bc8ad2c5255dee1bf4ecf9ee6e06.

diff --git a/lib/dpkg/path.c b/lib/dpkg/path.c
index 0b384be..c4ee2ee 100644
--- a/lib/dpkg/path.c
+++ b/lib/dpkg/path.c
@@ -105,9 +105,10 @@ path_make_temp_template(const char *suffix)
  * but here we escape all 8 bit chars, in order make it simple.
  */
 char *
-path_quote_filename(char *dst, const char *src, size_t size)
+path_quote_filename(char *dst, const char *src, size_t n)
 {
char *r = dst;
+   ssize_t size = (ssize_t)n;
 
while (size  0) {
switch (*src) {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-195-gc548891

2010-07-25 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 4cb6ae5d9e239c42c123910aa8407fbfed266ebf
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 25 19:43:30 2010 +0200

libdpkg: Add test case for command_exec

diff --git a/lib/dpkg/test/t-command.c b/lib/dpkg/test/t-command.c
index 5256913..881cab7 100644
--- a/lib/dpkg/test/t-command.c
+++ b/lib/dpkg/test/t-command.c
@@ -22,6 +22,7 @@
 #include compat.h
 
 #include dpkg/test.h
+#include dpkg/subproc.h
 #include dpkg/command.h
 
 static void
@@ -133,11 +134,31 @@ test_command_add_args(void)
 }
 
 static void
+test_command_exec(void)
+{
+   struct command cmd;
+   pid_t pid;
+
+   command_init(cmd, /bin/true, exec test);
+
+   command_add_arg(cmd, arg 0);
+   command_add_arg(cmd, arg 1);
+
+   pid = subproc_fork();
+
+   if (pid == 0)
+   command_exec(cmd);
+
+   subproc_wait_check(pid, command exec test, 0);
+}
+
+static void
 test(void)
 {
test_command_init();
test_command_add_arg();
test_command_add_argl();
test_command_add_args();
+   test_command_exec();
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-195-gc548891

2010-07-25 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c1615da1a2cc409bccbf89b4203b82c68041a6cb
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 25 19:23:07 2010 +0200

libdpkg: Complete test cases for the path module

diff --git a/lib/dpkg/test/t-path.c b/lib/dpkg/test/t-path.c
index 4ff41fc..d59288a 100644
--- a/lib/dpkg/test/t-path.c
+++ b/lib/dpkg/test/t-path.c
@@ -21,11 +21,13 @@
 #include config.h
 #include compat.h
 
+#include ctype.h
+#include stdbool.h
+#include stdlib.h
+
 #include dpkg/test.h
 #include dpkg/path.h
 
-#include stdlib.h
-
 /* Use the test_trim_eq_ref macro to avoid leaking the string and to get
  * meaningful line numbers from assert. */
 #define test_trim_eq_ref(p, ref) \
@@ -72,9 +74,95 @@ test_path_skip(void)
 }
 
 static void
+test_path_temp(void)
+{
+   char *template;
+
+   template = path_make_temp_template(test);
+
+   test_pass(strstr(template, test) != NULL);
+   test_pass(strstr(template, XX) != NULL);
+
+   free(template);
+}
+
+static bool
+string_is_ascii(const char *str)
+{
+   while (*str) {
+   if (!isascii(*str))
+   return false;
+
+   str++;
+   }
+
+   return true;
+}
+
+static void
+test_path_quote(void)
+{
+   const char src_7_bit[] = string with 7-bit chars only;
+   const char src_7_bit_trim[] = string with 7-bit chars;
+   const char src_8_bit[] = text w/ 8-bit chars: \\ \370 \300 \342 end;
+   const char src_8_bit_end[] = text \370;
+   const char src_bs_end[] = text \\;
+   char *dst;
+   size_t len;
+
+   /* Test no quoting. */
+   len = strlen(src_7_bit) + 1;
+   dst = malloc(len);
+   test_fail(dst == NULL);
+
+   path_quote_filename(dst, src_7_bit, len);
+   test_str(dst, ==, src_7_bit);
+   free(dst);
+
+   /* Test no quoting with limit. */
+   len = strlen(src_7_bit_trim) + 1;
+   dst = malloc(len);
+   test_fail(dst == NULL);
+
+   path_quote_filename(dst, src_7_bit, len);
+   test_str(dst, ==, src_7_bit_trim);
+   free(dst);
+
+   /* Test normal quoting. */
+   len = strlen(src_8_bit) * 2 + 1;
+   dst = malloc(len);
+   test_fail(dst == NULL);
+
+   path_quote_filename(dst, src_8_bit, len);
+   test_pass(strstr(dst, end) != NULL);
+   test_pass(string_is_ascii(dst));
+   free(dst);
+
+   /* Test normal quoting with limit. */
+   len = strlen(src_8_bit_end) + 1 + 2;
+   dst = malloc(len);
+   test_fail(dst == NULL);
+
+   path_quote_filename(dst, src_8_bit_end, len);
+   test_str(dst, ==, text );
+   free(dst);
+
+   /* Test backslash quoting with limit. */
+   len = strlen(src_bs_end) + 1;
+   dst = malloc(len);
+   test_fail(dst == NULL);
+
+   path_quote_filename(dst, src_bs_end, len);
+   test_str(dst, ==, text );
+   free(dst);
+}
+
+static void
 test(void)
 {
test_path_rtrim();
test_path_skip();
+   test_path_temp();
+   test_path_quote();
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 67d524ea0b9fe7b2a19c2f81c848a8523508a538
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 28 16:32:48 2010 +0200

Pass tar context pointer as an argument instead of a struct member

The context does not have anything to do with the TarInfo struct,
so pass it as a function argument either as 'void *' or as
'struct tarcontext *' if the type is known.

diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index 42bd3df..3f82d13 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -176,7 +176,7 @@ struct symlinkList {
 };
 
 int
-TarExtractor(void *userData, const struct tar_operations *ops)
+TarExtractor(void *ctx, const struct tar_operations *ops)
 {
int status;
char buffer[TARBLKSZ];
@@ -194,9 +194,8 @@ TarExtractor(void *userData, const struct tar_operations 
*ops)
 
h.Name = NULL;
h.LinkName = NULL;
-   h.UserData = userData;
 
-   while ((status = ops-read(userData, buffer, TARBLKSZ)) == TARBLKSZ) {
+   while ((status = ops-read(ctx, buffer, TARBLKSZ)) == TARBLKSZ) {
int nameLength;
 
if (!DecodeTarHeader(buffer, h)) {
@@ -236,7 +235,7 @@ TarExtractor(void *userData, const struct tar_operations 
*ops)
case NormalFile1:
/* Compatibility with pre-ANSI ustar. */
if (h.Name[nameLength - 1] != '/') {
-   status = ops-extract_file(h);
+   status = ops-extract_file(ctx, h);
break;
}
/* Else, fall through. */
@@ -244,10 +243,10 @@ TarExtractor(void *userData, const struct tar_operations 
*ops)
if (h.Name[nameLength - 1] == '/') {
h.Name[nameLength - 1] = '\0';
}
-   status = ops-mkdir(h);
+   status = ops-mkdir(ctx, h);
break;
case HardLink:
-   status = ops-link(h);
+   status = ops-link(ctx, h);
break;
case SymbolicLink:
symlink_node = m_malloc(sizeof(*symlink_node));
@@ -266,7 +265,7 @@ TarExtractor(void *userData, const struct tar_operations 
*ops)
case CharacterDevice:
case BlockDevice:
case FIFO:
-   status = ops-mknod(h);
+   status = ops-mknod(ctx, h);
break;
case GNU_LONGLINK:
case GNU_LONGNAME:
@@ -295,7 +294,7 @@ TarExtractor(void *userData, const struct tar_operations 
*ops)
 long_read -= TARBLKSZ) {
int copysize;
 
-   status = ops-read(userData, buffer, TARBLKSZ);
+   status = ops-read(ctx, buffer, TARBLKSZ);
/* If we didn't get TARBLKSZ bytes read, punt. 
*/
if (status != TARBLKSZ) {
 /* Read partial header record? */
@@ -332,7 +331,7 @@ TarExtractor(void *userData, const struct tar_operations 
*ops)
while (symlink_head) {
symlink_node = symlink_head-next;
if (status == 0)
-   status = ops-symlink(symlink_head-h);
+   status = ops-symlink(ctx, symlink_head-h);
free(symlink_head-h.Name);
free(symlink_head-h.LinkName);
free(symlink_head);
diff --git a/lib/dpkg/tarfn.h b/lib/dpkg/tarfn.h
index a4c7326..e5a7e63 100644
--- a/lib/dpkg/tarfn.h
+++ b/lib/dpkg/tarfn.h
@@ -50,7 +50,6 @@ enum TarFileType {
 
 struct TarInfo {
enum tar_format format; /* Tar archive format. */
-   void *  UserData;   /* User passed this in as argument */
char *  Name;   /* File name */
mode_t  Mode;   /* Unix mode, including device bits. */
size_t  Size;   /* Size of file */
@@ -62,8 +61,8 @@ structTarInfo {
gid_t   GroupID;/* Numeric GID */
 };
 
-typedef int (*tar_read_func)(void * userData, char * buffer, int length);
-typedef int (*tar_func)(struct TarInfo * h);
+typedef int (*tar_read_func)(void *ctx, char *buffer, int length);
+typedef int (*tar_func)(void *ctx, struct TarInfo *h);
 
 struct tar_operations {
tar_read_func read;
@@ -75,6 +74,6 @@ struct tar_operations {
tar_func mknod;
 };
 
-int TarExtractor(void *userData, const struct tar_operations *ops);
+int TarExtractor(void *ctx, const struct tar_operations *ops);
 
 #endif
diff --git a/src/archives.c b/src/archives.c
index 2b5b87e..68b7cfa 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -180,9 +180,8 @@ int

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit f8a9cacf8ada2dc14dcf86f34969f2f5b678bdee
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 28 16:03:02 2010 +0200

libdpkg: Rename and lower-case TarInfo members

diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index 9b631dd..3be6179 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -128,9 +128,9 @@ DecodeTarHeader(char *block, struct TarInfo *d)
else
d-format = tar_format_old;
 
-   d-Type = (enum tar_filetype)h-LinkFlag;
-   if (d-Type == tar_filetype_file0)
-   d-Type = tar_filetype_file;
+   d-type = (enum tar_filetype)h-LinkFlag;
+   if (d-type == tar_filetype_file0)
+   d-type = tar_filetype_file;
 
if (*h-UserName)
passwd = getpwnam(h-UserName);
@@ -139,26 +139,26 @@ DecodeTarHeader(char *block, struct TarInfo *d)
 
/* Concatenate prefix and name to support ustar style long names. */
if (d-format == tar_format_ustar  h-Prefix[0] != '\0')
-   d-Name = get_prefix_name(h);
+   d-name = get_prefix_name(h);
else
-   d-Name = StoC(h-Name, sizeof(h-Name));
-   d-LinkName = StoC(h-LinkName, sizeof(h-LinkName));
-   d-Mode = (mode_t)OtoL(h-Mode, sizeof(h-Mode));
-   d-Size = (size_t)OtoL(h-Size, sizeof(h-Size));
-   d-ModTime = (time_t)OtoL(h-ModificationTime,
- sizeof(h-ModificationTime));
-   d-Device = ((OtoL(h-MajorDevice,
-  sizeof(h-MajorDevice))  0xff)  8) |
-   (OtoL(h-MinorDevice, sizeof(h-MinorDevice))  0xff);
+   d-name = StoC(h-Name, sizeof(h-Name));
+   d-linkname = StoC(h-LinkName, sizeof(h-LinkName));
+   d-mode = (mode_t)OtoL(h-Mode, sizeof(h-Mode));
+   d-size = (size_t)OtoL(h-Size, sizeof(h-Size));
+   d-mtime = (time_t)OtoL(h-ModificationTime,
+   sizeof(h-ModificationTime));
+   d-dev = ((OtoL(h-MajorDevice,
+   sizeof(h-MajorDevice))  0xff)  8) |
+(OtoL(h-MinorDevice, sizeof(h-MinorDevice))  0xff);
checksum = OtoL(h-Checksum, sizeof(h-Checksum));
-   d-UserID = (uid_t)OtoL(h-UserID, sizeof(h-UserID));
-   d-GroupID = (gid_t)OtoL(h-GroupID, sizeof(h-GroupID));
+   d-uid = (uid_t)OtoL(h-UserID, sizeof(h-UserID));
+   d-gid = (gid_t)OtoL(h-GroupID, sizeof(h-GroupID));
 
if (passwd)
-   d-UserID = passwd-pw_uid;
+   d-uid = passwd-pw_uid;
 
if (group)
-   d-GroupID = group-gr_gid;
+   d-gid = group-gr_gid;
 
/* Treat checksum field as all blank. */
sum = ' ' * sizeof(h-Checksum);
@@ -195,14 +195,14 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
next_long_link = NULL;
symlink_tail = symlink_head = NULL;
 
-   h.Name = NULL;
-   h.LinkName = NULL;
+   h.name = NULL;
+   h.linkname = NULL;
 
while ((status = ops-read(ctx, buffer, TARBLKSZ)) == TARBLKSZ) {
int nameLength;
 
if (!DecodeTarHeader(buffer, h)) {
-   if (h.Name[0] == '\0') {
+   if (h.name[0] == '\0') {
/* End of tape. */
status = 0;
} else {
@@ -213,38 +213,38 @@ TarExtractor(void *ctx, const struct tar_operations *ops)
}
break;
}
-   if (h.Type != tar_filetype_gnu_longlink 
-   h.Type != tar_filetype_gnu_longname) {
+   if (h.type != tar_filetype_gnu_longlink 
+   h.type != tar_filetype_gnu_longname) {
if (next_long_name)
-   h.Name = next_long_name;
+   h.name = next_long_name;
 
if (next_long_link)
-   h.LinkName = next_long_link;
+   h.linkname = next_long_link;
 
next_long_link = NULL;
next_long_name = NULL;
}
 
-   if (h.Name[0] == '\0') {
+   if (h.name[0] == '\0') {
/* Indicates broken tarfile: “Bad header data”. */
errno = 0;
status = -1;
break;
}
 
-   nameLength = strlen(h.Name);
+   nameLength = strlen(h.name);
 
-   switch (h.Type) {
+   switch (h.type) {
case tar_filetype_file:
/* Compatibility with pre-ANSI ustar. */
-   if (h.Name[nameLength - 1] != '/') {
+   if (h.name[nameLength - 1] != '/') {
status = ops-extract_file(ctx, h

[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 15cf1342b886f548e8845dd042a72b028efc5d3d
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 28 17:48:01 2010 +0200

libdpkg: Rename TarExtractor to tar_extractor

diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index 4846daf..fc34370 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -136,7 +136,7 @@ LIBDPKG_PRIVATE {
progress_done;
 
# Tar support
-   TarExtractor;
+   tar_extractor;
 
# Non-freeing malloc (pool/arena)
nfmalloc;
diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index 3be6179..635a816 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -179,7 +179,7 @@ struct symlinkList {
 };
 
 int
-TarExtractor(void *ctx, const struct tar_operations *ops)
+tar_extractor(void *ctx, const struct tar_operations *ops)
 {
int status;
char buffer[TARBLKSZ];
diff --git a/lib/dpkg/tarfn.h b/lib/dpkg/tarfn.h
index eeede60..c692abc 100644
--- a/lib/dpkg/tarfn.h
+++ b/lib/dpkg/tarfn.h
@@ -74,6 +74,6 @@ struct tar_operations {
tar_func mknod;
 };
 
-int TarExtractor(void *ctx, const struct tar_operations *ops);
+int tar_extractor(void *ctx, const struct tar_operations *ops);
 
 #endif
diff --git a/src/archives.c b/src/archives.c
index e646810..7389e29 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -415,7 +415,7 @@ tarobject(void *ctx, struct TarInfo *ti)
 
   /* Append to list of files.
* The trailing / put on the end of names in tarfiles has already
-   * been stripped by TarExtractor (lib/tarfn.c).
+   * been stripped by tar_extractor (lib/tarfn.c).
*/
   oldnifd= tc-newfilesp;
   nifd= addfiletolist(tc, findnamenode(ti-name, 0));
diff --git a/src/processarc.c b/src/processarc.c
index d955e8a..e2d2a30 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -630,7 +630,7 @@ void process_archive(const char *filename) {
   tc.pkg= pkg;
   tc.backendpipe= p1[0];
 
-  r= TarExtractor((void*)tc, tf);
+  r = tar_extractor(tc, tf);
   if (r) {
 if (errno) {
   ohshite(_(error reading dpkg-deb tar output));

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 6c370bda300fca1c0e4e7ff99c22052a8d440142
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 29 06:48:10 2010 +0200

libdpkg: Move code handling tar uid/gid together

This avoids unneeded conversions and assignments when we have valid
username and groupname.

diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index 0893d62..c24e85d 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -3,6 +3,7 @@
  * tarfn.c - tar archive extraction functions
  *
  * Copyright © 1995 Bruce Perens
+ * Copyright © 2007-2010 Guillem Jover guil...@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
@@ -132,11 +133,6 @@ DecodeTarHeader(char *block, struct tar_entry *d)
if (d-type == tar_filetype_file0)
d-type = tar_filetype_file;
 
-   if (*h-UserName)
-   passwd = getpwnam(h-UserName);
-   if (*h-GroupName)
-   group = getgrnam(h-GroupName);
-
/* Concatenate prefix and name to support ustar style long names. */
if (d-format == tar_format_ustar  h-Prefix[0] != '\0')
d-name = get_prefix_name(h);
@@ -150,15 +146,22 @@ DecodeTarHeader(char *block, struct tar_entry *d)
d-dev = ((OtoL(h-MajorDevice,
sizeof(h-MajorDevice))  0xff)  8) |
 (OtoL(h-MinorDevice, sizeof(h-MinorDevice))  0xff);
-   checksum = OtoL(h-Checksum, sizeof(h-Checksum));
-   d-uid = (uid_t)OtoL(h-UserID, sizeof(h-UserID));
-   d-gid = (gid_t)OtoL(h-GroupID, sizeof(h-GroupID));
 
+   if (*h-UserName)
+   passwd = getpwnam(h-UserName);
if (passwd)
d-uid = passwd-pw_uid;
+   else
+   d-uid = (uid_t)OtoL(h-UserID, sizeof(h-UserID));
 
+   if (*h-GroupName)
+   group = getgrnam(h-GroupName);
if (group)
d-gid = group-gr_gid;
+   else
+   d-gid = (gid_t)OtoL(h-GroupID, sizeof(h-GroupID));
+
+   checksum = OtoL(h-Checksum, sizeof(h-Checksum));
 
/* Treat checksum field as all blank. */
sum = ' ' * sizeof(h-Checksum);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit d25407536dbed4cad2943187b36fbb6c92a6b5ab
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 28 15:06:19 2010 +0200

dpkg: Assign correct SE Linux label to non-regular files

The call to matchpathcon() was getting passed only the permission bits
of the mode argument, instead of the format type. Map the tar filetype
to the Unix mode and OR that information into the tar_entry mode member.

Closes: #587949

Based-on-patch-by: Russell Coker russ...@coker.com.au
Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 9a1248c..28d26d6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -97,6 +97,8 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Consistently use earlier/later instead of smaller/bigger when describing
 comparison relationships. Closes: #587641
   * Stop exporting DPKG_LIBDIR to maintainer scripts, no need for it anymore.
+  * Assign correct SE Linux label on non-regular files. Based on a patch by
+Russell Coker russ...@coker.com.au. Closes: #587949
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index c24e85d..c5b598d 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -22,6 +22,8 @@
 #include config.h
 #include compat.h
 
+#include sys/stat.h
+
 #include errno.h
 #include string.h
 #include pwd.h
@@ -111,6 +113,45 @@ get_prefix_name(struct TarHeader *h)
return s;
 }
 
+static mode_t
+get_unix_mode(struct TarHeader *h)
+{
+   mode_t mode;
+   enum tar_filetype type;
+
+   type = (enum tar_filetype)h-LinkFlag;
+
+   switch (type) {
+   case tar_filetype_file0:
+   case tar_filetype_file:
+   mode = S_IFREG;
+   break;
+   case tar_filetype_symlink:
+   mode = S_IFLNK;
+   break;
+   case tar_filetype_dir:
+   mode = S_IFDIR;
+   break;
+   case tar_filetype_chardev:
+   mode = S_IFCHR;
+   break;
+   case tar_filetype_blockdev:
+   mode = S_IFBLK;
+   break;
+   case tar_filetype_fifo:
+   mode = S_IFIFO;
+   break;
+   case tar_filetype_hardlink:
+   default:
+   mode = 0;
+   break;
+   }
+
+   mode |= OtoL(h-Mode, sizeof(h-Mode));
+
+   return mode;
+}
+
 static int
 DecodeTarHeader(char *block, struct tar_entry *d)
 {
@@ -139,7 +180,7 @@ DecodeTarHeader(char *block, struct tar_entry *d)
else
d-name = StoC(h-Name, sizeof(h-Name));
d-linkname = StoC(h-LinkName, sizeof(h-LinkName));
-   d-mode = (mode_t)OtoL(h-Mode, sizeof(h-Mode));
+   d-mode = get_unix_mode(h);
d-size = (size_t)OtoL(h-Size, sizeof(h-Size));
d-mtime = (time_t)OtoL(h-ModificationTime,
sizeof(h-ModificationTime));
diff --git a/src/archives.c b/src/archives.c
index 31c5f0c..d1daed4 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -261,6 +261,10 @@ set_selinux_path_context(const char *matchpath, const char 
*path, mode_t mode)
   security_context_t scontext = NULL;
   int ret;
 
+  /* If there's no file type, just give up. */
+  if ((mode  S_IFMT) == 0)
+return;
+
   /* Set selinux_enabled if it is not already set (singleton). */
   if (selinux_enabled  0)
 selinux_enabled = (is_selinux_enabled()  0);
@@ -274,7 +278,7 @@ set_selinux_path_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 = matchpathcon(matchpath, mode  ~S_IFMT, scontext);
+  ret = matchpathcon(matchpath, mode  S_IFMT, scontext);
   if (ret == -1 || (ret == 0  scontext == NULL))
 return;
 
@@ -761,9 +765,7 @@ tarobject(void *ctx, struct tar_entry *ti)
 internerr(unknown tar type '%d', but already checked, ti-type);
   }
 
-  set_selinux_path_context(fnamevb.buf, fnamenewvb.buf,
-   nifd-namenode-statoverride ?
-   nifd-namenode-statoverride-mode : ti-mode);
+  set_selinux_path_context(fnamevb.buf, fnamenewvb.buf, ti-mode);
 
   /* CLEANUP: Now we have extracted the new object in .dpkg-new (or,
* if the file already exists as a directory and we were trying to extract

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3b0d38c02236140b0422c4f45fdd0015b6240209
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 29 05:47:05 2010 +0200

dpkg-buildpackage: Add new -F option for full build

This enables to explicitly specify a normal full build and combine it
with -nc.

Closes: #547993

diff --git a/debian/changelog b/debian/changelog
index 28d26d6..7a15a02 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -99,6 +99,8 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Stop exporting DPKG_LIBDIR to maintainer scripts, no need for it anymore.
   * Assign correct SE Linux label on non-regular files. Based on a patch by
 Russell Coker russ...@coker.com.au. Closes: #587949
+  * Add -F option to dpkg-buildpackage to be able to explicitly specify a
+normal full build and combine it with -nc. Closes: #547993
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 7306348..6460e51 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -1,4 +1,4 @@
-.TH dpkg\-buildpackage 1 2010-03-07 Debian Project dpkg utilities
+.TH dpkg\-buildpackage 1 2010-07-29 Debian Project dpkg utilities
 .SH NAME
 dpkg\-buildpackage \- build binary or source packages from sources
 .
@@ -64,6 +64,10 @@ packages. Passed to \fBdpkg-genchanges\fP.
 .B \-S
 Specifies a source-only build, no binary packages need to be made.
 Passed to \fBdpkg-genchanges\fP.
+.TP
+.B \-F
+Specifies a normal full build, binary and source packages will be built.
+This is the same as the default case when no build option is specified.
 .P
 .BI \-\-target= target
 .br
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 89b8efe..aaea544 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -72,6 +72,7 @@ Options:
   -B binary-only, no arch-indep files.   } dpkg-genchanges
   -A binary-only, only arch-indep files. }
   -S source only, no binary files. }
+  -F normal full build (binaries and sources).
   -tsystem set GNU system type.   } passed to dpkg-architecture
   -vversionchanges since version version.  }
   -mmaint  maintainer for package is maint.}
@@ -219,6 +220,10 @@ while (@ARGV) {
$include = BUILD_SOURCE;
push @changes_opts, '-S';
@checkbuilddep_opts = ('-B');
+} elsif (/^-F$/) {
+   !build_normal  usageerr(_g(cannot combine %s and %s), $_, 
build_opt);
+   $include = BUILD_ALL;
+   @checkbuilddep_opts = ();
 } elsif (/^-v(.*)$/) {
$since = $1;
 } elsif (/^-m(.*)$/) {
@@ -238,7 +243,7 @@ while (@ARGV) {
 }
 
 if ($noclean) {
-# -nc without -b/-B/-A/-S implies -b
+# -nc without -b/-B/-A/-S/-F implies -b
 $include = BUILD_BINARY if ($include  BUILD_DEFAULT);
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 6d181ade5c67db8328289c6cadfb6b96f3dc89d2
Author: Osamu Aoki os...@debian.org
Date:   Thu Jul 29 06:07:11 2010 +0200

deb-control(5): Add missing mentions of the Breaks field

Alongside the other fields sharing the same syntax.

Closes: #590472

diff --git a/debian/changelog b/debian/changelog
index 7a15a02..022c982 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -101,6 +101,9 @@ dpkg (1.15.8) UNRELEASED; urgency=low
 Russell Coker russ...@coker.com.au. Closes: #587949
   * Add -F option to dpkg-buildpackage to be able to explicitly specify a
 normal full build and combine it with -nc. Closes: #547993
+  * Add missing mentions of the Breaks field alongside the other fields
+sharing the same syntax in deb-control(5).
+Thanks to Osamu Aoki os...@debian.org. Closes: #590472
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
diff --git a/man/deb-control.5 b/man/deb-control.5
index 5583abd..59bc69a 100644
--- a/man/deb-control.5
+++ b/man/deb-control.5
@@ -1,6 +1,6 @@
 .\ Author: Raul Miller
 .\ Includes text from the debian Guidelines by Ian Jackson, Ian Murdock
-.TH deb\-control 5 2007-10-08 Debian Project Debian
+.TH deb\-control 5 2010-07-29 Debian Project Debian
 .SH NAME
 deb\-control \- Debian packages' master control file format
 .
@@ -185,15 +185,19 @@ server from having to know the package names for all of 
them, and using
 `|' to separate the list.
 .LP
 The syntax of
+.BR Breaks ,
 .BR Conflicts ,
 .B Replaces
 and
 .B Provides
 is a list of package names, separated by commas (and optional whitespace).
 In the
+.B Breaks
+and
 .B Conflicts
-field, the comma should be read as `OR'. An optional version can also be
+fields, the comma should be read as `OR'. An optional version can also be
 given with the same syntax as above for the
+.BR Breaks ,
 .B Conflicts
 and
 .B Replaces

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 8b511ee6e78ed105558f5becfe117fe8cb887f9a
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 29 06:13:37 2010 +0200

dpkg-buildflags(1): Fix typo

diff --git a/man/dpkg-buildflags.1 b/man/dpkg-buildflags.1
index d151262..de0d154 100644
--- a/man/dpkg-buildflags.1
+++ b/man/dpkg-buildflags.1
@@ -1,4 +1,4 @@
-.TH dpkg\-buildflags 1 2010-04-11 Debian Project dpkg suite
+.TH dpkg\-buildflags 1 2010-07-29 Debian Project dpkg suite
 .SH NAME
 dpkg\-buildflags \- returns build flags to use during package build
 .
@@ -42,7 +42,7 @@ information about them.
 Print to standard output shell (if \fIformat\fP is \fBsh\fP) or make
 (if \fIformat\fP is \fBmake\fP) commands that can be used to export
 all the compilation flags in the environment. If the \fIformat\fP value is not
-given, \fBsh\fP is assumed. Only compilations flags starting with an
+given, \fBsh\fP is assumed. Only compilation flags starting with an
 upper case character are included, others are assumed to not be suitable
 for the environment.
 .TP

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-217-gcaba9f9

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 189dcd07b4cd62159fb0a28db79249d86c91fb1b
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 29 09:39:30 2010 +0200

Release 1.15.8

diff --git a/debian/changelog b/debian/changelog
index 022c982..a291980 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-dpkg (1.15.8) UNRELEASED; urgency=low
+dpkg (1.15.8) unstable; urgency=low
 
   [ Raphaël Hertzog ]
   * Add new commands --before-build and --after-build to dpkg-source
@@ -126,7 +126,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Russian (Yuri Kozlov). Closes: #579149
   * Swedish (Peter Krefting).
 
- -- Guillem Jover guil...@debian.org  Wed, 21 Apr 2010 04:40:12 +0200
+ -- Guillem Jover guil...@debian.org  Thu, 29 Jul 2010 09:37:35 +0200
 
 dpkg (1.15.7.2) unstable; urgency=low
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8-4-g5a580e2

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 5a580e28ba68f1482291ad86d823b487f74bcd70
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 29 20:26:53 2010 +0200

libcompat: On successful realloc assign the newlist to list

diff --git a/debian/changelog b/debian/changelog
index 95e897c..876dea1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,8 @@
 dpkg (1.15.9) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
+  * Fix realloc usage on compat scandir() implementation.
+
   [ Updated man page translations ]
   * German (Helge Kreutzmann).
 
diff --git a/lib/compat/scandir.c b/lib/compat/scandir.c
index ea7c484..6eac251 100644
--- a/lib/compat/scandir.c
+++ b/lib/compat/scandir.c
@@ -74,6 +74,7 @@ scandir(const char *dir, struct dirent ***namelist,
newlist = realloc(list, avail * sizeof(struct dirent 
*));
if (!newlist)
return cleanup(d, list, used);
+   list = newlist;
}
 
m = malloc(sizeof(struct dirent) + strlen(e-d_name));

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.1-6-g7444c87

2010-07-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7444c878aa6a0adabec28800f5015a33239e45a5
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 29 21:38:54 2010 +0200

Add missing space in changelog

diff --git a/debian/changelog b/debian/changelog
index 7bb03a8..aea3542 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,7 +6,7 @@ dpkg (1.15.9) UNRELEASED; urgency=low
   [ Updated man page translations ]
   * German (Helge Kreutzmann).
 
-   [ Updated scripts translations ]
+  [ Updated scripts translations ]
   * German (Helge Kreutzmann).
 
  -- Guillem Jover guil...@debian.org  Thu, 29 Jul 2010 11:00:22 +0200

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.1-3-g4aed1d7

2010-07-30 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 4aed1d728958584769d469540e9ae6103e13d424
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 31 04:20:18 2010 +0200

Release 1.15.8.2

diff --git a/debian/changelog b/debian/changelog
index 6962491..0dcc00e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-dpkg (1.15.8.2) UNRELEASED; urgency=low
+dpkg (1.15.8.2) unstable; urgency=low
 
   * Bump libdpkg-perl Depends on dpkg to 1.15.8, as it will break dpkg
 versions before that when installing and removing libdpkg-perl,
@@ -8,7 +8,7 @@ dpkg (1.15.8.2) UNRELEASED; urgency=low
   * Allow specifying again absolute and relative paths for dpkg-buildpackage
 -r option. Closes: #591010
 
- -- Guillem Jover guil...@debian.org  Fri, 30 Jul 2010 04:35:25 +0200
+ -- Guillem Jover guil...@debian.org  Sat, 31 Jul 2010 04:20:01 +0200
 
 dpkg (1.15.8.1) unstable; urgency=low
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository annotated tag, 1.15.8.2, created. 1.15.8.2

2010-07-30 Thread Guillem Jover
The annotated tag, 1.15.8.2 has been created
at  5d150dd82ddedd945e57ea164ad7b658742a2845 (tag)
   tagging  4aed1d728958584769d469540e9ae6103e13d424 (commit)
  replaces  1.15.8.1
 tagged by  Guillem Jover
on  Sat Jul 31 04:22:12 2010 +0200

- Shortlog 
Release 1.15.8.2
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAkxTiNkACgkQuW9ciZ2SjJsL9wCg+vNjYPjPIuQgv6SuIfeuKjLd
EoQAmwWzDC1TUxUuMld7p03E+AqpjMLQ
=TSC9
-END PGP SIGNATURE-

Guillem Jover (3):
  Bump libdpkg-perl Depends on dpkg to 1.15.8
  dpkg-buildpackage: Allow specifying absolute and relative paths on -r
  Release 1.15.8.2

---

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.2-7-g03b4300

2010-07-30 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 03b4300e51cec35e49e38aef14d72acb6adea6bb
Merge: 7444c878aa6a0adabec28800f5015a33239e45a5 
4aed1d728958584769d469540e9ae6103e13d424
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 31 04:39:19 2010 +0200

Merge branch 'sid' (through tag '1.15.8.2')

Conflicts:
debian/changelog

diff --combined debian/changelog
index aea3542,0dcc00e..f93936d
--- a/debian/changelog
+++ b/debian/changelog
@@@ -1,16 -1,15 +1,28 @@@
 +dpkg (1.15.9) UNRELEASED; urgency=low
 +
 +  [ Guillem Jover ]
 +  * Fix realloc usage on compat scandir() implementation.
 +
 +  [ Updated man page translations ]
 +  * German (Helge Kreutzmann).
 +
 +  [ Updated scripts translations ]
 +  * German (Helge Kreutzmann).
 +
 + -- Guillem Jover guil...@debian.org  Thu, 29 Jul 2010 11:00:22 +0200
 +
+ dpkg (1.15.8.2) unstable; urgency=low
+ 
+   * Bump libdpkg-perl Depends on dpkg to 1.15.8, as it will break dpkg
+ versions before that when installing and removing libdpkg-perl,
+ because older update-alternatives and dpkg-divert require Dpkg.pm and
+ Dpkg/Gettext.pm which will disappear due to the Replaces. Closes: #590867
+ Thanks to Sven Joachim svenj...@gmx.de for the analysis.
+   * Allow specifying again absolute and relative paths for dpkg-buildpackage
+ -r option. Closes: #591010
+ 
+  -- Guillem Jover guil...@debian.org  Sat, 31 Jul 2010 04:20:01 +0200
+ 
  dpkg (1.15.8.1) unstable; urgency=low
  
* Fix off-by-one error in update-alternatives that lead to an infinite loop

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.2-3-g624aa0f

2010-08-02 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 624aa0fadb9daf2757563197fa376b8223d11f2d
Author: Guillem Jover guil...@debian.org
Date:   Mon Aug 2 10:38:28 2010 +0200

Release 1.15.8.3

diff --git a/debian/changelog b/debian/changelog
index 4de941e..1e4f02c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-dpkg (1.15.8.3) UNRELEASED; urgency=low
+dpkg (1.15.8.3) unstable; urgency=low
 
   [ Raphaël Hertzog ]
   * Fix dpkg-divert test suite to cope with + and other special characters for
@@ -11,7 +11,7 @@ dpkg (1.15.8.3) UNRELEASED; urgency=low
 armel. Thanks to Phil Kern for the analysis and Reinhard Tartler for the
 initial patch. Closes: #591312
 
- -- Raphaël Hertzog hert...@debian.org  Sun, 01 Aug 2010 08:54:39 +0200
+ -- Guillem Jover guil...@debian.org  Mon, 02 Aug 2010 10:38:07 +0200
 
 dpkg (1.15.8.2) unstable; urgency=low
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.2-11-gf56c9fc

2010-08-02 Thread Guillem Jover
The following commit has been merged in the master branch:
commit f56c9fc6a07f609a122696c463c25caf4ebd36ff
Merge: 03b4300e51cec35e49e38aef14d72acb6adea6bb 
624aa0fadb9daf2757563197fa376b8223d11f2d
Author: Guillem Jover guil...@debian.org
Date:   Mon Aug 2 10:53:35 2010 +0200

Merge branch 'sid' (through tag '1.15.8.3')

Conflicts:
debian/changelog

diff --combined debian/changelog
index f93936d,1e4f02c..c79469d
--- a/debian/changelog
+++ b/debian/changelog
@@@ -1,16 -1,18 +1,31 @@@
 +dpkg (1.15.9) UNRELEASED; urgency=low
 +
 +  [ Guillem Jover ]
 +  * Fix realloc usage on compat scandir() implementation.
 +
 +  [ Updated man page translations ]
 +  * German (Helge Kreutzmann).
 +
 +  [ Updated scripts translations ]
 +  * German (Helge Kreutzmann).
 +
 + -- Guillem Jover guil...@debian.org  Thu, 29 Jul 2010 11:00:22 +0200
 +
+ dpkg (1.15.8.3) unstable; urgency=low
+ 
+   [ Raphaël Hertzog ]
+   * Fix dpkg-divert test suite to cope with + and other special characters for
+ regexps in the build directory name. Thanks to Jonathan Nieder for the
+ patch and to Phil Kern for the report. Closes: #591182
+ 
+   [ Guillem Jover ]
+   * Fix buffer overflow in dpkg_ar_member_put_header causing it to write the
+ header to fd 0 (instead of ar_fd) depending on the stack layout, affecting
+ armel. Thanks to Phil Kern for the analysis and Reinhard Tartler for the
+ initial patch. Closes: #591312
+ 
+  -- Guillem Jover guil...@debian.org  Mon, 02 Aug 2010 10:38:07 +0200
+ 
  dpkg (1.15.8.2) unstable; urgency=low
  
* Bump libdpkg-perl Depends on dpkg to 1.15.8, as it will break dpkg

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.2-13-gae947e1

2010-08-05 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 499088b2a6e94991d516cb7ee851698ccea5192b
Author: Guillem Jover guil...@debian.org
Date:   Tue Aug 3 03:10:01 2010 +0200

Move glob module to libdpkg

diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index 7d4b26a..c366251 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -35,6 +35,7 @@ libdpkg_a_SOURCES = \
ehandle.c \
file.c \
fields.c \
+   glob.c \
i18n.h \
log.c \
md5.c md5.h \
@@ -70,6 +71,7 @@ pkginclude_HEADERS = \
dpkg.h \
dpkg-db.h \
file.h \
+   glob.h \
macros.h \
myopt.h \
parsedump.h \
diff --git a/src/glob.c b/lib/dpkg/glob.c
similarity index 98%
rename from src/glob.c
rename to lib/dpkg/glob.c
index 475e7da..f2a6e50 100644
--- a/src/glob.c
+++ b/lib/dpkg/glob.c
@@ -24,8 +24,7 @@
 #include stdlib.h
 
 #include dpkg/dpkg.h
-
-#include glob.h
+#include dpkg/glob.h
 
 void
 glob_list_prepend(struct glob_node **list, char *pattern)
diff --git a/src/glob.h b/lib/dpkg/glob.h
similarity index 93%
rename from src/glob.h
rename to lib/dpkg/glob.h
index fbab69a..5cd44f2 100644
--- a/src/glob.h
+++ b/lib/dpkg/glob.h
@@ -18,8 +18,8 @@
  * along with this program.  If not, see http://www.gnu.org/licenses/.
  */
 
-#ifndef DPKG_GLOB_H
-#define DPKG_GLOB_H
+#ifndef LIBDPKG_GLOB_H
+#define LIBDPKG_GLOB_H
 
 #include dpkg/macros.h
 
@@ -35,4 +35,4 @@ void glob_list_free(struct glob_node *head);
 
 DPKG_END_DECLS
 
-#endif /* DPKG_GLOB_H */
+#endif /* LIBDPKG_GLOB_H */
diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index fc34370..b3b5706 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -72,6 +72,9 @@ LIBDPKG_PRIVATE {
 
file_copy_perms;
 
+   glob_list_prepend;
+   glob_list_free;
+
# Buffer I/O functions
buffer_init;
buffer_read;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9291570..92d71a5 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -11,6 +11,7 @@ lib/dpkg/dump.c
 lib/dpkg/ehandle.c
 lib/dpkg/fields.c
 lib/dpkg/file.c
+lib/dpkg/glob.c
 lib/dpkg/log.c
 lib/dpkg/md5.c
 lib/dpkg/mlib.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 7656d45..063ab05 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,7 +48,6 @@ dpkg_LDADD = \
$(SELINUX_LIBS)
 
 dpkg_divert_SOURCES = \
-   glob.c glob.h \
filesdb.c filesdb.h \
divertdb.c \
divertcmd.c
@@ -69,7 +68,6 @@ dpkg_query_LDADD = \
$(LIBINTL)
 
 dpkg_statoverride_SOURCES = \
-   glob.c glob.h \
filesdb.c filesdb.h \
statdb.c \
statcmd.c
diff --git a/src/divertcmd.c b/src/divertcmd.c
index 1e7614f..ca17939 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -39,10 +39,10 @@
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
 #include dpkg/file.h
+#include dpkg/glob.h
 #include dpkg/buffer.h
 #include dpkg/myopt.h
 
-#include glob.h
 #include filesdb.h
 
 
diff --git a/src/statcmd.c b/src/statcmd.c
index b398650..ce70433 100644
--- a/src/statcmd.c
+++ b/src/statcmd.c
@@ -42,10 +42,10 @@
 #include dpkg/dpkg-db.h
 #include dpkg/path.h
 #include dpkg/dir.h
+#include dpkg/glob.h
 #include dpkg/myopt.h
 
 #include main.h
-#include glob.h
 #include filesdb.h
 
 const char thisname[] = dpkg-statoverrides;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.2-13-gae947e1

2010-08-05 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ae947e1d0380470924c99385951f86b936492bc7
Author: Guillem Jover guil...@debian.org
Date:   Tue Aug 3 03:17:48 2010 +0200

libdpkg: Add missing symbols to Versions script

diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index b3b5706..6d6ca1b 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -164,6 +164,7 @@ LIBDPKG_PRIVATE {
informative;
copy_dependency_links;
pkg_sorter_by_name;
+   pkg_summary;
 
# Package list handling
pkg_list_new;
@@ -208,6 +209,7 @@ LIBDPKG_PRIVATE {
 
# Log based package on-disk database support
modstatdb_init;
+   modstatdb_is_locked;
modstatdb_lock;
modstatdb_unlock;
modstatdb_note;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.2-16-g2499850

2010-08-12 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 30bd7ddbffe3ad4b5d5dc78c5dd1b0f5b07ccfd6
Author: Guillem Jover guil...@debian.org
Date:   Wed Aug 11 15:51:56 2010 +0200

libdpkg: Always print a massage on warning when parsing control files

The warnings were only being issues on dpkg-deb parsing, which greatly
defeats their purpose, as using dpkg-deb is not truly needed to
generate '.deb' packages. So printing always will give them wider
exposure.

The parse_warn() function is not using warning() though, which makes
the output miss the program name, but the changes needed for this are
too intrusive at this time, and it's only a cosmetic issue afterall, so
we'll leave this for later.

diff --git a/debian/changelog b/debian/changelog
index 8dc6a24..bff0a33 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ dpkg (1.15.8.4) UNRELEASED; urgency=low
   [ Guillem Jover ]
   * Fix use after free segfault on update-alternatives --remove-all.
 Closes: #591653, #591654
+  * Always print a massage on warning when parsing control files.
 
   [ Raphaël Hertzog ]
   * Fix make -C man install so that it actually finds the manual pages
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 89695e8..f575237 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -106,7 +106,10 @@ int parsedb(const char *filename, enum parsedbflags flags,
   ps.filename = filename;
   ps.flags = flags;
   ps.lno = 0;
-  ps.warnto = warnto;
+  if (warnto == NULL)
+ps.warnto = stderr;
+  else
+ps.warnto = warnto;
   ps.warncount = 0;
 
   newpifp= (flags  pdb_recordavailable) ? newpig.available : 
newpig.installed;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.2-16-g2499850

2010-08-12 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 55ed7ef4ac47abec9055e78bf9b5ff8c1b6006ad
Author: Fabian Groffen grob...@gentoo.org
Date:   Fri Aug 13 04:43:03 2010 +0200

u-a: Include limits.h for _POSIX_MAX_PATH

Needed on at least Solaris and Darwin, and as defined per POSIX.

Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index fe7d779..ee7136e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ dpkg (1.15.8.4) UNRELEASED; urgency=low
   * Fix compilation on Solaris and Darwin:
 - Link update-alternatives against libintl if libc does not have i18n
   support.
+- Include limits.h for _POSIX_MAX_PATH in update-alternatives.
 Thanks to Fabian Groffen grob...@gentoo.org.
 
   [ Raphaël Hertzog ]
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index b1fc315..aa36f69 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -41,6 +41,7 @@
 #include assert.h
 #include locale.h
 #include ctype.h
+#include limits.h
 
 #include dpkg/macros.h
 #include dpkg/i18n.h

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.2-16-g2499850

2010-08-12 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 6598274e9b04ff7940c1d0201b66c87c79604f56
Author: Sven Joachim svenj...@gmx.de
Date:   Fri Aug 13 05:55:02 2010 +0200

Remove spurious leftover .dpkg-tmp files after unpacking failure

Renaming the backup copy to the old name is a no-op if these are
hard links to the same file. So we need to remove the backup copy
afterwards to make sure it is gone.

Closes: #591993

Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index ee7136e..9ccb703 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,11 @@ dpkg (1.15.8.4) UNRELEASED; urgency=low
   * When analyzing the ELF format of a binary in dpkg-shlibdeps, fallback on
 usual objdump when the cross objdump failed. Closes: #591522
 
+  [ Sven Joachim ]
+  * Ensure removal of leftover backup .dpkg-tmp files after unpacking
+failures, when the backup is still a hard link to the original file.
+Closes: #591993
+
  -- Guillem Jover guil...@debian.org  Thu, 05 Aug 2010 17:42:51 +0200
 
 dpkg (1.15.8.3) unstable; urgency=low
diff --git a/src/cleanup.c b/src/cleanup.c
index a51eecc..e31ee9d 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -90,6 +90,10 @@ void cu_installnew(int argc, void **argv) {
 /* Either we can do an atomic restore, or we've made room: */
 if (rename(fnametmpvb.buf,fnamevb.buf))
   ohshite(_(unable to restore backup version of 
`%.250s'),namenode-name);
+/* If foo.dpkg-tmp was still a hard link to foo, then the atomic
+ * rename did nothing, so we make sure to remove the backup. */
+else if (unlink(fnametmpvb.buf)  errno != ENOENT)
+  ohshite(_(unable to remove backup copy of '%.250s'), namenode-name);
   } else if (namenode-flags  fnnf_placed_on_disk) {
 debug(dbg_eachfiledetail,cu_installnew removing new file);
 if (unlinkorrmdir(fnamevb.buf)  errno != ENOENT  errno != ENOTDIR)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository annotated tag, 1.15.8.4, created. 1.15.8.4

2010-08-19 Thread Guillem Jover
The annotated tag, 1.15.8.4 has been created
at  b8795448860e67e1a8d7a9607a3f9bd526439e44 (tag)
   tagging  2499850fd03395b37ce77cc84976656767056674 (commit)
  replaces  1.15.8.3
 tagged by  Guillem Jover
on  Fri Aug 13 06:27:38 2010 +0200

- Shortlog 
Release 1.15.8.4
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAkxkybsACgkQuW9ciZ2SjJttFACeJxrewi09cUqL/lcv2bqjURLP
Zt8AnRssqZgP5GL5EWeui89Paj1iAwf/
=q7nt
-END PGP SIGNATURE-

Fabian Groffen (2):
  build: Link u-a against libintl if libc does not have i18n support
  u-a: Include limits.h for _POSIX_MAX_PATH

Guillem Jover (8):
  u-a: Fix use after free causing segfaults on --remove-all
  u-a: Add non-regression test for --remove-all
  build: Fix uninstall target in man/Makefile.am
  libdpkg: Always print a massage on warning when parsing control files
  libdpkg: When parsing database files only warn on bogus versions
  dpkg-statoverride: Fix typos
  Regenerate .pot files and merge .po files with them
  Release 1.15.8.4

Raphaël Hertzog (2):
  Fix install target in man/Makefile.am
  Dpkg::Shlibs::Objdump::get_format() fallback to host objdump if cross one 
failed

Sven Joachim (1):
  Remove spurious leftover .dpkg-tmp files after unpacking failure

---

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.4-5-gbbc30fb

2010-08-21 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 16e3b71283d53f56774e1aaceb567f898dc1389c
Author: Joey Hess jo...@debian.org
Date:   Tue Aug 17 17:00:44 2010 -0400

dpkg-source(1): Improve git format documentation

Based-on-patch-by: Tanguy Ortolo
Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index dd90e42..2bfbdb4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
   * Do not print a warning when parsing status or status log files on
 half-installed packages w/o a Description or Maintainer field, as
 this happens normally when the package was never installed before.
+  * Improve git format documentation in dpkg-source(1).
+Thanks to Joey Hess, based on a patch by Tanguy Ortolo.
 
  -- Guillem Jover guil...@debian.org  Sat, 21 Aug 2010 08:09:39 +0200
 
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index 3d87bc5..69b84fe 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -555,12 +555,18 @@ The generated .dsc file will contain this value in its 
\fIFormat\fP field
 and not 3.0 (custom).
 .
 .SS Format: 3.0 (git)
-This format is experimental. It uses a bundle of a git repository to hold
-the source of a package.
+This format is experimental.
+.PP
+A source package in this format consists of a
+single bundle of a git repository \fB.git\fP to hold the source of a package.
+There may also be a \fB.gitshallow\fP file listing revisions for a shallow
+git clone.
 .PP
 .B Extracting
 .PP
-The bundle is cloned to a new git repository.
+The bundle is cloned as a git repository to the target directory.
+If there is a gitshallow file, it is installed as `.git/shallow` inside
+the cloned git repository.
 .PP
 Note that by default the new repository will have the same branch checked
 out that was checked out in the original source. (Typically master, but

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.4-5-gbbc30fb

2010-08-21 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit bbc30fb513d891a6de77e15ef8d6ffb187c6bc5a
Author: The Fungi fu...@yuggoth.org
Date:   Thu Aug 19 17:42:07 2010 +

dpkg(1): Clarify effect of --purge on files in homedirs

Closes: #593628

Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index b784da4..ae724cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
 this happens normally when the package was never installed before.
   * Improve git format documentation in dpkg-source(1).
 Thanks to Joey Hess, based on a patch by Tanguy Ortolo.
+  * Clarify effect of “dpkg --purge” on homedir files in dpkg(1).
+Thanks to The Fungi fu...@yuggoth.org. Closes: #593628
 
   [ Updated programs translations ]
   * Italian (Milo Casagrande). Closes: #592953
diff --git a/man/dpkg.1 b/man/dpkg.1
index 2e064e2..0fdaf97 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -86,8 +86,8 @@ The package is selected for deinstallation (i.e. we want to 
remove all
 files, except configuration files).
 .TP
 .B purge
-The package is selected to be purged (i.e. we want to remove everything,
-even configuration files).
+The package is selected to be purged (i.e. we want to remove everything
+from system directories, even configuration files).
 .SS PACKAGE FLAGS
 .TP
 .B reinst\-required
@@ -172,7 +172,9 @@ respectively. Note: some configuration files might be 
unknown to
 \fBdpkg\fP because they are created and handled separately through the
 configuration scripts. In that case, \fBdpkg\fP won't remove them by
 itself, but the package's \fIpostrm\fP script (which is called by
-\fBdpkg\fP), has to take care of their removal during purge.
+\fBdpkg\fP), has to take care of their removal during purge. Of course,
+this only applies to files in system directories, not configuration files
+written to individual users' home directories.
 
 Removing of a package consists of the following steps:
 .br

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.4-20-gcac9ac6

2010-08-25 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 9226ef57a108f76c0f22f8c933d5902350c34858
Author: Guillem Jover guil...@debian.org
Date:   Thu Aug 26 04:01:04 2010 +0200

build: Remove xgettext _g keyword for the dpkg domain

The dpkg domain consists only of C sources, so there's no need anymore
for the Perl specific _g keyword.

diff --git a/po/Makevars b/po/Makevars
index f929a0b..ab6c72f 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -8,7 +8,7 @@ subdir = po
 top_builddir = ..
 
 # These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=_g --from-code=UTF-8
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --from-code=UTF-8
 
 MSGMERGE_OPTIONS = --previous
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.4-20-gcac9ac6

2010-08-25 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit 4509efdc143c85b77df68b7a3b0728e66580701d
Author: Guillem Jover guil...@debian.org
Date:   Wed Aug 25 08:12:53 2010 +0200

Add gettext plurals infrastructure support

diff --git a/debian/changelog b/debian/changelog
index 1ab15f2..732e8de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
 Thanks to Joey Hess, based on a patch by Tanguy Ortolo.
   * Clarify effect of “dpkg --purge” on homedir files in dpkg(1).
 Thanks to The Fungi fu...@yuggoth.org. Closes: #593628
+  * Add gettext plurals infrastructure support.
 
   [ Raphaël Hertzog ]
   * Fix dpkg-genchanges to not split the short description in the middle of a
diff --git a/lib/dpkg/i18n.h b/lib/dpkg/i18n.h
index 5bd7e8c..58865e0 100644
--- a/lib/dpkg/i18n.h
+++ b/lib/dpkg/i18n.h
@@ -2,7 +2,7 @@
  * libdpkg - Debian packaging suite library routines
  * i18n.h - i18n support
  *
- * Copyright © 2008 Guillem Jover guil...@debian.org
+ * Copyright © 2008-2010 Guillem Jover guil...@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
@@ -28,6 +28,7 @@ DPKG_BEGIN_DECLS
 #include gettext.h
 
 #define _(str) gettext(str)
+#define P_(str, str_plural, n) ngettext(str, str_plural, n)
 #define N_(str) gettext_noop(str)
 
 DPKG_END_DECLS
diff --git a/po/Makevars b/po/Makevars
index ab6c72f..cad0f64 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -8,7 +8,7 @@ subdir = po
 top_builddir = ..
 
 # These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --from-code=UTF-8
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2 --from-code=UTF-8
 
 MSGMERGE_OPTIONS = --previous
 
diff --git a/scripts/Dpkg/Gettext.pm b/scripts/Dpkg/Gettext.pm
index 338f48a..2586869 100644
--- a/scripts/Dpkg/Gettext.pm
+++ b/scripts/Dpkg/Gettext.pm
@@ -44,17 +44,23 @@ BEGIN {
return $_[1];
}
}
+   sub P_ {
+   return ngettext(@_);
+   }
};
} else {
eval q{
sub _g {
return gettext(shift);
}
+   sub P_ {
+   return ngettext(@_);
+   }
};
}
 }
 
 use base qw(Exporter);
-our @EXPORT=qw(_g textdomain ngettext);
+our @EXPORT=qw(_g P_ textdomain ngettext);
 
 1;
diff --git a/scripts/po/Makevars b/scripts/po/Makevars
index a4cebad..90ed7bd 100644
--- a/scripts/po/Makevars
+++ b/scripts/po/Makevars
@@ -8,7 +8,7 @@ subdir = scripts/po
 top_builddir = ../..
 
 # These options get passed to xgettext.
-XGETTEXT_OPTIONS = --from-code=iso-8859-1 --keyword=_g
+XGETTEXT_OPTIONS = --from-code=iso-8859-1 --keyword=_g --keyword=P_:1,2
 
 MSGMERGE_OPTIONS = --previous
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.4-20-gcac9ac6

2010-08-25 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit cac9ac66948552462ffb94f106b9cb7550525de3
Author: Guillem Jover guil...@debian.org
Date:   Wed Aug 25 08:15:40 2010 +0200

Add gettext messages for plural forms

Some of the singular forms are not currently used, but we keep them for
consistency, and to avoid confusing translators.

Closes: #594218

diff --git a/debian/changelog b/debian/changelog
index 732e8de..856a540 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
   * Clarify effect of “dpkg --purge” on homedir files in dpkg(1).
 Thanks to The Fungi fu...@yuggoth.org. Closes: #593628
   * Add gettext plurals infrastructure support.
+  * Add gettext messages for plural forms. Closes: #594218
 
   [ Raphaël Hertzog ]
   * Fix dpkg-genchanges to not split the short description in the middle of a
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index b095a81..9ca729b 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -376,7 +376,10 @@ void do_build(const char *const *argv) {
   ohshite(_(error opening conffiles file));
 }
 if (warns)
-  warning(_(ignoring %d warnings about the control file(s)\n), warns);
+  warning(P_(ignoring %d warning about the control file(s)\n,
+ ignoring %d warnings about the control file(s)\n, warns),
+  warns);
+
   }
   m_output(stdout, _(standard output));
   
diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index d56d6f9..56cf823 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -117,10 +117,9 @@ static void info_spew(const char *debar, const char 
*directory,
   }
   varbuf_destroy(controlfile);
 
-  if (re==1)
-ohshit(_(One requested control component is missing));
-  else if (re1)
-ohshit(_(%d requested control components are missing), re);
+  if (re  0)
+ohshit(P_(%d requested control component is missing,
+  %d requested control components are missing, re), re);
 }
 
 static void info_list(const char *debar, const char *directory) {
diff --git a/dpkg-split/join.c b/dpkg-split/join.c
index ad9fb06..ff38e88 100644
--- a/dpkg-split/join.c
+++ b/dpkg-split/join.c
@@ -42,7 +42,9 @@ void reassemble(struct partinfo **partlist, const char 
*outputfile) {
   unsigned int i;
   size_t nr,buffersize;
 
-  printf(_(Putting package %s together from %d parts: ),
+  printf(P_(Putting package %s together from %d part: ,
+Putting package %s together from %d parts: ,
+partlist[0]-maxpartn),
  partlist[0]-package,partlist[0]-maxpartn);
   
   buffersize= partlist[0]-maxpartlen;
diff --git a/scripts/Dpkg/Source/Package/V2.pm 
b/scripts/Dpkg/Source/Package/V2.pm
index 6c852ac..8f6618e 100644
--- a/scripts/Dpkg/Source/Package/V2.pm
+++ b/scripts/Dpkg/Source/Package/V2.pm
@@ -414,9 +414,12 @@ sub do_build {
 };
 find({ wanted = $check_binary, preprocess = $filter_ignore,
no_chdir = 1 }, File::Spec-catdir($dir, debian));
-error(_g(detected %d unwanted binary file(s)  .
-(add them in debian/source/include-binaries to allow their  .
-inclusion).), $unwanted_binaries) if $unwanted_binaries;
+error(P_(detected %d unwanted binary file (add it in  .
+ debian/source/include-binaries to allow its inclusion).,
+ detected %d unwanted binary files (add them in  .
+ debian/source/include-binaries to allow their inclusion).,
+ $unwanted_binaries), $unwanted_binaries)
+ if $unwanted_binaries;
 
 # Create a patch
 my $autopatch = File::Spec-catfile($dir, debian, patches,
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index 554cae6..9bc2e17 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -376,8 +376,10 @@ foreach my $file (keys %exec) {
}
}
 }
-warning(_g(%d other similar warnings have been skipped (use -v to see  .
-   them all).), $nb_skipped_warnings) if $nb_skipped_warnings;
+warning(P_(%d similar warning has been skipped (use -v to see it).,
+   %d other similar warnings have been skipped (use -v to see  .
+   them all)., $nb_skipped_warnings), $nb_skipped_warnings)
+if $nb_skipped_warnings;
 foreach my $soname (@sonames) {
# Adjust minimal version of dependencies with information
# extracted from build-dependencies
diff --git a/src/enquiry.c b/src/enquiry.c
index 1f46b22..8d23d41 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -254,7 +254,9 @@ void unpackchk(const char *const *argv) {
   putchar('\n');
 }
   } else {
-printf(_( %d packages, from the following sections:),totalcount);
+printf(P_( %d package, from the following section:,
+   %d packages, from the following sections:, totalcount),
+   totalcount);
 width= 0;
 for (se= sectionentries; se; se= se-next) {
   sprintf(buf,%d,se-count);
diff --git

[SCM] dpkg's main repository branch, sid, updated. 1.15.8.4-27-gdbbd15f

2010-09-01 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit dbbd15fe8d972b4f8f3a4d94934a99c507cf0596
Author: Guillem Jover guil...@debian.org
Date:   Wed Sep 1 08:15:38 2010 +0200

u-a: Fix possible segfault if master_file contains a format specifier

The input does not get sanitized, and as such the user could end up
registering a file containing format string specifiers, which would
make the pr() call most probably segfault trying to access an invalid
pointer.

Reported-by: Sandro Cazzaniga cazzaniga.san...@gmail.com

diff --git a/debian/changelog b/debian/changelog
index 35bbbde..b037f3d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,9 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
 Thanks to The Fungi fu...@yuggoth.org. Closes: #593628
   * Add gettext plurals infrastructure support.
   * Add gettext messages for plural forms. Closes: #594218
+  * Fix possible but improbable segfault in update-alternatives in case
+the master file name contains a format string specifier. Reported by
+Sandro Cazzaniga.
 
   [ Raphaël Hertzog ]
   * Fix dpkg-genchanges to not split the short description in the middle of a
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 7c609ea..1636225 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1412,7 +1412,7 @@ alternative_display_list(struct alternative *a)
struct fileset *fs;
 
for (fs = a-choices; fs; fs = fs-next)
-   pr(fs-master_file);
+   pr(%s, fs-master_file);
 }
 
 static const char *

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.4-21-g309d928

2010-09-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit fd194e479228a39fe614eb771503d6f1abe9204a
Author: Guillem Jover guil...@debian.org
Date:   Wed Sep 1 09:39:56 2010 +0200

Bump version to 1.16.0

diff --git a/TODO b/TODO
index 57b5776..c4f5cb6 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,7 @@ RoadMap
 TODO
 
 
-1.15.x (squeeze)
+1.16.x
 ~~
 
  * Review this file and remove or update the old entries.
@@ -93,9 +93,6 @@ TODO
 
  * We should set our own obstack_alloc_failed_handler.
 
-1.16.x (squeeze + 1)
-~~
-
  * Remove compatibility symlinks
/usr/sbin/{update-alternatives,dpkg-divert,dpkg-statoverride}.
  * Remove install-info wrapper.
diff --git a/debian/changelog b/debian/changelog
index 0bacc34..5e24cf4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-dpkg (1.15.9) UNRELEASED; urgency=low
+dpkg (1.16.0) UNRELEASED; urgency=low
 
   [ Guillem Jover ]
   * Fix realloc usage on compat scandir() implementation.

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.4-21-g309d928

2010-09-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 309d92878a7572032ea3f97f0bc3e1971f8db18d
Author: Guillem Jover guil...@debian.org
Date:   Wed Sep 1 09:43:30 2010 +0200

libdpkg: Clarify fd_fd_copy error string in dpkg_ar_member_put_header

This makes the error string clearer, and as a side effect removes a
bogus warning due to the non literal format string, which is perfectly
fine here as it's under complete control from the programmer.

Reported-by: Sandro Cazzaniga cazzaniga.san...@gmail.com

diff --git a/lib/dpkg/ar.c b/lib/dpkg/ar.c
index b8d5475..28ce001 100644
--- a/lib/dpkg/ar.c
+++ b/lib/dpkg/ar.c
@@ -97,7 +97,7 @@ dpkg_ar_member_put_file(const char *ar_name, int ar_fd,
dpkg_ar_member_put_header(ar_name, ar_fd, name, st.st_size);
 
/* Copy data contents. */
-   fd_fd_copy(fd, ar_fd, -1, name);
+   fd_fd_copy(fd, ar_fd, -1, _(ar member file (%s)), name);
 
if (st.st_size  1)
if (write(ar_fd, \n, 1)  0)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.15.8.4-60-gf3a8a02

2010-09-13 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit f3a8a022f1a2edc5ff8d0e92ffc3e48e84be8b39
Author: Guillem Jover guil...@debian.org
Date:   Tue Sep 14 01:26:55 2010 +0200

Release 1.15.8.5

diff --git a/debian/changelog b/debian/changelog
index 04b9751..8a67e23 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-dpkg (1.15.8.5) UNRELEASED; urgency=low
+dpkg (1.15.8.5) unstable; urgency=low
 
   [ Guillem Jover ]
   * Do not print a warning when parsing status or status log files on
@@ -14,6 +14,7 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
   * Fix possible but improbable segfault in update-alternatives in case
 the master file name contains a format string specifier. Reported by
 Sandro Cazzaniga.
+  * Fix realloc usage on compat scandir() implementation.
 
   [ Raphaël Hertzog ]
   * Fix dpkg-genchanges to not split the short description in the middle of a
@@ -30,22 +31,18 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
   * Fix encoding of German addendum. Closes: #595643
 
   [ Updated programs translations ]
+  * Esperanto (Felipe Castro). Closes: #596173
   * French (Christian Perrier).
   * German (Sven Joachim).
-  * Italian (Milo Casagrande). Closes: #592953
-  * Simplified Chinese (Aron Xu). Closes: #594513
-  * Swedish (Peter Krefting).
-  * Thai (Theppitak Karoonboonyanan). Closes: #594011
-  * Norwegian Bokmål (Hans Nordhaug). Closes: #595208
+  * Indonesian (Arief S Fitrianto). Closes: #596657
+  * Italian (Milo Casagrande). Closes: #592953, #595615
   * Japanese (Kenshi Muto). Closes: #595468
   * Korean (Changwoo Ryu). Closes: #595556
-  * Italian (Milo Casagrande). Closes: #595615
+  * Norwegian Bokmål (Hans Nordhaug). Closes: #595208
+  * Simplified Chinese (Aron Xu). Closes: #594513
   * Slovak (Ivan Masár). Closes: #595968
-  * Esperanto (Felipe Castro). Closes: #596173
-  * Indonesian (Arief S Fitrianto). Closes: #596657
-
-  [ Guillem Jover ]
-  * Fix realloc usage on compat scandir() implementation.
+  * Swedish (Peter Krefting).
+  * Thai (Theppitak Karoonboonyanan). Closes: #594011
 
   [ Updated man page translations ]
   * French (Christian Perrier).
@@ -56,12 +53,12 @@ dpkg (1.15.8.5) UNRELEASED; urgency=low
   * French (Christian Perrier). Includes a fix to a specific
 message translation that was imprecise. Closes: #596333
   * German (Helge Kreutzmann). Improved by Holger Wansing.
+  * Norwegian Bokmål (Hans Fredrik Nordhaug). Closes: #595299
+  * Spanish (Omar Campagne).  Closes: #596518
   * Swedish (Peter Krefting).
   * Russian (Yuri Kozlov). Closes: #595175
-  * Bokmål, Norwegian (Hans Fredrik Nordhaug). Closes: #595299
-  * Spanish (Omar Campagne).  Closes: #596518
 
- -- Guillem Jover guil...@debian.org  Sat, 21 Aug 2010 08:09:39 +0200
+ -- Guillem Jover guil...@debian.org  Tue, 14 Sep 2010 01:26:21 +0200
 
 dpkg (1.15.8.4) unstable; urgency=low
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 1dddc6d46dbf6f3611cf0979e27547d06f9549c3
Author: Guillem Jover guil...@debian.org
Date:   Wed Sep 8 03:57:10 2010 +0200

dpkg: Rename unlinkorrmdir() to secure_remove()

Maps better to the system remove(2) function name.

diff --git a/src/archives.c b/src/archives.c
index d1daed4..fdfad13 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -311,24 +311,27 @@ void setupfnamevbs(const char *filename) {
 fnamevb.buf, fnametmpvb.buf, fnamenewvb.buf);
 }
 
-int unlinkorrmdir(const char *filename) {
+int
+secure_remove(const char *filename)
+{
   /* Returns 0 on success or -1 on failure, just like unlink  rmdir */
   int r, e;
   
   if (!rmdir(filename)) {
-debug(dbg_eachfiledetail,unlinkorrmdir `%s' rmdir OK,filename);
+debug(dbg_eachfiledetail, secure_remove '%s' rmdir OK, filename);
 return 0;
   }
   
   if (errno != ENOTDIR) {
 e= errno;
-debug(dbg_eachfiledetail,unlinkorrmdir `%s' rmdir 
%s,filename,strerror(e));
+debug(dbg_eachfiledetail, secure_remove '%s' rmdir %s, filename,
+  strerror(e));
 errno= e; return -1;
   }
   
   r = secure_unlink(filename);
   e = errno;
-  debug(dbg_eachfiledetail,unlinkorrmdir `%s' unlink %s,
+  debug(dbg_eachfiledetail, secure_remove '%s' unlink %s,
 filename, r ? strerror(e) : OK);
   errno= e; return r;
 }
diff --git a/src/archives.h b/src/archives.h
index 9f47aa2..0150086 100644
--- a/src/archives.h
+++ b/src/archives.h
@@ -62,7 +62,8 @@ void cu_prermdeconfigure(int argc, void **argv);
 void ok_prermdeconfigure(int argc, void **argv);
 
 void setupfnamevbs(const char *filename);
-int unlinkorrmdir(const char *filename);
+
+int secure_remove(const char *filename);
 
 int tarobject(void *ctx, struct tar_entry *ti);
 int tarfileread(void *ud, char *buf, int len);
diff --git a/src/cleanup.c b/src/cleanup.c
index e31ee9d..484232d 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -81,7 +81,7 @@ void cu_installnew(int argc, void **argv) {
* link to the new version we may have created.
*/
   debug(dbg_eachfiledetail,cu_installnew restoring nonatomic);
-  if (unlinkorrmdir(fnamevb.buf)  errno != ENOENT  errno != ENOTDIR)
+  if (secure_remove(fnamevb.buf)  errno != ENOENT  errno != ENOTDIR)
 ohshite(_(unable to remove newly-installed version of `%.250s' to 
allow
  reinstallation of backup copy),namenode-name);
 } else {
@@ -96,14 +96,14 @@ void cu_installnew(int argc, void **argv) {
   ohshite(_(unable to remove backup copy of '%.250s'), namenode-name);
   } else if (namenode-flags  fnnf_placed_on_disk) {
 debug(dbg_eachfiledetail,cu_installnew removing new file);
-if (unlinkorrmdir(fnamevb.buf)  errno != ENOENT  errno != ENOTDIR)
+if (secure_remove(fnamevb.buf)  errno != ENOENT  errno != ENOTDIR)
   ohshite(_(unable to remove newly-installed version of `%.250s'),
  namenode-name);
   } else {
 debug(dbg_eachfiledetail,cu_installnew not restoring);
   }
   /* Whatever, we delete foo.dpkg-new now, if it still exists. */
-  if (unlinkorrmdir(fnamenewvb.buf)  errno != ENOENT  errno != ENOTDIR)
+  if (secure_remove(fnamenewvb.buf)  errno != ENOENT  errno != ENOTDIR)
 ohshite(_(unable to remove newly-extracted version of 
`%.250s'),namenode-name);
 
   cleanup_pkg_failed--; cleanup_conflictor_failed--;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 4ff39dabad2cd8e384f26f3212a55b5adbeb71d9
Author: Guillem Jover guil...@debian.org
Date:   Sat Sep 11 06:20:37 2010 +0200

Update TODO list

diff --git a/TODO b/TODO
index c4f5cb6..038f575 100644
--- a/TODO
+++ b/TODO
@@ -23,9 +23,12 @@ TODO
(1.x = 2.x) while minor version bump will be used for backwards
compatible extension (e.g. new fields).
 
- * Make dpkg bootstrappable.
+ * Build:
+   - Make dpkg bootstrappable.
+   - Check availability of warning flags at configure time.
+   - Handle missing lstat at configure time by erroring out.
 
- * Code cleanup:
+ * Code cleanup / bug fixes:
- Get rid of static variables inside functions.
- Coalesce admindir / infodir / foodir generation.
- Get rid of setjmp (at least in the general case, keep for dpkg itself?)
@@ -45,8 +48,21 @@ TODO
- Replace raw write and read calls with safe variants (signals etc).
- Make deb build version a version instead of doing checks over a string.
- Use enums for currently hardcoded literals (tdus, dependtry, etc).
-
- * Cleanup libcompat:
+   - Namespace pkg_db funcs.
+   - Do not use nfmalloc (and friends) for non in-core db memory.
+   - Call nffreeall on exit (need to detangle nfmalloc from non-db first).
+   - Add a size parameter to the buffer api to avoid some useless
+ pipe+fork+copy.
+   - Handle instdir '/' separator consistently.
+   - Check if caching selinux context for second call is possible.
+   - Refactor parse_warn/parse_error.
+   - Make parse_warn use warning().
+   - Add missing newlines in --version output.
+   - Fix leak on tar_extract (name, linkname).
+   - Handle symlinks in statcmd.c statdb_node_apply().
+   - Fix dpkg termination on SIGPIPE from status-fd.
+
+ * libcompat cleanup:
- Add fnmatch, IRIX5 doesn't have it.
 
  * Man pages:
@@ -62,6 +78,7 @@ TODO
- Fix «.  ».
 
  * L10n:
+   - Check dpkg-divert strings for new and fixable ones.
- Standardize translated error messages in the perl code to avoid useless
  work for translators.
- Check http://d-i.alioth.debian.org/spellcheck/level5/index.html

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 6a7e76a292d865e3abeff4fdd086780dda3f49d8
Author: Guillem Jover guil...@debian.org
Date:   Sat Sep 11 06:19:17 2010 +0200

libdpkg: Remove unused stream_md5 macro

diff --git a/lib/dpkg/buffer.h b/lib/dpkg/buffer.h
index 54f084f..4321bbd 100644
--- a/lib/dpkg/buffer.h
+++ b/lib/dpkg/buffer.h
@@ -54,9 +54,6 @@ struct buffer_data {
 # define fd_md5(fd, hash, limit, ...) \
buffer_copy_IntPtr(fd, BUFFER_READ_FD, hash, BUFFER_WRITE_MD5, \
   limit, __VA_ARGS__)
-# define stream_md5(file, hash, limit, ...) \
-   buffer_copy_PtrPtr(file, BUFFER_READ_STREAM, hash, BUFFER_WRITE_MD5, \
-  limit, __VA_ARGS__)
 # define fd_fd_copy(fd1, fd2, limit, ...) \
buffer_copy_IntInt(fd1, BUFFER_READ_FD, fd2, BUFFER_WRITE_FD, \
   limit, __VA_ARGS__)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0cb6f131d85f48f0dc8a90ca1329af84c6f6ebc1
Author: Guillem Jover guil...@debian.org
Date:   Sun Sep 12 07:22:21 2010 +0200

libdpkg: Refactor file locking error message handling

Pass only the description of the resource being locked, and move generic
error strings inside the file lock funtions. Instead of changing locking
behaviour depending on the error strings passed, pass an explicit enum to
select it.

diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c
index fb2aeb2..0366ce4 100644
--- a/lib/dpkg/dbmodify.c
+++ b/lib/dpkg/dbmodify.c
@@ -195,9 +195,7 @@ modstatdb_lock(const char *admindir)
 }
   }
 
-  file_lock(dblockfd, dblockfile,
-_(unable to lock dpkg status database),
-_(status database area is locked by another process));
+  file_lock(dblockfd, FILE_LOCK_NOWAIT, dblockfile, _(dpkg status 
database));
 
   free(dblockfile);
 }
diff --git a/lib/dpkg/file.c b/lib/dpkg/file.c
index 40fbbea..3c817ee 100644
--- a/lib/dpkg/file.c
+++ b/lib/dpkg/file.c
@@ -67,6 +67,7 @@ static void
 file_unlock_cleanup(int argc, void **argv)
 {
int lockfd = *(int*)argv[0];
+   const char *lock_desc = argv[1];
struct flock fl;
 
assert(lockfd = 0);
@@ -74,7 +75,7 @@ file_unlock_cleanup(int argc, void **argv)
file_lock_setup(fl, F_UNLCK);
 
if (fcntl(lockfd, F_SETLK, fl) == -1)
-   ohshite(_(unable to unlock dpkg status database));
+   ohshite(_(unable to unlock %s), lock_desc);
 }
 
 void
@@ -108,21 +109,28 @@ file_is_locked(int lockfd, const char *filename)
 /* lockfd must be allocated statically as its addresses is passed to
  * a cleanup handler. */
 void
-file_lock(int *lockfd, const char *filename,
-  const char *emsg, const char *emsg_eagain)
+file_lock(int *lockfd, enum file_lock_flags flags, const char *filename,
+  const char *desc)
 {
struct flock fl;
+   int lock_cmd;
 
setcloexec(*lockfd, filename);
 
file_lock_setup(fl, F_WRLCK);
 
-   if (fcntl(*lockfd, emsg_eagain ? F_SETLK : F_SETLKW, fl) == -1) {
-   if (emsg_eagain  (errno == EACCES || errno == EAGAIN))
-   ohshit(emsg_eagain);
-   ohshite(emsg);
+   if (flags == FILE_LOCK_WAIT)
+   lock_cmd = F_SETLKW;
+   else
+   lock_cmd = F_SETLK;
+
+   if (fcntl(*lockfd, lock_cmd, fl) == -1) {
+   if (errno == EACCES || errno == EAGAIN)
+   ohshit(_(%s is locked by another process), desc);
+   else
+   ohshite(_(unable to lock %s), desc);
}
 
-   push_cleanup(file_unlock_cleanup, ~0, NULL, 0, 1, lockfd);
+   push_cleanup(file_unlock_cleanup, ~0, NULL, 0, 2, lockfd, desc);
 }
 
diff --git a/lib/dpkg/file.h b/lib/dpkg/file.h
index 24dca2c..ce16c04 100644
--- a/lib/dpkg/file.h
+++ b/lib/dpkg/file.h
@@ -32,9 +32,14 @@ DPKG_BEGIN_DECLS
  */
 void file_copy_perms(const char *src, const char *dst);
 
+enum file_lock_flags {
+   FILE_LOCK_NOWAIT,
+   FILE_LOCK_WAIT,
+};
+
 bool file_is_locked(int lockfd, const char *filename);
-void file_lock(int *lockfd, const char *filename,
-   const char *emsg, const char *emsg_eagain);
+void file_lock(int *lockfd, enum file_lock_flags flags, const char *filename,
+   const char *desc);
 void file_unlock(void);
 
 DPKG_END_DECLS
diff --git a/lib/dpkg/trigdeferred.l b/lib/dpkg/trigdeferred.l
index 3be1e83..7bd4e91 100644
--- a/lib/dpkg/trigdeferred.l
+++ b/lib/dpkg/trigdeferred.l
@@ -126,8 +126,7 @@ trigdef_update_start(enum trigdef_updateflags uf, const 
char *admindir)
}
}
 
-   file_lock(lock_fd, fn.buf, _(unable to lock triggers area),
- NULL);
+   file_lock(lock_fd, FILE_LOCK_WAIT, fn.buf, _(triggers area));
} else {
/* Dummy for pop_cleanups. */
push_cleanup(NULL, 0, NULL, 0, 0);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ceb07b08dad4d5eead630064f45c7e7ded00a341
Author: Guillem Jover guil...@debian.org
Date:   Thu Sep 16 19:52:41 2010 +0200

Refactor file_stat code

Create a new file_stat struct, and use it instead of the
filestatoverride one.

diff --git a/lib/dpkg/file.h b/lib/dpkg/file.h
index ce16c04..f9360d7 100644
--- a/lib/dpkg/file.h
+++ b/lib/dpkg/file.h
@@ -2,7 +2,7 @@
  * libdpkg - Debian packaging suite library routines
  * file.h - file handling routines
  *
- * Copyright © 2008 Guillem Jover guil...@debian.org
+ * Copyright © 2008-2010 Guillem Jover guil...@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
@@ -21,12 +21,21 @@
 #ifndef LIBDPKG_FILE_H
 #define LIBDPKG_FILE_H
 
+#include sys/types.h
+
 #include stdbool.h
 
 #include dpkg/macros.h
 
 DPKG_BEGIN_DECLS
 
+struct file_stat {
+   uid_t uid;
+   gid_t gid;
+   mode_t mode;
+   time_t mtime;
+};
+
 /*
  * Copy file ownership and permissions from one file to another.
  */
diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index c5b598d..dd22e20 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -180,10 +180,10 @@ DecodeTarHeader(char *block, struct tar_entry *d)
else
d-name = StoC(h-Name, sizeof(h-Name));
d-linkname = StoC(h-LinkName, sizeof(h-LinkName));
-   d-mode = get_unix_mode(h);
+   d-stat.mode = get_unix_mode(h);
d-size = (size_t)OtoL(h-Size, sizeof(h-Size));
-   d-mtime = (time_t)OtoL(h-ModificationTime,
-   sizeof(h-ModificationTime));
+   d-stat.mtime = (time_t)OtoL(h-ModificationTime,
+sizeof(h-ModificationTime));
d-dev = ((OtoL(h-MajorDevice,
sizeof(h-MajorDevice))  0xff)  8) |
 (OtoL(h-MinorDevice, sizeof(h-MinorDevice))  0xff);
@@ -191,16 +191,16 @@ DecodeTarHeader(char *block, struct tar_entry *d)
if (*h-UserName)
passwd = getpwnam(h-UserName);
if (passwd)
-   d-uid = passwd-pw_uid;
+   d-stat.uid = passwd-pw_uid;
else
-   d-uid = (uid_t)OtoL(h-UserID, sizeof(h-UserID));
+   d-stat.uid = (uid_t)OtoL(h-UserID, sizeof(h-UserID));
 
if (*h-GroupName)
group = getgrnam(h-GroupName);
if (group)
-   d-gid = group-gr_gid;
+   d-stat.gid = group-gr_gid;
else
-   d-gid = (gid_t)OtoL(h-GroupID, sizeof(h-GroupID));
+   d-stat.gid = (gid_t)OtoL(h-GroupID, sizeof(h-GroupID));
 
checksum = OtoL(h-Checksum, sizeof(h-Checksum));
 
diff --git a/lib/dpkg/tarfn.h b/lib/dpkg/tarfn.h
index 0401cb0..2e6a3b4 100644
--- a/lib/dpkg/tarfn.h
+++ b/lib/dpkg/tarfn.h
@@ -3,6 +3,7 @@
  * tarfn.h - tar archive extraction functions
  *
  * Copyright © 1995 Bruce Perens
+ * Copyright © 2009-2010 Guillem Jover guil...@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
@@ -26,6 +27,8 @@
 #include unistd.h
 #include stdlib.h
 
+#include dpkg/file.h
+
 #define TARBLKSZ   512
 
 enum tar_format {
@@ -54,11 +57,9 @@ struct tar_entry {
char *name; /* File name */
char *linkname; /* Name for symbolic and hard links */
size_t size;/* Size of file */
-   time_t mtime;   /* Last-modified time */
-   mode_t mode;/* Unix mode, including device bits. */
-   uid_t uid;  /* Numeric UID */
-   gid_t gid;  /* Numeric GID */
dev_t dev;  /* Special device for mknod() */
+
+   struct file_stat stat;
 };
 
 typedef int (*tar_read_func)(void *ctx, char *buffer, int length);
diff --git a/src/archives.c b/src/archives.c
index fdfad13..5103a94 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -4,6 +4,7 @@
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
  * Copyright © 2000 Wichert Akkerman wakke...@debian.org
+ * Copyright © 2007-2010 Guillem Jover guil...@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
@@ -46,6 +47,7 @@
 #include dpkg/buffer.h
 #include dpkg/subproc.h
 #include dpkg/command.h
+#include dpkg/file.h
 #include dpkg/tarfn.h
 #include dpkg/myopt.h
 #include dpkg/triglib.h
@@ -231,26 +233,23 @@ does_replace(struct pkginfo *newpigp, struct 
pkginfoperfile *newpifp,
 }
 
 static void
-newtarobject_utime(const char *path, struct tar_entry *ti)
+newtarobject_utime(const char *path, struct file_stat *st)
 {
   struct utimbuf utb;
   utb.actime= currenttime;
-  utb.modtime = ti-mtime;
+  utb.modtime = st-mtime;
   if (utime(path,utb))
-ohshite(_(error setting timestamps

[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2a71e444e863a4bf28b7dd39e621c44ab771db99
Author: Guillem Jover guil...@debian.org
Date:   Sat Sep 11 06:21:36 2010 +0200

dpkg-deb: Remove unused safe_fflush function

This function was used to fix a problem with undefined behaviour on
input streams, which does not apply anymore as it's not used.

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index 91fc89a..004d798 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -122,24 +122,6 @@ parseheaderlength(const char *inh, size_t len,
   return (size_t)r;
 }
 
-static void
-safe_fflush(FILE *f)
-{
-#if defined(__GLIBC__)  (__GLIBC__ == 2)  (__GLIBC_MINOR__  0)
-  /* XXX: Glibc 2.1 and some versions of Linux want to make fflush()
-   * move the current fpos. Remove this code some time. */
-  fpos_t fpos;
-
-  if (fgetpos(f, fpos))
-ohshit(_(failed getting the current file position));
-  fflush(f);
-  if (fsetpos(f, fpos))
-ohshit(_(failed setting the current file position));
-#else
-  fflush(f);
-#endif
-}
-
 void extracthalf(const char *debar, const char *directory,
  const char *taroption, int admininfo) {
   char versionbuf[40];

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 6e5d5c1f05edbe0ce2213a6658b438668fe48cba
Author: Guillem Jover guil...@debian.org
Date:   Wed Oct 6 11:53:36 2010 +0200

libdpkg: Move ehandle declarations to its own header file

diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index 3e39ccb..97950e9 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -24,9 +24,7 @@
 
 #include sys/types.h
 
-#include setjmp.h
 #include stddef.h
-#include stdarg.h
 #include stdio.h
 
 #include dpkg/macros.h
@@ -104,7 +102,7 @@ DPKG_BEGIN_DECLS
 
 #define FIND_EXPRSTARTCHARS -(),!
 
-extern const char thisname[]; /* defined separately in each program */
+#include dpkg/ehandle.h
 
 /*** from startup.c ***/
 
@@ -121,35 +119,6 @@ extern const char thisname[]; /* defined separately in 
each program */
   error_unwind(ehflag_normaltidy);\
 } while (0)
 
-/*** from ehandle.c ***/
-
-extern volatile int onerr_abort;
-
-typedef void error_printer(const char *emsg, const char *contextstring);
-
-void push_error_handler(jmp_buf *jbufp, error_printer *printerror,
-const char *contextstring);
-void set_error_display(error_printer *printerror, const char *contextstring);
-void print_error_fatal(const char *emsg, const char *contextstring);
-void error_unwind(int flagset);
-void push_cleanup(void (*f1)(int argc, void **argv), int flagmask1,
-  void (*f2)(int argc, void **argv), int flagmask2,
-  unsigned int nargs, ...);
-void push_checkpoint(int mask, int value);
-void pop_cleanup(int flagset);
-enum { ehflag_normaltidy=01, ehflag_bombout=02, ehflag_recursiveerror=04 };
-
-void do_internerr(const char *file, int line, const char *fmt, ...)
-   DPKG_ATTR_NORET DPKG_ATTR_PRINTF(3);
-#define internerr(...) do_internerr(__FILE__, __LINE__, __VA_ARGS__)
-
-void ohshit(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
-void ohshitv(const char *fmt, va_list args)
-   DPKG_ATTR_NORET DPKG_ATTR_VPRINTF(1);
-void ohshite(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
-void werr(const char *what) DPKG_ATTR_NORET;
-void warning(const char *fmt, ...) DPKG_ATTR_PRINTF(1);
-
 /*** log.c ***/
 
 extern const char *log_file;
diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c
index 84838b7..7345b27 100644
--- a/lib/dpkg/ehandle.c
+++ b/lib/dpkg/ehandle.c
@@ -31,7 +31,7 @@
 
 #include dpkg/macros.h
 #include dpkg/i18n.h
-#include dpkg/dpkg.h
+#include dpkg/ehandle.h
 
 static const char *errmsg; /* points to errmsgbuf or malloc'd */
 static char errmsgbuf[4096];
diff --git a/lib/dpkg/ehandle.h b/lib/dpkg/ehandle.h
new file mode 100644
index 000..856cd19
--- /dev/null
+++ b/lib/dpkg/ehandle.h
@@ -0,0 +1,73 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * ehandle.h - error handling
+ *
+ * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
+ * Copyright © 2000,2001 Wichert Akkerman wich...@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 http://www.gnu.org/licenses/.
+ */
+
+#ifndef LIBDPKG_EHANDLE_H
+#define LIBDPKG_EHANDLE_H
+
+#include setjmp.h
+#include stddef.h
+#include stdarg.h
+
+#include dpkg/macros.h
+
+DPKG_BEGIN_DECLS
+
+extern const char thisname[]; /* defined separately in each program */
+
+extern volatile int onerr_abort;
+
+enum {
+   ehflag_normaltidy = 01,
+   ehflag_bombout = 02,
+   ehflag_recursiveerror = 04
+};
+
+typedef void error_printer(const char *emsg, const char *contextstring);
+
+void print_error_fatal(const char *emsg, const char *contextstring);
+
+void push_error_handler(jmp_buf *jbufp, error_printer *printerror,
+const char *contextstring);
+void error_unwind(int flagset);
+void set_error_display(error_printer *printerror, const char *contextstring);
+
+void push_cleanup(void (*f1)(int argc, void **argv), int flagmask1,
+  void (*f2)(int argc, void **argv), int flagmask2,
+  unsigned int nargs, ...);
+void push_checkpoint(int mask, int value);
+void pop_cleanup(int flagset);
+
+void warning(const char *fmt, ...) DPKG_ATTR_PRINTF(1);
+
+void ohshitv(const char *fmt, va_list args)
+   DPKG_ATTR_NORET DPKG_ATTR_VPRINTF(1);
+void ohshit(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
+void ohshite(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
+
+void werr(const char *what) DPKG_ATTR_NORET;
+
+void do_internerr(const char *file

[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e8079c0ee34d4b3309ffbbd500b16525e9ec1b22
Author: Guillem Jover guil...@debian.org
Date:   Tue Nov 2 08:16:56 2010 +0100

libdpkg: Switch test.h from including dpkg/dpkg.h to dpkg/ehandle.h

This reduces the exposed declarations for each test program.

diff --git a/lib/dpkg/test.h b/lib/dpkg/test.h
index 5e8f1ad..eb18f17 100644
--- a/lib/dpkg/test.h
+++ b/lib/dpkg/test.h
@@ -25,7 +25,7 @@
 #include string.h
 
 #ifndef TEST_MAIN_PROVIDED
-#include dpkg/dpkg.h
+#include dpkg/ehandle.h
 #endif
 
 /* XXX: Using assert is problematic with NDEBUG. */

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit a67107c05153db3fde51301450439761e1916a80
Author: Guillem Jover guil...@debian.org
Date:   Wed Oct 6 20:10:47 2010 +0200

Use ACTION macros instead of ad-hoc action function handling

This makes the code uniform with the rest of the code base, removes
the possibility of mismatched entries from cmdinfos and dofunctions
arrays, and reduces the scope of the action pointer to main().

diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h
index 4f302c1..acadbc5 100644
--- a/dpkg-deb/dpkg-deb.h
+++ b/dpkg-deb/dpkg-deb.h
@@ -28,7 +28,6 @@ dofunction do_info, do_field, do_extract, do_vextract, 
do_fsystarfile;
 
 extern int debugflag, nocheckflag, oldformatflag;
 extern const struct cmdinfo *cipaction;
-extern dofunction *action;
 
 void extracthalf(const char *debar, const char *directory,
  const char *taroption, int admininfo);
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index 319e715..cef1ed9 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -135,7 +135,6 @@ int debugflag=0, nocheckflag=0, 
oldformatflag=BUILDOLDPKGFORMAT;
 struct compressor *compressor = compressor_gzip;
 int compress_level = -1;
 const struct cmdinfo *cipaction = NULL;
-dofunction *action = NULL;
 
 static void setaction(const struct cmdinfo *cip, const char *value);
 static void setcompresstype(const struct cmdinfo *cip, const char *value);
@@ -156,31 +155,20 @@ set_compress_level(const struct cmdinfo *cip, const char 
*value)
   compress_level = level;
 }
 
-static dofunction *const dofunctions[]= {
-  do_build,
-  do_contents,
-  do_control,
-  do_info,
-  do_field,
-  do_extract,
-  do_vextract,
-  do_fsystarfile,
-  do_showinfo
-};
+#define ACTION(longopt, shortopt, code, function) \
+ { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (voidfnp)function }
 
-/* NB: the entries using setaction must appear first and be in the
- * same order as dofunctions:
- */
 static const struct cmdinfo cmdinfos[]= {
-  { build, 'b', 0, NULL,   NULL, setaction},
-  { contents,  'c', 0, NULL,   NULL, setaction},
-  { control,   'e', 0, NULL,   NULL, setaction},
-  { info,  'I', 0, NULL,   NULL, setaction},
-  { field, 'f', 0, NULL,   NULL, setaction},
-  { extract,   'x', 0, NULL,   NULL, setaction},
-  { vextract,  'X', 0, NULL,   NULL, setaction},
-  { fsys-tarfile,  0,   0, NULL,   NULL, setaction},
-  { show,  'W', 0, NULL,   NULL, setaction},
+  ACTION(build, 'b', 0, do_build),
+  ACTION(contents,  'c', 0, do_contents),
+  ACTION(control,   'e', 0, do_control),
+  ACTION(info,  'I', 0, do_info),
+  ACTION(field, 'f', 0, do_field),
+  ACTION(extract,   'x', 0, do_extract),
+  ACTION(vextract,  'X', 0, do_vextract),
+  ACTION(fsys-tarfile,  0,   0, do_fsystarfile),
+  ACTION(show,  'W', 0, do_showinfo),
+
   { new,   0,   0, oldformatflag, NULL, NULL,  0 },
   { old,   0,   0, oldformatflag, NULL, NULL,  1 },
   { debug, 'D', 0, debugflag, NULL, NULL,  1 },
@@ -198,8 +186,6 @@ static void setaction(const struct cmdinfo *cip, const char 
*value) {
 badusage(_(conflicting actions -%c (--%s) and -%c (--%s)),
  cip-oshort, cip-olong, cipaction-oshort, cipaction-olong);
   cipaction= cip;
-  assert((int)(cip - cmdinfos)  (int)(array_count(dofunctions)));
-  action= dofunctions[cip-cmdinfos];
 }
 
 static void setcompresstype(const struct cmdinfo *cip, const char *value) {
@@ -210,6 +196,7 @@ static void setcompresstype(const struct cmdinfo *cip, 
const char *value) {
 
 int main(int argc, const char *const *argv) {
   jmp_buf ejbuf;
+  dofunction *action;
 
   setlocale(LC_NUMERIC, POSIX);
   setlocale(LC_ALL, );
@@ -222,6 +209,7 @@ int main(int argc, const char *const *argv) {
   if (!cipaction) badusage(_(need an action option));
 
   unsetenv(GZIP);
+  action = (dofunction *)cipaction-farg;
   action(argv);
   standard_shutdown();
   exit(0);
diff --git a/dpkg-split/dpkg-split.h b/dpkg-split/dpkg-split.h
index 4fd0bf7..12830c0 100644
--- a/dpkg-split/dpkg-split.h
+++ b/dpkg-split/dpkg-split.h
@@ -49,7 +49,6 @@ struct partqueue {
*/
 };
 
-extern dofunction *action;
 extern const struct cmdinfo *cipaction;
 extern struct partqueue *queue;
 
diff --git a/dpkg-split/main.c b/dpkg-split/main.c
index a143eb0..773f2ca 100644
--- a/dpkg-split/main.c
+++ b/dpkg-split/main.c
@@ -96,7 +96,6 @@ usage(const struct cmdinfo *cip, const char *value)
 const char thisname[]= SPLITTER;
 const char printforhelp[]= N_(Type dpkg-split --help for help.);
 
-dofunction *action=NULL;
 const struct cmdinfo *cipaction=NULL;
 struct partqueue *queue= NULL

[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c9b7af92e5de0cc9ea40fad53c0e5aa5c93690cd
Author: Guillem Jover guil...@debian.org
Date:   Thu Oct 7 09:49:26 2010 +0200

Move action and obsolete related functionality to the myopt module

Reduce repeated code, and localize it where it belongs.

diff --git a/TODO b/TODO
index 038f575..ad1a1bd 100644
--- a/TODO
+++ b/TODO
@@ -44,7 +44,6 @@ TODO
- Get rid of unuseful unsigned modifiers.
- Use internerr instead of assert, and print more meaninful messages.
- Make actionfunction return int, and avoid global exitcode variables.
-   - Move ACTION and OBSOLETE, etc to ‘myopt.h’.
- Replace raw write and read calls with safe variants (signals etc).
- Make deb build version a version instead of doing checks over a string.
- Use enums for currently hardcoded literals (tdus, dependtry, etc).
diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h
index acadbc5..f3a1d1b 100644
--- a/dpkg-deb/dpkg-deb.h
+++ b/dpkg-deb/dpkg-deb.h
@@ -27,7 +27,6 @@ dofunction do_contents, do_control, do_showinfo;
 dofunction do_info, do_field, do_extract, do_vextract, do_fsystarfile;
 
 extern int debugflag, nocheckflag, oldformatflag;
-extern const struct cmdinfo *cipaction;
 
 void extracthalf(const char *debar, const char *directory,
  const char *taroption, int admininfo);
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index cef1ed9..a909e39 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -134,9 +134,7 @@ const char printforhelp[]=
 int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT;
 struct compressor *compressor = compressor_gzip;
 int compress_level = -1;
-const struct cmdinfo *cipaction = NULL;
 
-static void setaction(const struct cmdinfo *cip, const char *value);
 static void setcompresstype(const struct cmdinfo *cip, const char *value);
 
 static void
@@ -155,9 +153,6 @@ set_compress_level(const struct cmdinfo *cip, const char 
*value)
   compress_level = level;
 }
 
-#define ACTION(longopt, shortopt, code, function) \
- { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (voidfnp)function }
-
 static const struct cmdinfo cmdinfos[]= {
   ACTION(build, 'b', 0, do_build),
   ACTION(contents,  'c', 0, do_contents),
@@ -181,13 +176,6 @@ static const struct cmdinfo cmdinfos[]= {
   {  NULL,   0,   0, NULL,   NULL, NULL }
 };
 
-static void setaction(const struct cmdinfo *cip, const char *value) {
-  if (cipaction)
-badusage(_(conflicting actions -%c (--%s) and -%c (--%s)),
- cip-oshort, cip-olong, cipaction-oshort, cipaction-olong);
-  cipaction= cip;
-}
-
 static void setcompresstype(const struct cmdinfo *cip, const char *value) {
   compressor = compressor_find_by_name(value);
   if (compressor == NULL)
diff --git a/dpkg-split/dpkg-split.h b/dpkg-split/dpkg-split.h
index 12830c0..5d102ea 100644
--- a/dpkg-split/dpkg-split.h
+++ b/dpkg-split/dpkg-split.h
@@ -49,7 +49,6 @@ struct partqueue {
*/
 };
 
-extern const struct cmdinfo *cipaction;
 extern struct partqueue *queue;
 
 extern long opt_maxpartsize;
diff --git a/dpkg-split/main.c b/dpkg-split/main.c
index 773f2ca..8f33ab2 100644
--- a/dpkg-split/main.c
+++ b/dpkg-split/main.c
@@ -96,7 +96,6 @@ usage(const struct cmdinfo *cip, const char *value)
 const char thisname[]= SPLITTER;
 const char printforhelp[]= N_(Type dpkg-split --help for help.);
 
-const struct cmdinfo *cipaction=NULL;
 struct partqueue *queue= NULL;
 
 long opt_maxpartsize = SPLITPARTDEFMAX;
@@ -114,8 +113,6 @@ void rerreof(FILE *f, const char *fn) {
   ohshit(_(unexpected end of file in %.250s),fn);
 }
 
-static void setaction(const struct cmdinfo *cip, const char *value);
-
 static void setpartsize(const struct cmdinfo *cip, const char *value) {
   long newpartsize;
   char *endp;
@@ -132,9 +129,6 @@ static void setpartsize(const struct cmdinfo *cip, const 
char *value) {
  (HEADERALLOWANCE  10) + 1);
 }
 
-#define ACTION(longopt, shortopt, code, function) \
-{ longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (voidfnp)function }
-
 static const struct cmdinfo cmdinfos[]= {
   ACTION(split,   's',  0,  do_split),
   ACTION(join,'j',  0,  do_join),
@@ -153,13 +147,6 @@ static const struct cmdinfo cmdinfos[]= {
   {  NULL,  0  }
 };
 
-static void setaction(const struct cmdinfo *cip, const char *value) {
-  if (cipaction)
-badusage(_(conflicting actions -%c (--%s) and -%c (--%s)),
- cip-oshort, cip-olong, cipaction-oshort, cipaction-olong);
-  cipaction= cip;
-}
-
 int main(int argc, const char *const *argv) {
   jmp_buf ejbuf;
   int l;
diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index 6d6ca1b..be9ba22 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -124,6 +124,9 @@ LIBDPKG_PRIVATE {
badusage;
# printforhelp; # XXX variable, do

[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ca92c5d2bf45984c11cf2b5f355b5cad48bf7259
Author: Guillem Jover guil...@debian.org
Date:   Thu Oct 7 09:58:18 2010 +0200

libdpkg: Rename function argument to func in ACTION macro

diff --git a/lib/dpkg/myopt.h b/lib/dpkg/myopt.h
index e36ddaf..b3a6783 100644
--- a/lib/dpkg/myopt.h
+++ b/lib/dpkg/myopt.h
@@ -57,8 +57,8 @@ extern const struct cmdinfo *cipaction;
 void setaction(const struct cmdinfo *cip, const char *value);
 void setobsolete(const struct cmdinfo *cip, const char *value);
 
-#define ACTION(longopt, shortopt, code, function) \
- { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (voidfnp)function }
+#define ACTION(longopt, shortopt, code, func) \
+ { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (voidfnp)func }
 #define OBSOLETE(longopt, shortopt) \
  { longopt, shortopt, 0, NULL, NULL, setobsolete, 0, NULL, NULL }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 9d6a9e43756d2256473935429d9c2f00ad20fb0e
Author: Guillem Jover guil...@debian.org
Date:   Thu Oct 7 10:16:16 2010 +0200

Do not make function typedefs pointers

diff --git a/lib/dpkg/myopt.h b/lib/dpkg/myopt.h
index 6c3fb0f..23fcd5f 100644
--- a/lib/dpkg/myopt.h
+++ b/lib/dpkg/myopt.h
@@ -25,7 +25,7 @@
 
 DPKG_BEGIN_DECLS
 
-typedef void (*void_func)(void);
+typedef void void_func(void);
 
 struct cmdinfo {
   const char *olong;
@@ -36,7 +36,7 @@ struct cmdinfo {
   void (*call)(const struct cmdinfo*, const char *value);
   int arg;
   void *parg;
-  void_func farg;
+  void_func *farg;
 };
 
 extern const char printforhelp[];
@@ -58,7 +58,7 @@ void setaction(const struct cmdinfo *cip, const char *value);
 void setobsolete(const struct cmdinfo *cip, const char *value);
 
 #define ACTION(longopt, shortopt, code, func) \
- { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (void_func)func }
+ { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (void_func *)func }
 #define OBSOLETE(longopt, shortopt) \
  { longopt, shortopt, 0, NULL, NULL, setobsolete, 0, NULL, NULL }
 
diff --git a/lib/dpkg/tarfn.h b/lib/dpkg/tarfn.h
index 2e6a3b4..00c87b3 100644
--- a/lib/dpkg/tarfn.h
+++ b/lib/dpkg/tarfn.h
@@ -62,17 +62,17 @@ struct tar_entry {
struct file_stat stat;
 };
 
-typedef int (*tar_read_func)(void *ctx, char *buffer, int length);
-typedef int (*tar_func)(void *ctx, struct tar_entry *h);
+typedef int tar_read_func(void *ctx, char *buffer, int length);
+typedef int tar_func(void *ctx, struct tar_entry *h);
 
 struct tar_operations {
-   tar_read_func read;
+   tar_read_func *read;
 
-   tar_func extract_file;
-   tar_func link;
-   tar_func symlink;
-   tar_func mkdir;
-   tar_func mknod;
+   tar_func *extract_file;
+   tar_func *link;
+   tar_func *symlink;
+   tar_func *mkdir;
+   tar_func *mknod;
 };
 
 int tar_extractor(void *ctx, const struct tar_operations *ops);
diff --git a/src/main.c b/src/main.c
index 7113b36..79324ef 100644
--- a/src/main.c
+++ b/src/main.c
@@ -453,7 +453,7 @@ static const struct cmdinfo cmdinfos[]= {
* have a very similar structure.
*/
 #define ACTIONBACKEND(longopt, shortopt, backend) \
- { longopt, shortopt, 0, NULL, NULL, setaction, 0, (void *)backend, 
(void_func)execbackend }
+ { longopt, shortopt, 0, NULL, NULL, setaction, 0, (void *)backend, (void_func 
*)execbackend }
 
   ACTION( install,'i', act_install,  
archivefiles),
   ACTION( unpack,  0,  act_unpack,   
archivefiles),

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 90ef059f7155bfc7fb45505c21030e2cc9791ce3
Author: Guillem Jover guil...@debian.org
Date:   Fri Oct 8 11:48:36 2010 +0200

Add a comment for translators to 'dpkg-query -l' header string

Reported-by: Ask Hjorth Larsen asklar...@gmail.com

diff --git a/src/querycmd.c b/src/querycmd.c
index 4968b03..bb7b942 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -109,6 +109,12 @@ list1package(struct pkginfo *pkg, bool *head, struct 
pkg_array *array)
   }
 
   if (!*head) {
+/* TRANSLATORS: This is the header that appears on 'dpkg-query -l'. The
+ * string should remain under 80 characters. The uppercase letters in
+ * the state values denote the abbreviated letter that will appear on
+ * the first three columns, which should ideally match the English one
+ * (e.g. Remove → supRimeix), see dpkg-query(1) for further details. The
+ * translated message can use additional lines if needed. */
 fputs(_(\
 Desired=Unknown/Install/Remove/Purge/Hold\n\
 | 
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend\n\

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ec53fd98f3d10274e2da5722c63fd7f6588b3eaf
Author: Guillem Jover guil...@debian.org
Date:   Tue Nov 2 20:39:08 2010 +0100

libdpkg: Rename print_error_fatal() to print_fatal_error()

diff --git a/dselect/main.cc b/dselect/main.cc
index 0510823..38df1c5 100644
--- a/dselect/main.cc
+++ b/dselect/main.cc
@@ -509,7 +509,7 @@ int main(int, const char *const *argv) {
 cursesoff();
 catch_fatal_error();
   }
-  push_error_handler(ejbuf,print_error_fatal,0);
+  push_error_handler(ejbuf, print_fatal_error, 0);
 
   loadcfgfile(DSELECT, cmdinfos);
   myopt(argv,cmdinfos);
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index 8a8bbff..0a66a13 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -110,7 +110,7 @@ DPKG_BEGIN_DECLS
   if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */\
 catch_fatal_error(); \
   }\
-  push_error_handler(ejbuf, print_error_fatal, NULL); \
+  push_error_handler(ejbuf, print_fatal_error, NULL); \
   umask(022); /* Make sure all our status databases are readable. */\
 } while (0)
 
diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c
index 8d85f79..4543d33 100644
--- a/lib/dpkg/ehandle.c
+++ b/lib/dpkg/ehandle.c
@@ -272,7 +272,9 @@ catch_fatal_error(void)
   exit(2);
 }
 
-void print_error_fatal(const char *emsg, const char *contextstring) {
+void
+print_fatal_error(const char *emsg, const char *contextstring)
+{
   fprintf(stderr, %s: %s\n,thisname,emsg);
 }
 
diff --git a/lib/dpkg/ehandle.h b/lib/dpkg/ehandle.h
index 96ad86d..d86ccaf 100644
--- a/lib/dpkg/ehandle.h
+++ b/lib/dpkg/ehandle.h
@@ -42,7 +42,7 @@ enum {
 
 typedef void error_printer(const char *emsg, const char *contextstring);
 
-void print_error_fatal(const char *emsg, const char *contextstring);
+void print_fatal_error(const char *emsg, const char *contextstring);
 void catch_fatal_error(void);
 
 void push_error_handler(jmp_buf *jbufp, error_printer *printerror,
diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index cf460c4..1e9a25d 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -10,7 +10,7 @@ local:
 LIBDPKG_PRIVATE {
# Error handling
set_error_display;
-   print_error_fatal;
+   print_fatal_error;
catch_fatal_error;
push_error_handler;
push_checkpoint;
diff --git a/lib/dpkg/test.h b/lib/dpkg/test.h
index 9a48332..98695e2 100644
--- a/lib/dpkg/test.h
+++ b/lib/dpkg/test.h
@@ -49,7 +49,7 @@ main(int argc, char **argv)
if (setjmp(ejbuf)) {
catch_fatal_error();
}
-   push_error_handler(ejbuf, print_error_fatal, NULL);
+   push_error_handler(ejbuf, print_fatal_error, NULL);
 
test();
 
diff --git a/src/main.c b/src/main.c
index b04a636..704e1e8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -595,7 +595,7 @@ void commandfd(const char *const *argv) {
 bool mode = false;
 int argc= 1;
 lno= 0;
-push_error_handler(ejbuf, print_error_fatal, NULL);
+push_error_handler(ejbuf, print_fatal_error, NULL);
 
 do { c= getc(in); if (c == '\n') lno++; } while (c != EOF  isspace(c));
 if (c == EOF) break;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e1b2a73e7723126e0cf2109c9e44a793e39ac243
Author: Guillem Jover guil...@debian.org
Date:   Tue Nov 2 20:40:13 2010 +0100

libdpkg: Rename print_error_cleanup() to print_cleanup_error()

diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c
index 4543d33..61ddeb1 100644
--- a/lib/dpkg/ehandle.c
+++ b/lib/dpkg/ehandle.c
@@ -119,7 +119,9 @@ void push_error_handler(jmp_buf *jbufp,
   onerr_abort= 0;
 }
 
-static void print_error_cleanup(const char *emsg, const char *contextstring) {
+static void
+print_cleanup_error(const char *emsg, const char *contextstring)
+{
   fprintf(stderr, _(%s: error while cleaning up:\n %s\n),thisname,emsg);
 }
 
@@ -151,7 +153,7 @@ static void run_cleanups(struct errorcontext *econ, int 
flagsetin) {
   recurserr.jbufp= recurejbuf;
   recurserr.cleanups= NULL;
   recurserr.next= NULL;
-  recurserr.printerror= print_error_cleanup;
+  recurserr.printerror = print_cleanup_error;
   recurserr.contextstring= NULL;
   econtext= recurserr;
   cep-calls[i].call(cep-argc,cep-argv);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7ae5af538e0d7b72f1b181922a1401bc16dc44be
Author: Guillem Jover guil...@debian.org
Date:   Mon Oct 11 19:28:34 2010 +0200

libdpkg: Rename jmp_buf variables to jump

diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c
index 61ddeb1..08adf1c 100644
--- a/lib/dpkg/ehandle.c
+++ b/lib/dpkg/ehandle.c
@@ -62,7 +62,7 @@ struct cleanupentry {
 
 struct errorcontext {
   struct errorcontext *next;
-  jmp_buf *jbufp;
+  jmp_buf *jump;
   struct cleanupentry *cleanups;
   void (*printerror)(const char *emsg, const char *contextstring);
   const char *contextstring;
@@ -92,13 +92,14 @@ run_error_handler(void)
 thisname, errmsg);
 exit(2);
   } else {
-longjmp(*econtext-jbufp, 1);
+longjmp(*econtext-jump, 1);
   }
 }
 
-void push_error_handler(jmp_buf *jbufp,
-error_printer *printerror,
-const char *contextstring) {
+void
+push_error_handler(jmp_buf *jump, error_printer *printerror,
+   const char *contextstring)
+{
   struct errorcontext *necp;
   necp= malloc(sizeof(struct errorcontext));
   if (!necp) {
@@ -111,7 +112,7 @@ void push_error_handler(jmp_buf *jbufp,
 fprintf(stderr, %s: %s\n, thisname, errmsgbuf); exit(2);
   }
   necp-next= econtext;
-  necp-jbufp= jbufp;
+  necp-jump = jump;
   necp-cleanups= NULL;
   necp-printerror= printerror;
   necp-contextstring= contextstring;
@@ -130,7 +131,7 @@ static void run_cleanups(struct errorcontext *econ, int 
flagsetin) {
   struct cleanupentry *volatile cep;
   struct cleanupentry *ncep;
   struct errorcontext recurserr, *oldecontext;
-  jmp_buf recurejbuf;
+  jmp_buf recurse_jump;
   volatile int i, flagset;
 
   if (econ-printerror) econ-printerror(errmsg,econ-contextstring);
@@ -147,10 +148,10 @@ static void run_cleanups(struct errorcontext *econ, int 
flagsetin) {
   while (cep) {
 for (i=0; iNCALLS; i++) {
   if (cep-calls[i].call  cep-calls[i].mask  flagset) {
-if (setjmp(recurejbuf)) {
+if (setjmp(recurse_jump)) {
   run_cleanups(recurserr, ehflag_bombout | ehflag_recursiveerror);
 } else {
-  recurserr.jbufp= recurejbuf;
+  recurserr.jump = recurse_jump;
   recurserr.cleanups= NULL;
   recurserr.next= NULL;
   recurserr.printerror = print_cleanup_error;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 160be818013039931cc06443c523fc57a7779937
Author: Guillem Jover guil...@debian.org
Date:   Sat Oct 16 06:52:02 2010 +0200

libdpkg: Rename struct cleanupentry to cleanup_entry

diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c
index 08adf1c..bcf6731 100644
--- a/lib/dpkg/ehandle.c
+++ b/lib/dpkg/ehandle.c
@@ -49,8 +49,8 @@ volatile int onerr_abort = 0;
 
 #define NCALLS 2
 
-struct cleanupentry {
-  struct cleanupentry *next;
+struct cleanup_entry {
+  struct cleanup_entry *next;
   struct {
 int mask;
 void (*call)(int argc, void **argv);
@@ -63,13 +63,16 @@ struct cleanupentry {
 struct errorcontext {
   struct errorcontext *next;
   jmp_buf *jump;
-  struct cleanupentry *cleanups;
+  struct cleanup_entry *cleanups;
   void (*printerror)(const char *emsg, const char *contextstring);
   const char *contextstring;
 };
 
 static struct errorcontext *volatile econtext= NULL;
-static struct { struct cleanupentry ce; void *args[20]; } emergency;
+static struct {
+  struct cleanup_entry ce;
+  void *args[20];
+} emergency;
 
 void set_error_display(error_printer *printerror,
const char *contextstring) {
@@ -128,8 +131,8 @@ print_cleanup_error(const char *emsg, const char 
*contextstring)
 
 static void run_cleanups(struct errorcontext *econ, int flagsetin) {
   static volatile int preventrecurse= 0;
-  struct cleanupentry *volatile cep;
-  struct cleanupentry *ncep;
+  struct cleanup_entry *volatile cep;
+  struct cleanup_entry *ncep;
   struct errorcontext recurserr, *oldecontext;
   jmp_buf recurse_jump;
   volatile int i, flagset;
@@ -187,10 +190,10 @@ void push_checkpoint(int mask, int value) {
* where original_flagset is the argument to error_unwind
* (as modified by any checkpoint which was pushed later).
*/
-  struct cleanupentry *cep;
+  struct cleanup_entry *cep;
   int i;
   
-  cep = malloc(sizeof(struct cleanupentry) + sizeof(char *));
+  cep = malloc(sizeof(struct cleanup_entry) + sizeof(char *));
   if (cep == NULL) {
 onerr_abort++;
 ohshite(_(out of memory for new cleanup entry));
@@ -206,14 +209,14 @@ void push_checkpoint(int mask, int value) {
 void push_cleanup(void (*call1)(int argc, void **argv), int mask1,
   void (*call2)(int argc, void **argv), int mask2,
   unsigned int nargs, ...) {
-  struct cleanupentry *cep;
+  struct cleanup_entry *cep;
   void **argv;
   int e = 0;
   va_list args;
 
   onerr_abort++;
   
-  cep= malloc(sizeof(struct cleanupentry) + sizeof(char*)*(nargs+1));
+  cep = malloc(sizeof(struct cleanup_entry) + sizeof(char *) * (nargs + 1));
   if (!cep) {
 if (nargs  array_count(emergency.args))
   ohshite(_(out of memory for new cleanup entry with many arguments));
@@ -239,7 +242,7 @@ void push_cleanup(void (*call1)(int argc, void **argv), int 
mask1,
 }
 
 void pop_cleanup(int flagset) {
-  struct cleanupentry *cep;
+  struct cleanup_entry *cep;
   int i;
 
   cep= econtext-cleanups;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.15.8.5-132-gf0266cd

2010-11-18 Thread Guillem Jover
The following commit has been merged in the master branch:
commit b571373cd2e62782c3bb2b8e0bef585c4215b967
Author: Guillem Jover guil...@debian.org
Date:   Sat Oct 16 20:47:20 2010 +0200

libdpkg: Refactor error display setter into a static function

Create a new function that takes an error context argument and sets
the error printer function. This allows using the new setter for
other error_context than econtext.

diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c
index 79b19eb..09b1a77 100644
--- a/lib/dpkg/ehandle.c
+++ b/lib/dpkg/ehandle.c
@@ -74,11 +74,14 @@ static struct {
   void *args[20];
 } emergency;
 
+static void set_error_printer(struct error_context *ec,
+  error_printer *printerror,
+  const char *contextstring);
+
 void set_error_display(error_printer *printerror,
const char *contextstring) {
   assert(econtext);
-  econtext-printerror= printerror;
-  econtext-contextstring= contextstring;
+  set_error_printer(econtext, printerror, contextstring);
 }
 
 static void DPKG_ATTR_NORET
@@ -121,6 +124,14 @@ error_context_new(void)
   return necp;
 }
 
+static void
+set_error_printer(struct error_context *ec, error_printer *printerror,
+  const char *contextstring)
+{
+  ec-printerror = printerror;
+  ec-contextstring = contextstring;
+}
+
 void
 push_error_handler(jmp_buf *jump, error_printer *printerror,
const char *contextstring)
@@ -128,8 +139,7 @@ push_error_handler(jmp_buf *jump, error_printer *printerror,
   struct error_context *ec;
 
   ec = error_context_new();
-  ec-printerror = printerror;
-  ec-contextstring = contextstring;
+  set_error_printer(ec, printerror, contextstring);
   ec-jump = jump;
   onerr_abort = 0;
 }
@@ -170,8 +180,7 @@ run_cleanups(struct error_context *econ, int flagsetin)
   recurserr.jump = recurse_jump;
   recurserr.cleanups= NULL;
   recurserr.next= NULL;
-  recurserr.printerror = print_cleanup_error;
-  recurserr.contextstring= NULL;
+  set_error_printer(recurserr, print_cleanup_error, NULL);
   econtext= recurserr;
   cep-calls[i].call(cep-argc,cep-argv);
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



<    4   5   6   7   8   9   10   11   12   13   >