[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 5c32f0c0e4c537fc00bf3ccace8799fe27a522aa
Author: Guillem Jover guil...@debian.org
Date:   Sun May 22 16:07:49 2011 +0200

libdpkg: Properly pop the cleanup handler in trk_explicit_interest_change

In case of error all cleanup handlers will get called but the nf FILE
variable might have been already closed, which would cause the
subsequent fclose() to fail, this will not be fatal as the return
value for fclose() in the cleanup handler is not checked, but it's
still not correct.

Refactor trk_explicit_interest_change() into
trk_explicit_interest_remove(), trk_explicit_interest_flush() and
trk_explicit_interest_commit() to reflow the function and make it
clearer by sharing the main code path.

Regression introduced in commit 83b591340ec92cf0e9814e8403da7711cbbc6b46.

diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index ae0f5b9..2a1cc36 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -404,6 +404,37 @@ trk_explicit_activate_awaiter(struct pkginfo *aw)
 }
 
 static void
+trk_explicit_interest_flush(const char *newfilename, FILE *nf)
+{
+   if (ferror(nf))
+   ohshite(_(unable to write new trigger interest file `%.250s'),
+   newfilename);
+   if (fflush(nf))
+   ohshite(_(unable to flush new trigger interest file '%.250s'),
+   newfilename);
+   if (fsync(fileno(nf)))
+   ohshite(_(unable to sync new trigger interest file '%.250s'),
+   newfilename);
+}
+
+static void
+trk_explicit_interest_commit(const char *newfilename)
+{
+   if (rename(newfilename, trk_explicit_fn.buf))
+   ohshite(_(unable to install new trigger interest file 
`%.250s'),
+   trk_explicit_fn.buf);
+}
+
+static void
+trk_explicit_interest_remove(const char *newfilename)
+{
+   if (unlink(newfilename))
+   ohshite(_(cannot remove `%.250s'), newfilename);
+   if (unlink(trk_explicit_fn.buf))
+   ohshite(_(cannot remove `%.250s'), trk_explicit_fn.buf);
+}
+
+static void
 trk_explicit_interest_change(const char *trig,  struct pkginfo *pkg, int 
signum)
 {
static struct varbuf newfn;
@@ -432,34 +463,18 @@ trk_explicit_interest_change(const char *trig,  struct 
pkginfo *pkg, int signum)
empty = false;
}
 
-   if (empty) {
-   /* The triggers interest file is no longer needed, drop it */
-   fclose(nf); /* We don't care if it fails */
-   if (unlink(newfn.buf))
-   ohshite(_(cannot remove `%.250s'), newfn.buf);
-   if (unlink(trk_explicit_fn.buf))
-   ohshite(_(cannot remove `%.250s'), 
trk_explicit_fn.buf);
-   dir_sync_path(triggersdir);
-   return;
-   }
+   if (!empty)
+   trk_explicit_interest_flush(newfn.buf, nf);
 
-   if (ferror(nf))
-   ohshite(_(unable to write new trigger interest file `%.250s'),
-   newfn.buf);
-   if (fflush(nf))
-   ohshite(_(unable to flush new trigger interest file '%.250s'),
-   newfn.buf);
-   if (fsync(fileno(nf)))
-   ohshite(_(unable to sync new trigger interest file '%.250s'),
-   newfn.buf);
pop_cleanup(ehflag_normaltidy);
if (fclose(nf))
ohshite(_(unable to close new trigger interest file `%.250s'),
newfn.buf);
 
-   if (rename(newfn.buf, trk_explicit_fn.buf))
-   ohshite(_(unable to install new trigger interest file 
`%.250s'),
-   trk_explicit_fn.buf);
+   if (empty)
+   trk_explicit_interest_remove(newfn.buf);
+   else
+   trk_explicit_interest_commit(newfn.buf);
 
dir_sync_path(triggersdir);
 }

-- 
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.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 104882f7fef02d53e1b868e746b8e9ff313eb1f5
Author: Guillem Jover guil...@debian.org
Date:   Tue May 24 06:55:34 2011 +0200

libdpkg: Do not fail on current file removal in trk_explicit_interest_change

In case the new trigger interest file is empty and as such not needed
any longer, do not fail if the current file is not present.

Regression introduced in commit 83b591340ec92cf0e9814e8403da7711cbbc6b46.

diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 2a1cc36..81619fc 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -430,7 +430,7 @@ trk_explicit_interest_remove(const char *newfilename)
 {
if (unlink(newfilename))
ohshite(_(cannot remove `%.250s'), newfilename);
-   if (unlink(trk_explicit_fn.buf))
+   if (unlink(trk_explicit_fn.buf)  errno != ENOENT)
ohshite(_(cannot remove `%.250s'), trk_explicit_fn.buf);
 }
 

-- 
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.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit b8038ef4721d53bb037583b9355a1f00dbcdc740
Author: Guillem Jover guil...@debian.org
Date:   Sun May 22 16:11:40 2011 +0200

libdpkg: Properly reset filetriggers_edited in trig_file_interests_save

The function was not resetting filetriggers_edited when no triggers were
left, and duplicated part of the existing functionality.

Refactor into trig_file_interests_remove() and
trig_file_interests_update() to make them use the same main code path.

Regression introduced in commit 83b591340ec92cf0e9814e8403da7711cbbc6b46.

diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 81619fc..50b6012 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -550,23 +550,19 @@ edited:
filetriggers_edited = 1;
 }
 
-void
-trig_file_interests_save(void)
+static void
+trig_file_interests_remove(void)
+{
+   if (unlink(triggersfilefile)  errno != ENOENT)
+   ohshite(_(cannot remove `%.250s'), triggersfilefile);
+}
+
+static void
+trig_file_interests_update(void)
 {
struct trigfileint *tfi;
FILE *nf;
 
-   if (filetriggers_edited = 0)
-   return;
-
-   if (!filetriggers.head) {
-   /* No file trigger left, drop the file */
-   if (unlink(triggersfilefile)  errno != ENOENT)
-   ohshite(_(cannot remove `%.250s'), triggersfilefile);
-   dir_sync_path(triggersdir);
-   return;
-   }
-
nf = fopen(triggersnewfilefile, w);
if (!nf)
ohshite(_(unable to create new file triggers file `%.250s'),
@@ -594,6 +590,18 @@ trig_file_interests_save(void)
if (rename(triggersnewfilefile, triggersfilefile))
ohshite(_(unable to install new file triggers file as 
`%.250s'),
triggersfilefile);
+}
+
+void
+trig_file_interests_save(void)
+{
+   if (filetriggers_edited = 0)
+   return;
+
+   if (!filetriggers.head)
+   trig_file_interests_remove();
+   else
+   trig_file_interests_update();
 
dir_sync_path(triggersdir);
 

-- 
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.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 588077fdbc350d0733ce5cb8a298d317cfda1926
Author: Guillem Jover guil...@debian.org
Date:   Sat May 21 06:59:44 2011 +0200

Dpkg::Source::Package: Add ‘.hgsigs’ to the default ignore lists

Closes: #627462

Based-on-patch-by: Jakub Wilk jw...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 00a4d69..df49cca 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -68,6 +68,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Do not lose track of parent directories on removal so that they can
 be properly cleaned up on purge if not used by any other package.
 Based on a patch by Ondřej Surý ond...@debian.org. Closes: #454694
+  * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
+Based on a patch by Jakub Wilk jw...@debian.org. Closes: #627462
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 30b47ed..7eeadfe 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -50,7 +50,7 @@ our $diff_ignore_default_regexp = '
 (?:^|/)(?:DEADJOE|\.arch-inventory|\.(?:bzr|cvs|hg|git)ignore)$|
 # File or directory names that should be ignored
 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|
-\.hg(?:tags)?|_darcs|\.git(?:attributes|modules)?|
+\.hg(?:tags|sigs)?|_darcs|\.git(?:attributes|modules)?|
 \.shelf|_MTN|\.be|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
 ';
 # Take out comments and newlines
@@ -81,6 +81,7 @@ our @tar_ignore_default_pattern = qw(
 .gitmodules
 .hg
 .hgignore
+.hgsigs
 .hgtags
 .shelf
 .svn

-- 
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.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e4cb12a710457b103a7544c4de5e9fc1b2bd24d8
Author: Guillem Jover guil...@debian.org
Date:   Sat May 21 10:38:32 2011 +0200

libdpkg: Do not allow blank lines in field values

Blank lines in this case mean, lines containing only spaces and tabs.
This ensure the Perl and C parsers match, and it follows RFC-2822 style
format, and Debian policy.

Closes: #308082

diff --git a/debian/changelog b/debian/changelog
index df49cca..60d859e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -70,6 +70,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 Based on a patch by Ondřej Surý ond...@debian.org. Closes: #454694
   * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
 Based on a patch by Jakub Wilk jw...@debian.org. Closes: #627462
+  * Do not allow blank lines in field values. Closes: #308082
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index a611515..f71c438 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -380,6 +380,8 @@ int parsedb(const char *filename, enum parsedbflags flags,
 
 /* Loop per field. */
 for (;;) {
+  bool blank_line;
+
   fs.fieldstart = dataptr - 1;
   while (!EOF_mmap(dataptr, endptr)  !isspace(c)  c!=':'  
c!=MSDOS_EOF_CHAR)
 c= getc_mmap(dataptr);
@@ -412,9 +414,16 @@ int parsedb(const char *filename, enum parsedbflags flags,
 parse_error(ps, new_pkg,
 _(MSDOS EOF char in value of field `%.*s' (missing 
newline?)),
 fs.fieldlen, fs.fieldstart);
+
+  blank_line = false;
+
   fs.valuestart = dataptr - 1;
   for (;;) {
 if (c == '\n' || c == MSDOS_EOF_CHAR) {
+  if (blank_line)
+parse_error(ps, new_pkg,
+_(blank line in value of field '%.*s'),
+fs.fieldlen, fs.fieldstart);
   ps.lno++;
  if (EOF_mmap(dataptr, endptr)) break;
   c= getc_mmap(dataptr);
@@ -422,11 +431,16 @@ int parsedb(const char *filename, enum parsedbflags flags,
   if (EOF_mmap(dataptr, endptr) || c == '\n' || !isspace(c)) break;
   ungetc_mmap(c,dataptr, data);
   c= '\n';
-} else if (EOF_mmap(dataptr, endptr)) {
+  blank_line = true;
+} else if (blank_line  !isspace(c)) {
+  blank_line = false;
+}
+
+if (EOF_mmap(dataptr, endptr))
   parse_error(ps, new_pkg,
   _(EOF during value of field `%.*s' (missing final 
newline)),
   fs.fieldlen, fs.fieldstart);
-}
+
 c= getc_mmap(dataptr);
   }
   fs.valuelen = dataptr - fs.valuestart - 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.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2ed0a42cb3863e2ce0199e13242fa3b769ca773d
Author: Guillem Jover guil...@debian.org
Date:   Tue May 24 06:19:28 2011 +0200

libdpkg: Do not warn on missing Architecture in config-files state

dpkg before commit 2ef42b027e4267432a41343e28f102b1dae668d2 (versions
older than 1.10.19) did not keep the Architecture field in the status
file, and as such removed (but not purged) packages might still be
around in live systems lacking the Architecture field. Let's shut up
the warning for now.

Closes: #604241

Analysis-by: Raphael Hertzog hert...@debian.org
Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 60d859e..365ea39 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -71,6 +71,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
 Based on a patch by Jakub Wilk jw...@debian.org. Closes: #627462
   * Do not allow blank lines in field values. Closes: #308082
+  * Do not warn on missing architecture on packages in config-files state,
+but then make sure the architecture field is usable. Closes: #604241
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index f71c438..58b3110 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -177,11 +177,19 @@ pkg_parse_verify(struct parsedb_state *ps,
 parse_ensure_have_field(ps, pkg, pkgbin-description, description);
 parse_ensure_have_field(ps, pkg, pkgbin-maintainer, maintainer);
 parse_must_have_field(ps, pkg, pkgbin-version.version, version);
+  }
 
+  /* XXX: Versions before dpkg 1.10.19 did not preserve the Architecture
+   * field in the status file. So there's still live systems with packages
+   * in stat_configfiles, ignore those too for now. */
+  if ((ps-flags  pdb_recordavailable) ||
+  pkg-status  stat_halfinstalled) {
 /* We always want usable architecture information (as long as the package
  * is in such a state that it make sense), so that it can be used safely
  * on string comparisons and the like. */
 parse_ensure_have_field(ps, pkg, pkgbin-arch, architecture);
+  } else if (pkgbin-arch == NULL) {
+pkgbin-arch = ;
   }
 
   /* Check the Config-Version information:

-- 
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