For some of the lower level tools we are developing for ΔV (and for JackRabbit), we need to parse device strings. That look like this “/dev/sda1”. We have been doing this for years with the Perl Getopt::Long module.
Well, something interesting happened today. I need to dig into it, but it looks like a (bad) change to some of the standard Perl libraries installed on this machine (Ubuntu based with our kernel).
Handing this code the option as indicated resulted in some … well … interesting interpolation. Interpolation is sort of a parsing pass for strings where Perl can dis-ambiguate the meaning of a literal string.
Put another way, if I use
$x = "$cmd $args";
interpolation would replace the $cmd and $args with their values. It would also look at things like /dev/sda1 as a regular expression, delimited by the ‘/’, using the sda1 as options.
This is not how it used to behave. I know, we have lots of code which uses the old (correct) behavior.
Annoying, but I took this as a moment to try Getopt::Lucid. Good aspects are that it works correctly. Bad aspects are that it auto-instantiates accessors (get/set functions). I used to think I liked this, but it is, frankly, a pain in the rear to write code like this.
But at least it works now.
root@dV3:/opt/scalable/sbin# ./is_raid_device.pl --dev /dev/sda2
root@dV3:/opt/scalable/sbin# ./is_raid_device.pl --dev /dev/sda1
Viewed 9374 times by 1750 viewers