From 13ee40dd890c6626249ffecee016c1b3e0cea1d2 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 11 Jan 2022 23:21:37 -0600 Subject: [PATCH] Bugfix: Partially fix "if is regular for xxx" exposes bug in error handling of and/or. 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 | 6 ++---- level_3/fake/c/private-make-operate_process_type.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index b9a5705..3fd1357 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -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) { diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index f6d5ef8..da72bf2 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -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; } -- 1.8.3.1