Kevin Day [Mon, 15 Dec 2025 01:11:17 +0000 (19:11 -0600)]
Bugfix: Cannot disable f_thread_cancel() and f_thread_cancel_state_set() on Android.
These are now required by the programs.
I also tested on Android and found that these now work.
It should be safe to enable these by default on Android.
Kevin Day [Wed, 10 Dec 2025 04:25:33 +0000 (22:25 -0600)]
Refactor: Build mode gcc_13 to flex_arrays to provide a more generic name.
The `gcc_13` was a temporary mode and I don't want to have version specific modes.
Replace the mode witha more long term version unspecific name `flex_arrays`.
Kevin Day [Sun, 30 Nov 2025 01:53:51 +0000 (19:53 -0600)]
Update: Provide a way to use different file names for both send and receive as well as other changes.
Utilize the set flag for defining the state on whether or not to keep the senders file name when receiving.
Utilize the set flag for defining whether or not the send is a send set or a receive set.
Provide a `-a` or `--as` parameter for a sender to declare a custom name for some file being transferred.
Do not pre-check or pre-write to files when the file name will only be known once a packet is received.
The direction string no longer needs to be passed to functions now that the set flag defines what direction it is.
Consistently add new lines at the start of the message printing.
Do not reset the set flag on initialization (resetting).
Rename the initialization functions to use the word "reset" to avoid confusion with the real initialization process.
Print verbose log message declaring the name of the received file when keeping the senders file name and when headers are not printed.
Fix mistake where the `kt_tacocat_socket_step_receive_find_e` is incorrectly being compared against the set flag rather than the set step.
Fix problems preventing stand alone builds from compiling.
Kevin Day [Wed, 26 Nov 2025 04:00:57 +0000 (22:00 -0600)]
Update: Use the set to manage dynamic varriables associated with the receive abstruses.
Avod de-allocation issues when an abstruse type gets swapped around by only using dynamic strings already managed by another structure, like the set struccture.
Ensure these never get auto de-allocation by setting size to 0.
Handle each receive abstruse headers and ensure they get printed.
Provide a separate status variable to allow for detecting all header problems without failing until the very end of the function.
Kevin Day [Sat, 22 Nov 2025 22:51:50 +0000 (16:51 -0600)]
Update: Next micro version (0.7.4).
The following are the commands that I ran to make this change:
# find data/ sources/ specifications/ documents/ licenses/ install.sh -type f -exec sed -i -e 's|0\.7\.3|0.7.4|g' -e 's|^version_micro 3|version_micro 4|g' '{}' ';'
# find sources/ -name *.h -exec sed -i -e 's|_program_version_micro_s F_string_ascii_3_s|_program_version_micro_s F_string_ascii_4_s|g' -e 's|_program_version_micro_s_length F_string_ascii_3_s_length|_program_version_micro_s_length F_string_ascii_4_s_length|g' '{}' ';'
# sed -i -e 's|version_micro 3|version_micro 4|g' data/build/{remove,tacocat}/settings data/build/stand_alone/settings/settings.*
Kevin Day [Wed, 12 Nov 2025 05:16:07 +0000 (23:16 -0600)]
Update: Utilize the F_status_debug_source_d for handling the errors.
This simplifies some of the logic and code.
However, there are some disadvantages of doing this.
One such disadvantage is losing the specific function that has failed.
The location in the source file should be sufficient, if not ideal.
Kevin Day [Wed, 27 Aug 2025 02:40:12 +0000 (21:40 -0500)]
Update: Add specific source design documentation.
I have described this in one manner or another since the start of the FLL project.
This explicitly states the behavior that the FLL project (and related projects) have always followed.
Kevin Day [Sun, 20 Jul 2025 22:24:47 +0000 (17:24 -0500)]
Bugfix: Duplicate error messages and problems with errors when --force is passed.
Do not print duplicate error messages.
Duplicate error messages happen for directories.
The directory recursion handles errors so the caller should not need to.
This is not the case for top-level non-directories.
The `--force` parameter should prevent certain error messages from being printed.
The `--force` should also not result in an error being returned for these types of errors.
Kevin Day [Sun, 6 Jul 2025 21:02:51 +0000 (16:02 -0500)]
Update: Next micro version (0.7.3).
The following are the commands that I ran to make this change:
# find data/ sources/ specifications/ documents/ licenses/ install.sh -type f -exec sed -i -e 's|0\.7\.2|0.7.3|g' -e 's|^version_micro 2|version_micro 3|g' '{}' ';'
# find sources/ -name *.h -exec sed -i -e 's|_program_version_micro_s F_string_ascii_2_s|_program_version_micro_s F_string_ascii_3_s|g' -e 's|_program_version_micro_s_length F_string_ascii_2_s_length|_program_version_micro_s_length F_string_ascii_3_s_length|g' '{}' ';'
# sed -i -e 's|version_micro 2|version_micro 3|g' data/build/{remove,tacocat}/settings data/build/stand_alone/settings/settings.*
Kevin Day [Sat, 28 Jun 2025 03:41:08 +0000 (22:41 -0500)]
Cleanup: Apply new script practices.
Be more consistent about wrapping all variables in brackets.
This helps make the code more consistent and also more compatible with other interpreters like ZSH.
Don't use echo pipe syntax and instead use "<<<" redirection pipe syntax for passing variables to program calls.
The grep commands should use either `-sho` or `-shoP`.
Kevin Day [Tue, 17 Jun 2025 03:48:44 +0000 (22:48 -0500)]
Bugfix: File not found errors with f_file_access().
This is happening because the symbolic link is being followed.
Avoid this behavior by switching to using f_file_access_at().
Set the directory to the current working directory, which happens to be `-100`.
I need to revisit this once I decided on how I am going to handle the CWD of `-100` for the FLL library as a whole.
Ignore file not found errors on access checks.
If the file does not exist, then do not care if the access check for a non-existent file fails.
Kevin Day [Sun, 15 Jun 2025 16:02:14 +0000 (11:02 -0500)]
Bugfix: Handle deleting on access denied errors.
Detect the read, write, and execute permissions.
Print the unable to read, write, and execute status for each path when in simulate mode.
Add additional strings as needed.
Address an alphabet ordering mistake in the strings.
The preprocess now happens outside of the process function.
This better allows for calling the preprocess in the "before" state of the recursion and the process happens during the "action" state of the recursion.
This also allows for completely avoiding a second preprocess call for depth 0 recursive paths.
The operate flag is now handled on a per depth basis.
This requires a new array of flags for each depth.
The `normal` part of `kt_remove_flag_recurse_*_d` now use the work `active` instead of `normal`.
This makes reading and understanding the code easier given the more direct meaning of the word.
With the preprocess logic now outside of the process logic, the `top` and `parent` recurse states from `kt_remove_flag_recurse_*_d` no longer need to be part of the preprocess.
They are not used anywhere else so remove them.
Make the code simpler by just using an `uint64_t` rather than an `uint32_t` for the operate flag.
This also avoids the need for casting when adding it to the recurse code value.
Update the `remove-config.h`.
I noticed that the sorting is working differently from system to system.
I had to manually adjust/correct some of the ordering and I may have missed some things.
I will need to figure out the cause of the inconsistency at some point.
Fix the linking to make sure the fl_path library is included.
Also make sure the static library link paths are used in the tests as well.
A new flag `return_fail` main flag is added to designate that the final state should be a failure.
This is done because a single file remove failure on file does not exist should not prevent other failures.
(The classic `rm` command will remove all files that it can and return an error for any error.)
The unit tests are updated.
The unit tests are updated to respect the 32-bit to 64-bit type change.
The unit tests now handles the `f_file_access()` calls.
The unit tests now handles the updated directory recursion and pre-process flow.
The `recurse.depth` must now be mocked.
I would further note that at some point in time in the future, I need to not mock `fl_directory_do()` and instead call that directly and mocks its calls.
This is a complex situation that would require mocking the directory list and several other things.
This is too much work to do at this time.
The updated unit tests exposed a concern regarding immediately exiting the pre-process after an "is file type" check.
Move this down to the end of the pre-process to allow for other checks to happen.
I have some concerns with doing this for additional behavior and I will need to review and test other programs.
(That is, the `rmdir` vs `rm` vs `unlink` behavior are directly tied to "is file type" checks.)
I'd rather not make this commit any larger than it already is and so I am leaving the further investigation and changes to another time.
Kevin Day [Fri, 6 Jun 2025 02:45:25 +0000 (21:45 -0500)]
Security: Explicitly define IFS to prevent misuse.
The scripts are written with certain expectations.
This expectation may not be properly met if the `IFS` value is changed.
This can potentially be used to create some sort of exploit.
Explicitly define IFS and then do so at a local variable scope to prevent affecting the callers IFS setting.
Kevin Day [Thu, 8 May 2025 04:53:19 +0000 (23:53 -0500)]
Workaround: The compiler and linker fail to understand that compiling statically should also link statically.
This is a logic or design flaw that is just plain idiotic.
When compiling statically (passing `-static`), there cannot be any shared/dynamic linked data.
Rather than recognizing this, if there is a shared library during a static build then the shared library is linked to.
The compiler and linker, at least, supports explicitly forcing the point that a static library is to be linked.
This is done via `-l:libc.a` for libc linking rather than `-lc`.
This should not be necessary, but it unfortunately is.
Kevin Day [Thu, 1 May 2025 02:50:28 +0000 (21:50 -0500)]
Update: Some macros and documentation.
I am starting to get back to working on TacocaT.
This addresses a single `@todo` regarding adding documentation and also renames several of the related macros.
Kevin Day [Thu, 1 May 2025 01:50:51 +0000 (20:50 -0500)]
Update: Next micro version (0.7.2).
The following are the commands that I ran to make this change.
# find data/ sources/ specifications/ documents/ licenses/ install.sh -type f -exec sed -i -e 's|0\.7\.1|0.7.2|g' '{}' ';'
# find data/ sources/ specifications/ documents/ licenses/ -type f -exec sed -i -e 's|^version_micro 1|version_micro 2|g' '{}' ';'
# find sources/ -name *.h -exec sed -i -e 's|_program_version_micro_s F_string_ascii_1_s|_program_version_micro_s F_string_ascii_2_s|g' '{}' ';'
# find sources/ -name *.h -exec sed -i -e 's|_program_version_micro_s_length F_string_ascii_1_s_length|_program_version_micro_s_length F_string_ascii_2_s_length|g' '{}' ';'
# sed -i -e 's|version_micro 1|version_micro 2|g' data/build/{remove,tacocat}/settings data/build/stand_alone/settings/settings.*
Kevin Day [Fri, 25 Apr 2025 04:23:55 +0000 (23:23 -0500)]
Progress: Continue working on completing the remove program.
Tweak the logic to ensure the simulate prints the simulate message only once for the top-most directory and then only for the second simulate pass (which is after the recursion into the directory children).
Make so the `--remember yes` works as intended.
Make the `--remember yes` the default for the `remove` program.
Print the "skip yes" when simulating and remember state causes a skip.
A unit test is failing due to a bug/regression in `kt_remove_operate_recurse_action()`.
I belive this line is the concern:
```
if (!(flag & f_directory_recurse_do_flag_action_d) || !kt_remove_operate_shall_remove(recurse->state.code) && !((main->setting.flag & kt_remove_main_flag_simulate_d) && !recurse->depth)) return;
```
This is not yet addressed.
Kevin Day [Wed, 23 Apr 2025 03:45:50 +0000 (22:45 -0500)]
Update: Add higher level testfile.
Previously, something like the following is needed to perform the "remove" program runtime unit tests:
```
fake -w /tmp/fll-0.7/ clean make -f testfile -U build/remove
```
This new `testfile` allows for shortening the command to:
```
fake -w /tmp/fll-0.7/ clean make -f testfile
```
Note tat the `-w /tmp/fll-0.7/` is an example use-case for where I am storing the work directory files.
The command can be simplified to just the following (given a clean source directory and proper system installation of dependencies):
```
fake -f testfile
```
Kevin Day [Wed, 23 Apr 2025 02:47:54 +0000 (21:47 -0500)]
Progress: Continue working on completing the remove program.
Remove no longer used flags and code.
Add recurse flags.
The statistics cache ended up not being used.
Remove it entirely and the related code adding to the cache.
The tree mode is now updated to be in line with the latest functionality..
Ensure that the simulate is not printed twice for the top level directory being recursed.
This is done by adding an additional "simulate not" flag that is then passed to simulate printing functions as appropriate.
This is only needed for cases where the recursion is enabled.
Kevin Day [Mon, 21 Apr 2025 03:18:08 +0000 (22:18 -0500)]
Progress: Continue working on completing the remove program.
Update to the latest FLL changes.
The FLL changes include parameter processing changes to support the `--` parameter as a stop processing parameters option.
Enable this and remove the manual process that was previously performed.
Add the root path check.
Make sure a parameter exists in the `remove` program to toggle this behavior.
A lot of the simulate and directory recursion behavior is now dead code due to the recent recursion changes.
Remove the dead code and simplify the parameters.
Update the unit tests.
I noticed some situations in the unit tests that could be improved to be more accurate and correct.
An `@fixme` has been added to accomplish this.
Kevin Day [Sat, 19 Apr 2025 02:22:26 +0000 (21:22 -0500)]
Progress: Continue working on completing the remove program.
Remove final remove command in directory recursion.
It turns out that there is a bug in FLL `fl_directory_do()` that makes this necessary.
That bug is now fixed and this code is no longer needed.
In fact, with `fl_directory_do()` fixed this now causes a problem with attempt to double delete a directory.
Kevin Day [Sun, 13 Apr 2025 19:53:27 +0000 (14:53 -0500)]
Update: Pass 0 to f_directory_remove() to avoid nftw() calls.
The `fl_directory_do()` already is taking care of the recursive delete.
The `f_directory_remove()` should not need to recurse.
The `nftw()` uses a lot of resources and slows down the speed even when the directory is empty.
The massif-visualizer shows that with `nftw()` there are two ~548.8 Kb spikes to remove empty directories.
Without the `nftw()` there is only a single 64Kb spike to remove the same empty directories.
The time taken with `nftw()` takes about 4e+06.
The time taken without `nftw()` takes about 1.6e+06.
The memory usage according to valgrind with `nftw()` is about 84 allocs, 84 frees, 3,303,959 bytes allocated.
The memory usage according to valgrind without `nftw()` is about 74 allocs, 74 frees, 497,999 bytes allocated.
The command I used to test this is:
```
clear ; md a/b/{c/d,e/f} && touch xxx && touch a/b/file.txt && valgrind remove a/b xxx -r ; t a
clear ; md a/b/{c/d,e/f} && touch xxx && touch a/b/file.txt && valgrind --tool=massif remove a/b xxx -r ; t a
```
Kevin Day [Sun, 13 Apr 2025 03:12:51 +0000 (22:12 -0500)]
Progress: Continue working on completing the remove program.
Add normal allocation length define and shrink the path to this size if the size is larger than the large length.
Restructure the simulate to be called during the directory recursion so that there is only a single `fl_directory_do()` recursion.
The simulate must not be aware of when it is being called during recursion and when it is not being called during recursion.
The directory has to be processed to determine if and when it is being recursed.
However, the directory should be deleted after recursion into its child paths.
Update the unit rests accordingly.
The directory recursion is now moved into a top level cache.
This reduces the amount of allocations necessary and makes clean up on exit easier.
The parent path logic needs to be updated.
I added sample snippet of code with a todo, commented out.
Remove some stale documentation comments.
I did some basic tests using (with and without `-S` added):
```
clear ; md a/b/c/d && touch a/b/file.txt && valgrind --leak-check=full remove +V a/b -r ; t a
```
And (with and without `-S` added):
```
clear ; md a/b/{c/d,e/f} && touch a/b/file.txt && valgrind --leak-check=full remove +V a/b -r ; t a
```
The file statistics for the top-level directory being recursed needs to be preserved and passed through to the simulate.
The first directory processing pass before recursion should retain this.
During recursion, the parent directory should utilize this information when needed.
Kevin Day [Fri, 11 Apr 2025 03:55:39 +0000 (22:55 -0500)]
Progress: Continue working on completing the remove program.
Add file type ignore flags to conditionally suppress printing types when not wanted during simulation.
This is needed for the `rm` program when simulate is wrong.
Prior to this change the `rm` program is showing all file types.
Kevin Day [Thu, 10 Apr 2025 02:48:01 +0000 (21:48 -0500)]
Progress: Continue working on completing the remove program.
I want to remove the multiple `fl_directory_do()` calls.
This means that I need to change how pre-processing and removal is performed.
The pre-processing needs to happen before each remove.
The recursion needs to happen during the remove.
This begins refactoring the code to allow for this design change.
The recursive functions do not use the `main.setting.state.status` and so the functions need to be updated to instead return the status.
I placed a delete on the top level, but recursion is not necessarily properly done yet.
I only partially changed the structure to test out some of the recent changes, primarily trying to confirm/deny if the simulate is working as desired.
I still need to complete/correct the logic for proper deletion with recursion.
Update to utilize the newly added `fll_program_signal_check_loop()` and `fll_program_signal_check_simple()`.
Remove all stale and no longer needed signal check defines.
Kevin Day [Thu, 3 Apr 2025 03:28:22 +0000 (22:28 -0500)]
Progress: Continue working on completing the remove program.
Make sure to not set the `kt_remove_main_flag_option_type_d` for the "different" and "same" parameters.
Make sure to not set the `kt_remove_main_flag_option_used_d` for the "empty" parameters.
The `kt_remove_flag_file_operate_recurse_d` flag is being set on a directory, but it is always being set without regard to te recursive parameter.
Remove it an and just check the recurse parameter instead.
The empty not flag should be checked when checking empty states.
Remove accidental assignment of `kt_remove_flag_file_operate_remove_d` when `is` is true for the `kt_remove_preprocess_file_type()`.
Address the program unit tests.
Add the empty parameters in places where the tests were originally expecting the remove command to remove non-empty directories by default.
The directory tree tests were improperly returning false on the mocked empty for the parent directory after the child directory was mock deleted.
I'm currently investigating problems where the following does not work as expect:
```shell
clear ; md a/b/c ; touch a/b/file ; remove a/b/ -r +V ; t a
```
Cast the `flag_operate` when transfering to/from the `recurse.state.code`.
Kevin Day [Wed, 2 Apr 2025 04:24:47 +0000 (23:24 -0500)]
Progress: Continue working on completing the remove program.
Remove redundant code and get rid of a lot of the callbacks.
I did further structural investigation and found that I really didn't need most callbacks.
Add special flags to distinguish when file types are being specified and when they are not.
Then when this is set, handle accordingly and print errors.
This reduces the need for custom handling code in each of the other programs like `rm`, `rmdir`, and `unlink`.
Update the settings and flags accordingly.
I have not gotten the time to update the unit tests, which currently now fail.
I also need to review the programs and their replacement counterparts for any problems.
Kevin Day [Wed, 2 Apr 2025 02:11:32 +0000 (21:11 -0500)]
Progress: Continue working on completing the remove program.
Clean up the function naming.
The file remove and directory remove structure is rather confusing, name-wise.
Simplify the names.
Now that I know how I intended to implement the callbacks, I can remove unused callbacks.
This is being committed in isolation to allow for better diagnostics.
I will follow this up with additional testing whose changes, if any, will be in additional commits.
I still need to review existing functionality and also resolve incomplete functionality.
Kevin Day [Tue, 1 Apr 2025 00:53:28 +0000 (19:53 -0500)]
Progress: Continue working on completing the remove program.
Fix recursion parameter to actually work by setting the `kt_remove_depth_max_d` when calling `f_directory_remove()`.
Make sure `--force` works as expected as well as work when not specified (remove unnecessary checks).
Still print verbose messages even when in debug mode while the force parameter is passed.
Oops! I incorrectly used `macro_f_console_parameter_t_initialize_6()` when I instead should have used `macro_f_console_parameter_t_initialize_4()`.
The `macro_f_console_parameter_t_initialize_4()` is for the short parameter type where the `macro_f_console_parameter_t_initialize_6()` is for the simple parameter type.
Finish the `--help` messages for the `rm` program.
Make sure to note that the `--one-file-system` is not supported.
Fix messaage for `--preserve-root=all` error.
Make sure to handle `--preserve-root=/`.
Kevin Day [Sun, 30 Mar 2025 03:12:49 +0000 (22:12 -0500)]
Progress: Continue working on completing the remove program.
Implement most of the `rm` program.
There are some remaining details and I need to also test the program.
Move some of the repeated setup code into `kt_remove_setting_load_standard()`.
Add the initial settings needed to support the `--preserve-root` and `--presserve-root-not` support via the newly added `root` flag.
This work is not yet implemented and needs to be completed.
Add support for all programs to return `2` instead of `1` when `F_support_not` is an error return to the main program.
I might end up applying this behavior to all of my FLL and related programs.
The `rm` program in particular has the `--` being manually processed.
I figured given the simple nature of this program that it would be easier to manually pre-process than to utilize the custom callbacks supported by the `f_console_parameter_process()`.
Kevin Day [Fri, 28 Mar 2025 22:38:06 +0000 (17:38 -0500)]
Progress: Continue working on completing the remove program.
Make sure the `--force` parameter is properly suppressing errors and warnings when a file is not found.
Do not print an error or error out when `--force` is used.
Utilize the `ignore` string and print the boolean state based on `--force` when a file is not found during simulation mode.
Remove the warning on file not found because an error is potentially printed later on.
Update the `--prompt` settings.
Update the program unit tests.
The program now properly returns non-zero on file not found when trying to remove.
The program unit tests are updated to match this expectation.
Update the readme documentation for the remove program.
Fix the standard parameters and properly use `f_console_standard_parameter_last_e`.
Kevin Day [Fri, 28 Mar 2025 03:15:01 +0000 (22:15 -0500)]
Progress: Continue working on completing the remove program.
Add the `rmdir` program.
The `install.sh` script doesn't utilize the `-s` parameter.
There only needs to be a single `install.sh` command, which attempts to install everything in the build directory.
Update the version numbers to `0.7.1` just to make relating to the 0.7.x FLL more consistent and obvious.
Eventually these will separate and change in their own ways but for now this is not a problem as there is no official Kevux Tools release.
Change how the `--remember` logic works.
Skip the pre-process entirely if the remember matches.
Do not append a trailing slash for directories.
(There may need to be more code reviews due to the new remember logic and I will have to do this later.)
The `skip` printing in the simulation mode is no longer needed due to this change.
The `--empty` logic along with the `--ignore-fail-on-non-empty` is changed.
I need to rethink the design but for now just make the logic work for `--ignore-fail-on-non-empty`.
This allows for `rmdir` to work as expected with `--ignore-fail-on-non-empty` and without `--ignore-fail-on-non-empty`.
These changes break some of the unit tests.
The `--force` tests also started failing.
It looks like I didn't actually finish those tests and they happened to previously pass so I didn't notice that it is incomplete.
I will come back to these tests later to address them.
Kevin Day [Thu, 27 Mar 2025 03:34:00 +0000 (22:34 -0500)]
Progress: Continue working on completing the remove program.
Update the copyright year.
Add the `unlink` program.
Make sure all necessary callbacks are available to perform this.
Use a custom parameter processing to more closely match the standard Coreutils unlink argument.
I am still preserving some of the core parameters of the FLL/Kevux projects.
(This means that there is the `++version` and the `--version`.)
Fix bug where no error was being printed on non-existent file.
Make sure to also exit on error in this situation.
Kevin Day [Thu, 27 Mar 2025 01:18:50 +0000 (20:18 -0500)]
Progress: Continue working on completing the remove program.
Use polling on the standard input to allow for blocking in an interruptible way.
Once there is input the file read can be called to read the input.
This finishes the `remove` program development.
I am still designating this as progress because the following wrapper programs now need to be written:
- `rm`
- `rmdir`
- `unlink`
Kevin Day [Wed, 26 Mar 2025 22:43:56 +0000 (17:43 -0500)]
Progress: Continue working on completing the remove program.
This wraps up most of the `remove` program functionality.
It seems that I already had Time and EpochTime logic in place and I didn't have to do anything.
Add the program unit tests for time and EpochTime.
Fix some documentation comments in the program unit tests.
There is a remaining `@todo` in the `remove` program that will need to be address in the FLL.
I will have to brain storm on how I want to do this and I may end up adding callbacks to all file read and write functions.
Kevin Day [Wed, 26 Mar 2025 00:24:36 +0000 (19:24 -0500)]
Progress: Continue working on completing the remove program.
Add UNIX Timestamp tests.
Fix date changed tests where I forgot to reset temporary date loop variable assignment before committing.
Add the accessed and updated (modified) time tests.
When recursion is disabled and a directory is being followed, then prevent a double delete by not performing the delete on the "after" at the top level.
Implement the `--prompt` support.
Make sure to take in command line input.
Make sure to quit the program when prompt is one time and the answer is no.
Change the flag to 32-bit for consistency reasons.
Kevin Day [Tue, 25 Mar 2025 03:01:12 +0000 (22:01 -0500)]
Progress: Continue working on completing the remove program.
Finish some work that I thought I finished in the previous commit.
There were some commented out cases where I was doing controlled manual testing and I forgot to restore the commented out logic.
The Time and EpochTime are not well documented and are also not actually implemented!
Add more of the Time and EpochTime documentation.
I will look into implementing this at a later date.
Kevin Day [Mon, 24 Mar 2025 02:16:41 +0000 (21:16 -0500)]
Progress: Continue working on completing the remove program.
This adds the yesterday and today program unit tests.
Focus on getting the unit tests working and correcting the logic.
There is a lot of logic surrounding the relative dates and times that makes this ripe for an error.
I will need to add more program unit tests over time to better catch logic mistakes.
Kevin Day [Sat, 22 Mar 2025 16:41:33 +0000 (11:41 -0500)]
Progress: Continue working on completing the remove program.
The existing program unit tests revealed that the date pre-processing is:
1. Happening even when none of the date flags (access, changed, and updated) are set.
2. Is incorrectly returning `F_yes` due to the initial `F_okay` assignment to `status`.
Add `accessed_changed_updated` helper flag and use that flag to ensure the `kt_remove_preprocess_file_dates()` only gets called when needed.
Initialize the `status` value to `F_false` in the `kt_remove_preprocess_file_dates()`.
The newly added pint functions is resulting in an extra call to `geteuid()`.
Add a second wrap call to address this.
I may want to use a variable in the future to prevent multiple calls to this function.
Kevin Day [Sat, 22 Mar 2025 03:18:53 +0000 (22:18 -0500)]
Progress: Continue working on completing the remove program.
Utilize the FLL file type strings.
Merge the separate file stat printing into the simulate function and create the appropriate print functions.
Fix the loop variable name order ('i' before 'j').
Fix the printing of the Time and EpochTime units.
Print the time units on the same line as the `updated`, `accessed`, and `changed`.
Improve error printing for user and group IDs when the ID is not found or too large.
Kevin Day [Fri, 21 Mar 2025 03:12:49 +0000 (22:12 -0500)]
This provides changes that were documented in that commit.
Fix the `--force` flag, which essentially means that it must ignore missing files.
Update the help documentation regarding this.
The file stat printing function is very redundant and should be combined into the simulate function.
I noticed that the date based pre-processing is only in the printing and is not yet toggling the flags.
Begin moving this over.
I decided to make a separate function to handle this given its size.
Reset the `!(^)` check back to a `==`.
The compiler should be able to determine the most efficient operation and using plain `==` is just more readable.
Add some additional help messages describing how the `<` and `>` characters must be quoted to prevent them being used as redirect characters.
Is `stop_year` not being used when it should be?
Plan on investigating this.
Be more consistent with the parameter handling strings in the program unit tests.
This includes changes that were supposed to be in that commit.
Add file type based program unit tests.
Add user based program unit tests.
Add group based program unit tests.
Fix bug exposed by the program unit tests where the id tests are only being performed as a group test even when it needs to be a user test.
This is fixed by creating and passing the `is_user` boolean to the functions.
Fix bug exposed by the program unit tests where the `--same` and `--different` boolean logic is reversed resulting in `--same` removing for different users and `--different` removing for the same user.
Kevin Day [Tue, 18 Mar 2025 01:20:32 +0000 (20:20 -0500)]
Progress: Continue working on completing the remove program.
Add more recurse simple program unit tests.
Add the tree simple program unit tests.
Implement the tree delete operation.
Relocate the parent directory pre-process to a loop that is processed after all other files and directories are removed.
Kevin Day [Mon, 17 Mar 2025 03:55:14 +0000 (22:55 -0500)]
Progress: Continue working on completing the remove program.
Add the first more complex file removal runtime unit tests.
I may start calling these "program unit tests" as that sounds more accurate than "runtime unit tests".
The `f_directory_is()` should not be needed because the `fl_directory_do()` already passed a flag designating that the path is or is not a directory.
Remove the calls to `f_directory_is()` and instead use the appropriate flag.
Add `directory_parent` helper flag.
Report whether or not the path is a parent path when using tree mode.
The tree mode has changes in this commit that are not yet tested and need to be tested.
I should write a program unit test for this as well.
The "list" flag is not needed for the `fl_diectory_do()` processing.
The `parent` and `child` flags are now used differently.
The `parent` flag is now used to represent a parent directory only in the case where tree mode is enabled and the directory is only a parent directory do to parent tree traversal.
The `child` flag is now used to represent recursion from some directory.
The recursion cannot happen on a `parent` as the tree mode does not support recursion on a parent.
The `child` is passed to any directory or file that is being recursed into.
The lack of the `child` flag should designate that this is a top-level directory as far as recursion is concerned.
Fix an issue where the wrong flag is being used for the `flag_operate` `directory` flag.
Both the `kt_remove_operate_file_directory()` and the `kt_remove_preprocess_file()` should have the directory and parent flags cleared when called via pre-process recursion.
The pre-process recursion does not need to pass any flags to the recursion callback (via the `recurse.flag`).
The operate recursion does not need to pass the list flag to the recursion callback (via the `recurse.flag`).
Make sure the directory state is preserved by mapping the flag from the `fl_directory_do()` to a flag for the kt_remove file operations.
Kevin Day [Wed, 12 Mar 2025 03:06:33 +0000 (22:06 -0500)]
Progress: Continue working on completing the remove program.
Add more runtime unit tests.
This begins adding simple directory recurse tests.
The current test written for this is incomplete and needs the `fl_directory_do()` to be unwrapped.
Then the individual parts need to be mocked as needed.
Kevin Day [Tue, 11 Mar 2025 04:47:08 +0000 (23:47 -0500)]
Progress: Continue working on completing the remove program.
Fix a bug exposed by the directory unit tests where the `recurse.path_top` is not being defined and must be.
Add additional safety checks to fall back to a NULL string if `recurse.path_top` is NULL.
Add basic file and directory tests.
There are still a lot more tests to write.
This should be an acceptable start.
Refresh the stand alone build settings and config.h files.