]> Kevux Git Server - fll/commitdiff
Bugfix: Partially fix "if is regular for xxx" exposes bug in error handling of and/or.
authorKevin Day <thekevinday@gmail.com>
Wed, 12 Jan 2022 05:21:37 +0000 (23:21 -0600)
committerKevin Day <thekevinday@gmail.com>
Wed, 12 Jan 2022 05:21:37 +0000 (23:21 -0600)
The following:
  if is regular for xxx
    print found.
  else
    print did not find.

Fails when "xxx" does not exist.
It should not fail but should instead trigger the "else" condition.

In this case, if the file does not exist and "fail exit" is setup, the program exists as failure.
This is bad behavior.

I then tried to work around the problem with the following:
  if exists xxx
  and is regular for xxx
    print found.
  else
    print did not find.

This did not work as expected because the "and" condition is executing when it should not be.
This commit focuses resolving this second case.

The problem is that there is an incorrect test for "and" and "or" types at the start of the process function.

I also noticed that the "is" check has the wrong words in the error message (should be "get type of" rather than "get mode of").

The primary problem requires more in-depth changes that I will not get to tonight and is not intended to be solved within this commit.

level_3/fake/c/private-make-operate_process.c
level_3/fake/c/private-make-operate_process_type.c

index b9a570565bb259ff10e42543060bf86271287bdc..3fd1357c6720cddc5e96bc91daefc80492f0c34d 100644 (file)
@@ -21,10 +21,8 @@ extern "C" {
 
     if (state_process->block) {
       if (state_process->block == fake_state_process_block_if_e) {
-        if (!(state_process->operation == fake_make_operation_type_and_e || state_process->operation == fake_make_operation_type_or_e)) {
-          if (state_process->block_result == fake_condition_result_false_e) {
-            return 0;
-          }
+        if (state_process->block_result == fake_condition_result_false_e) {
+          return 0;
         }
       }
       else if (state_process->block == fake_state_process_block_if_skip_e) {
index f6d5ef8f9711f6d09c8f3d04a9e607129b75353f..da72bf2808058d0fa468d877fd049acc9baa16ad 100644 (file)
@@ -608,7 +608,7 @@ extern "C" {
       if (F_status_is_error(status)) {
         state_process->condition_result = fake_condition_result_error_e;
 
-        fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i].string, "get mode of", fll_error_file_type_file_e);
+        fll_error_file_print(data_make->error, F_status_set_fine(status), "f_file_mode_read", F_true, arguments.array[i].string, "get type of", fll_error_file_type_file_e);
 
         break;
       }