]> Kevux Git Server - fll/commitdiff
Bugfix: Directory recursion has incorrect status check resulting in early loop breakage. development
authorKevin Day <Kevin@kevux.org>
Thu, 3 Apr 2025 04:59:28 +0000 (23:59 -0500)
committerKevin Day <Kevin@kevux.org>
Thu, 3 Apr 2025 05:00:41 +0000 (00:00 -0500)
The loop is breaking out early due to the incorrect boolean logic when checking if an interrupt signal has been received via the state status.

This bug was exposed by the (incomplete) kevux-tools program `remove`:
```shell
clear ; md a/b/c ; touch a/b/file ; remove a/b/ -r +V ; t a
```

level_1/fl_directory/c/private-directory.c

index f7fd412d74b438b14b8c4edaec76dfb3ddbe1551..115a3930004d88c088b1ebbacc43d562ffa61f68 100644 (file)
@@ -202,6 +202,7 @@ extern "C" {
               if (F_status_is_error(recurse->state.status)) break;
             }
             else {
+
               recurse->action(recurse, recurse->listing.directory.array[i], f_directory_recurse_do_flag_directory_e);
 
               if (F_status_is_error(recurse->state.status)) {
@@ -211,7 +212,7 @@ extern "C" {
             }
 
             // This loop is not considered a loop for breaking and continuing.
-            if (recurse->state.status == F_break || recurse->state.status == F_done || recurse->state.status == F_continue || F_status_set_fine(recurse->state.status) != F_interrupt) break;
+            if (recurse->state.status == F_break || recurse->state.status == F_done || recurse->state.status == F_continue || F_status_set_fine(recurse->state.status) == F_interrupt) break;
           }
           else {
             if (recurse->flag & flag_actions[j]) {
@@ -224,7 +225,7 @@ extern "C" {
             }
           }
 
-          if (F_status_is_error(recurse->state.status) || recurse->state.status == F_break || recurse->state.status == F_done || F_status_set_fine(recurse->state.status) != F_interrupt) break;
+          if (F_status_is_error(recurse->state.status) || recurse->state.status == F_break || recurse->state.status == F_done || F_status_set_fine(recurse->state.status) == F_interrupt) break;
           if (recurse->state.status == F_continue) continue;
         } // for