From 9c4c9d17e4c48db760d0f75e01f0a85c9c443e11 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 Signed-off-by: Martin Renvoize (cherry picked from commit 851d41ab6b9ec28901086d6a6ce15b3fd589182a) Signed-off-by: Fridolin Somers (cherry picked from commit c868ccc360189d0b5ea5b7c096ba325a304070d0) Signed-off-by: Lucas Gass --- tools/inventory.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/inventory.pl b/tools/inventory.pl index eff4fe2ffc..4e6685636c 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -326,7 +326,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.39.5