[dpkg] 165/200: libdpkg: Turn status file parser errors on field blank lines into warnings
Ximin Luo
infinity0 at debian.org
Wed Apr 5 15:17:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository dpkg.
commit eeeae2acc87ab380b732491d22af7ec3f4b6b772
Author: Guillem Jover <guillem at debian.org>
Date: Mon Jan 30 01:04:31 2017 +0100
libdpkg: Turn status file parser errors on field blank lines into warnings
Regression introduced in commit e4cb12a710457b103a7544c4de5e9fc1b2bd24d8.
This has caused issues at least on Cydia installations. And it should
have been introduced as a lax parsing error, only failing for new
packages, and warn on already installed ones. Otherwise one cannot
easily recover after upgrading to a new dpkg on an affected system.
Reported-by: Jay Freeman <saurik at saurik.com>
Stable-Candidate: 1.17.x
---
debian/changelog | 5 +++++
lib/dpkg/dpkg-db.h | 4 +++-
lib/dpkg/parse.c | 12 ++++++++----
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 3237c46..8b6e166 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,10 @@
dpkg (1.18.22) UNRELEASED; urgency=medium
+ [ Guillem Jover ]
+ * Turn status file parser errors on bogus field blank lines into warnings,
+ otherwise the system cannot be easily recovered from. Regression
+ introduced in dpkg 1.16.1. Reported by Jay Freeman <saurik at saurik.com>.
+
[ Updated programs translations ]
* Turkish (Mert Dirik). Closes: #853202
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index 0e678c5..bffd317 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -310,8 +310,10 @@ enum parsedbflags {
pdb_ignoreolder = DPKG_BIT(5),
/** Perform laxer version parsing. */
pdb_lax_version_parser = DPKG_BIT(6),
+ /** Perform laxer control stanza parsing. */
+ pdb_lax_stanza_parser = DPKG_BIT(9),
/** Perform laxer parsing, used to transition to stricter parsing. */
- pdb_lax_parser = pdb_lax_version_parser,
+ pdb_lax_parser = pdb_lax_stanza_parser | pdb_lax_version_parser,
/** Close file descriptor on context destruction. */
pdb_close_fd = DPKG_BIT(7),
/** Interpret filename ‘-’ as stdin. */
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 2d7f0a3..1b3bf13 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -673,10 +673,14 @@ parse_stanza(struct parsedb_state *ps, struct field_state *fs,
fs->valuestart = ps->dataptr - 1;
for (;;) {
if (c == '\n' || c == MSDOS_EOF_CHAR) {
- if (blank_line)
- parse_error(ps,
- _("blank line in value of field '%.*s'"),
- fs->fieldlen, fs->fieldstart);
+ if (blank_line) {
+ if (ps->flags & pdb_lax_stanza_parser)
+ parse_warn(ps, _("blank line in value of field '%.*s'"),
+ fs->fieldlen, fs->fieldstart);
+ else
+ parse_error(ps, _("blank line in value of field '%.*s'"),
+ fs->fieldlen, fs->fieldstart);
+ }
ps->lno++;
if (parse_at_eof(ps))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list