iterate over directories in sorted order

This makes behaviour more deterministic, and makes debugging easier.
This commit is contained in:
Adam Spiers 2024-04-06 13:33:53 +01:00
parent e9ad20576c
commit 2a647d125f

View file

@ -432,7 +432,7 @@ sub stow_contents {
closedir $DIR; closedir $DIR;
NODE: NODE:
for my $node (@listing) { for my $node (sort @listing) {
next NODE if $node eq '.'; next NODE if $node eq '.';
next NODE if $node eq '..'; next NODE if $node eq '..';
my $node_target = join_paths($target_subdir, $node); my $node_target = join_paths($target_subdir, $node);
@ -743,7 +743,7 @@ sub unstow_contents {
closedir $DIR; closedir $DIR;
NODE: NODE:
for my $node (@listing) { for my $node (sort @listing) {
next NODE if $node eq '.'; next NODE if $node eq '.';
next NODE if $node eq '..'; next NODE if $node eq '..';
my $node_target = join_paths($target_subdir, $node); my $node_target = join_paths($target_subdir, $node);
@ -1148,7 +1148,7 @@ sub cleanup_invalid_links {
closedir $DIR; closedir $DIR;
NODE: NODE:
for my $node (@listing) { for my $node (sort @listing) {
next NODE if $node eq '.'; next NODE if $node eq '.';
next NODE if $node eq '..'; next NODE if $node eq '..';
@ -1247,7 +1247,7 @@ sub foldable {
my $parent_in_pkg = ''; my $parent_in_pkg = '';
NODE: NODE:
for my $node (@listing) { for my $node (sort @listing) {
next NODE if $node eq '.'; next NODE if $node eq '.';
next NODE if $node eq '..'; next NODE if $node eq '..';
@ -1331,7 +1331,7 @@ sub fold_tree {
closedir $DIR; closedir $DIR;
NODE: NODE:
for my $node (@listing) { for my $node (sort @listing) {
next NODE if $node eq '.'; next NODE if $node eq '.';
next NODE if $node eq '..'; next NODE if $node eq '..';
next NODE if not $self->is_a_node(join_paths($target_subdir, $node)); next NODE if not $self->is_a_node(join_paths($target_subdir, $node));