Hi Paul,
I found a bug in my PERL code in part 4 of the netboot series that I wrote.
In https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/, the line:
my @ids = (0, sort keys %{$targets});
should have been:
my @ids = (0, sort {$a <=> $b} keys %{$targets});
By default, PERL's sort function sorts lexicographically, so after the 10th target, it returns (0, 1, 10, 2, 3, etc.). The added text forces the sort function to sort numerically (0, 1, 2, 3, etc.).
I understand if you don't want to revise such an old post. In case you chose not to, I've CC'd the mail list so there is a chance that someone who encounters the bug can find the solution.
I went ahead and fixed it.
On Thu, Mar 7, 2019 at 4:03 PM Gregory Lee Bartholomew gregory.lee.bartholomew@gmail.com wrote:
Hi Paul,
I found a bug in my PERL code in part 4 of the netboot series that I wrote.
In https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/, the line:
my @ids = (0, sort keys %{$targets});
should have been:
my @ids = (0, sort {$a <=> $b} keys %{$targets});
By default, PERL's sort function sorts lexicographically, so after the 10th target, it returns (0, 1, 10, 2, 3, etc.). The added text forces the sort function to sort numerically (0, 1, 2, 3, etc.).
I understand if you don't want to revise such an old post. In case you chose not to, I've CC'd the mail list so there is a chance that someone who encounters the bug can find the solution.
-- Gregory Lee Bartholomew PGP Key ID: 3B67510E
Thanks Paul!
On Fri, 2019-03-08 at 13:16 -0500, Paul Frields wrote:
I went ahead and fixed it.
On Thu, Mar 7, 2019 at 4:03 PM Gregory Lee Bartholomew gregory.lee.bartholomew@gmail.com wrote:
Hi Paul,
I found a bug in my PERL code in part 4 of the netboot series that I wrote.
In https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/, the line:
my @ids = (0, sort keys %{$targets});
should have been:
my @ids = (0, sort {$a <=> $b} keys %{$targets});
By default, PERL's sort function sorts lexicographically, so after the 10th target, it returns (0, 1, 10, 2, 3, etc.). The added text forces the sort function to sort numerically (0, 1, 2, 3, etc.).
I understand if you don't want to revise such an old post. In case you chose not to, I've CC'd the mail list so there is a chance that someone who encounters the bug can find the solution.
-- Gregory Lee Bartholomew PGP Key ID: 3B67510E
magazine@lists.fedoraproject.org