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=178fd73e46989a40a6ca745227de968dfac3662b

commit 178fd73e46989a40a6ca745227de968dfac3662b
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Dec 16 01:01:13 2025 +0100

    Dpkg::Control::FieldsCore: Do not autovivify %FIELDS entries on getters
    
    We should not access the hash members when they do not exist, otherwise
    we autovivify them and that causes problems with other code expecting
    unregistered fields to not exist in that hash.
---
 scripts/Dpkg/Control/FieldsCore.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/Dpkg/Control/FieldsCore.pm 
b/scripts/Dpkg/Control/FieldsCore.pm
index c7d592e3e..6fee167db 100644
--- a/scripts/Dpkg/Control/FieldsCore.pm
+++ b/scripts/Dpkg/Control/FieldsCore.pm
@@ -1291,8 +1291,8 @@ Breaks, ...). Returns undef for fields which are not 
dependencies.
 sub field_get_dep_type {
     my $field = lc shift;
 
-    return unless exists $FIELDS{$field};
-    return $FIELDS{$field}{dependency} if exists $FIELDS{$field}{dependency};
+    return $FIELDS{$field}{dependency}
+        if exists $FIELDS{$field} && exists $FIELDS{$field}{dependency};
     return;
 }
 
@@ -1306,7 +1306,8 @@ FIELD_SEP_SPACE, FIELD_SEP_COMMA or FIELD_SEP_LINE.
 sub field_get_sep_type {
     my $field = lc shift;
 
-    return $FIELDS{$field}{separator} if exists $FIELDS{$field}{separator};
+    return $FIELDS{$field}{separator}
+        if exists $FIELDS{$field} && exists $FIELDS{$field}{separator};
     return FIELD_SEP_UNKNOWN;
 }
 
@@ -1320,7 +1321,8 @@ then it returns "undef".
 sub field_get_default_value {
     my $field = lc shift;
 
-    return $FIELDS{$field}{default} if exists $FIELDS{$field}{default};
+    return $FIELDS{$field}{default}
+        if exists $FIELDS{$field} && exists $FIELDS{$field}{default};
     return;
 }
 

-- 
Dpkg.Org's dpkg

Reply via email to