From 2f5816d8be40b449d2473b22f9e0c33b32f3bd78 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 10 Dec 2017 12:07:42 +0100 Subject: scripts: Reject negated values in Architecture field Add new positive options argument to arch validators, as the Architecture field should not accept negated architectures. We preserve the current functions default behavior and add a new option to control whether to reject negated architectures. Fixes: commit d355b340f3a6cde7fc1cb5649d82fbebd3b97ea1 Stable-Candidate: 1.18.x --- scripts/t/Dpkg_Arch.t | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts/t') diff --git a/scripts/t/Dpkg_Arch.t b/scripts/t/Dpkg_Arch.t index 525817085..0ef9d1899 100644 --- a/scripts/t/Dpkg_Arch.t +++ b/scripts/t/Dpkg_Arch.t @@ -16,7 +16,7 @@ use strict; use warnings; -use Test::More tests => 16367; +use Test::More tests => 16369; use_ok('Dpkg::Arch', qw(debarch_to_debtuple debarch_to_multiarch debarch_eq debarch_is debarch_is_wildcard @@ -148,9 +148,16 @@ my @arch_ref; @arch_new = debarch_list_parse('amd64 !arm64 linux-i386 !kfreebsd-any'); is_deeply(\@arch_new, \@arch_ref, 'parse valid arch list'); +@arch_ref = qw(amd64 arm64 linux-i386 kfreebsd-any); +@arch_new = debarch_list_parse('amd64 arm64 linux-i386 kfreebsd-any', positive => 1); +is_deeply(\@arch_new, \@arch_ref, 'parse valid positive arch list'); + eval { @arch_new = debarch_list_parse('!amd64!arm64') }; ok($@, 'parse concatenated arches failed'); +eval { @arch_new = debarch_list_parse('amd64 !arm64 !mips', positive => 1) }; +ok($@, 'parse disallowed negated arches failed'); + is(debarch_to_abiattrs(undef), undef, 'undef ABI attrs'); is_deeply([ debarch_to_abiattrs('amd64') ], [ qw(64 little) ], 'amd64 ABI attrs'); -- cgit v1.2.3