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

commit deb718ab71d45f1162a4d1807d641edf54e244c4
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Sep 21 11:36:56 2022 +0200

    Dpkg::Vendor: Fix module loading for vendors with special characters
    
    The current code was not handling vendor names with special characters
    (any of [^A-Za-z0-9], nor it was capitalizing the module name to follow
    the current module naming convention. We add the character remapping.
    
    Reported-by: Niels Thykier <[email protected]> (on IRC)
---
 scripts/Dpkg/Vendor.pm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/Dpkg/Vendor.pm b/scripts/Dpkg/Vendor.pm
index e23996859..2dbe1e760 100644
--- a/scripts/Dpkg/Vendor.pm
+++ b/scripts/Dpkg/Vendor.pm
@@ -1,4 +1,5 @@
 # Copyright © 2008-2009 Raphaël Hertzog <[email protected]>
+# Copyright © 2008-2009, 2012-2017, 2022 Guillem Jover <[email protected]>
 #
 # 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
@@ -165,7 +166,13 @@ If $name is omitted, return the object of the current 
vendor.
 If no vendor can be identified, then return the Dpkg::Vendor::Default
 object.
 
-The module name will be derived from the vendor name, by capitalizing,
+The module name will be derived from the vendor name, by splitting parts
+around groups of non alphanumeric character (that is B<[^A-Za-z0-9]>)
+separators, by either capitalizing or lower-casing and capitalizing each part
+and then joining them without the separators. So the expected casing is based
+on the one from the B<Vendor> field in the F<origins> file.
+
+In addition, the module name will also be tried by capitalizing,
 lower-casing then capitalizing, as-is or lower-casing.
 
 =cut
@@ -177,6 +184,11 @@ sub get_vendor_object {
     return $OBJECT_CACHE{$vendor_key} if exists $OBJECT_CACHE{$vendor_key};
 
     my ($obj, @names);
+
+    my @vendor_parts = split m{$vendor_sep_regex}, $vendor;
+    push @names, join q{}, map { ucfirst } @vendor_parts;
+    push @names, join q{}, map { ucfirst lc } @vendor_parts;
+
     push @names, ucfirst $vendor, ucfirst lc $vendor, $vendor, lc $vendor;
 
     foreach my $name (uniq @names) {

-- 
Dpkg.Org's dpkg

Reply via email to