From 8f0f9964a5f9e61882bac70535b13ec96f0ea503 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 29 May 2019 13:46:15 +0000 Subject: [PATCH] Bug 23006: Cannot use inventory with barcodes containing special chars If a barcode contains special characters like $, the regex in inventory does no longer work. This fix (as suggested by Jonathan) replaces the regex by a eq compare. Test plan: Pick one barcode and add a $ somewhere in the middle, say 123$456. Include this barcode in a barcode file for inventory. Run inventory on that file and verify that barcode was read and datelastseen was updated. The barcode should not be reported as missing (not scanned). Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- tools/inventory.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/inventory.pl b/tools/inventory.pl index 96a6bdf5ca..934f121f90 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -328,7 +328,7 @@ if ( $compareinv2barcd ) { my $barcode = $item->{barcode}; if( !$barcode ) { $item->{problems}->{no_barcode} = 1; - } elsif ( grep /^$barcode$/, @scanned_barcodes ) { + } elsif ( grep { $_ eq $barcode } @scanned_barcodes ) { next; } else { $item->{problems}->{not_scanned} = 1; -- 2.11.0