'sameas:<device>' broken, fix included

Thomas Neumann blacky+fai at fluffbunny.de
Wed Jun 25 11:14:40 CEST 2014


On Tuesday 24 June 2014 16:48:06 Thomas Lange wrote:
> It would be nice it you could separate the whitespace
> diffs from all other patches.

???

I already did that. patch1_indentation is just the re-indentation to match the
file's general style. It looks a bit intimidating, but it's really just the result of
replacing a leading tab with 8 spaces.

> I appreciate your effort, but I really
> like to understand all diffs before applying any patches and mixing
> whitespace diffs and actual patches makes this hard for me.

The actual fix is simply changing line
$FAI::configs{$FAI::device} = Storable::clone($FAI::configs{"PHY_" . $ref_dev});
  into
$FAI::configs{$FAI::device} = Storable::dclone($FAI::configs{"PHY_" . $ref_dev});

(It's line 713 in https://github.com/faiproject/fai/blob/master/lib/setup-storage/Parser.pm)

That already fixes the bug - Storable.pm does not provide 'clone()'.


However there's an underlying problem by treating 'disk#' and
hda/sda/xvda differently. patch3 addresses that issue.

If you like the change to be as non-invasive as possible, then you could go
for something like this

1) modify | /^sameas:(\S+)/

| /^sameas:(\S+)/
{
  my $value = $1;
  $value =~ s/^disk//;
  my $ref_dev = &FAI::resolve_disk_shortname($value);
  [...]
}

2) and delete

| /^sameas:disk(\d+)/
{
  [...]
}

[An alternative for 1) would be to change resolve_disk_shortname() to
recognize 'disk1' as a proper value. Now that I think about that
would be a better long-term-solution. Why does 'the user' / the caller
have to care whether the disk device is 'disk1' or 'sda'?]

bye
thomas



More information about the linux-fai-devel mailing list