This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=f79182cef7728ffc03fb6cf5d0eb55e1505e4106 commit f79182cef7728ffc03fb6cf5d0eb55e1505e4106 Author: Guillem Jover <[email protected]> AuthorDate: Mon Mar 28 20:10:13 2022 +0200 libdpkg: Warn when parsing obsolete Recommended/Optional/Class fields These were automatically remapped to their modern forms, but were not emitting any obsolescence warning. Add parse function wrappers that emit such warnings and then forward the calls to their modern field counter-parts. Prompted-by: David Kalnischkies <[email protected]> --- lib/dpkg/fields.c | 18 ++++++++++++++++++ lib/dpkg/parse.c | 6 +++--- lib/dpkg/parsedump.h | 2 ++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c index 6bb991876..120ee88f1 100644 --- a/lib/dpkg/fields.c +++ b/lib/dpkg/fields.c @@ -244,6 +244,15 @@ f_priority(struct pkginfo *pkg, struct pkgbin *pkgbin, } } +void +f_obs_class(struct pkginfo *pkg, struct pkgbin *pkgbin, + struct parsedb_state *ps, + const char *value, const struct fieldinfo *fip) +{ + parse_warn(ps, _("obsolete '%s' field used"), fip->name); + f_priority(pkg, pkgbin, ps, value, fip); +} + void f_status(struct pkginfo *pkg, struct pkgbin *pkgbin, struct parsedb_state *ps, @@ -626,6 +635,15 @@ f_dependency(struct pkginfo *pkg, struct pkgbin *pkgbin, } } +void +f_obs_dependency(struct pkginfo *pkg, struct pkgbin *pkgbin, + struct parsedb_state *ps, + const char *value, const struct fieldinfo *fip) +{ + parse_warn(ps, _("obsolete '%s' field used"), fip->name); + f_dependency(pkg, pkgbin, ps, value, fip); +} + static const char * scan_word(const char **valp) { diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c index a671a6721..873ef0699 100644 --- a/lib/dpkg/parse.c +++ b/lib/dpkg/parse.c @@ -85,9 +85,9 @@ const struct fieldinfo fieldinfos[]= { { FIELD("Triggers-Pending"), f_trigpend, w_trigpend }, { FIELD("Triggers-Awaited"), f_trigaw, w_trigaw }, /* Note that aliases are added to the nicknames table. */ - { FIELD("Recommended"), f_dependency, w_null }, - { FIELD("Optional"), f_dependency, w_null }, - { FIELD("Class"), f_priority, w_null }, + { FIELD("Recommended"), f_obs_dependency, w_null }, + { FIELD("Optional"), f_obs_dependency, w_null }, + { FIELD("Class"), f_obs_class, w_null }, { FIELD("Revision"), f_obs_revision, w_null }, { FIELD("Package-Revision"), f_obs_revision, w_null }, { FIELD("Package_Revision"), f_obs_revision, w_null }, diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h index 6fd27b41d..31b0bdcf2 100644 --- a/lib/dpkg/parsedump.h +++ b/lib/dpkg/parsedump.h @@ -103,6 +103,7 @@ typedef void freadfunction(struct pkginfo *pkg, struct pkgbin *pkgbin, freadfunction f_name; freadfunction f_charfield; freadfunction f_priority; +freadfunction f_obs_class; freadfunction f_section; freadfunction f_status; freadfunction f_boolean; @@ -110,6 +111,7 @@ freadfunction f_dependency; freadfunction f_conffiles; freadfunction f_version; freadfunction f_obs_revision; +freadfunction f_obs_dependency; freadfunction f_configversion; freadfunction f_multiarch; freadfunction f_architecture; -- Dpkg.Org's dpkg

