Bug#568317: perl: Executes every second $_ test only

paul.szabo at sydney.edu.au paul.szabo at sydney.edu.au
Thu Feb 4 05:49:23 UTC 2010


This is not a bug in perl, works as documented in 'man perlretut'.

The issue is with the /g modifier, as shown with script:


#! /usr/bin/perl

$x = 'do_bootloader = yes';

print "Testing '$x' with m/boot/g, every second one is bad:\n";
foreach (1..6) {
  print "test $_ ";
  $z = "BAD";
  $z = "OK " if $x =~ m/boot/ig;
  print "$z\n";
}

print "Testing '$x' with m/boot/ (without /g) is all good:\n";
foreach (1..6) {
  print "test $_ ";
  $z = "BAD";
  $z = "OK " if $x =~ m/boot/i;
  print "$z\n";
}


This is bad usage in the linux-source-2.6.26 package.
My /var/lib/dpkg/info/linux-image-2.6.26-*.postinst file has header:

#! /usr/bin/perl
#                              -*- Mode: Cperl -*-
# debian.postinst ---
# Author           : Manoj Srivastava ( srivasta at pilgrim.umass.edu )
# Created On       : Sat Apr 27 05:55:26 1996
# Created On Node  : melkor.pilgrim.umass.edu
# Last Modified By : Manoj Srivastava
# Last Modified On : Wed Oct  8 00:03:41 2008
# Last Machine Used: anzu.internal.golden-gryphon.com
# Update Count     : 360
# Status           : Unknown, Use with caution!
# HISTORY          :
# Description      :
#
#    $Id: image.postinst,v 1.125 2003/10/07 16:24:20 srivasta Exp $
# ...


Should I report this bug (spurious, un-needed /g) to the
linux-source-2.6.26 package, or will you be able to re-assign, or
otherwise let Mr Srivastava know?

Thanks, Paul

Paul Szabo   psz at maths.usyd.edu.au   http://www.maths.usyd.edu.au/u/psz/
School of Mathematics and Statistics   University of Sydney    Australia






More information about the Perl-maintainers mailing list