Kevin Day [Sat, 17 Jun 2023 17:41:52 +0000 (12:41 -0500)]
Update: Remove f_array_length_t and related, replacing with f_number_unsigned_t and appropriate.
This simplifies the design.
Doing this comes at a cost of some flexibility and hackability.
After some consideration, I have decided that it can introduce more complicated handling when needing to process both f_array_length_t and f_number_unsigned_t during I/O.
This should keep things simple.
I decided to maintain the custom functions for managing this.
I could use an ifdef wrapper and call the appropriate calls within, but I can do that for another time if I decide to (and remember to).
Kevin Day [Fri, 16 Jun 2023 03:13:17 +0000 (22:13 -0500)]
Cleanup: Remove no longer needed programs.
The fss_read is mostly complete for these programs.
Additional review and testing is needed but I can do that slowly over time.
The runtime unit tests suggests that these are reasonably complete.
The Embedded List Read is not deleted because it is not complete.
There are bugs in both the 0.6.x and the 0.7.x versions.
A rewrite of that mess is needed (and has been for a long time).
I will push this off for now due to it being low priority.
Kevin Day [Thu, 15 Jun 2023 03:13:00 +0000 (22:13 -0500)]
Progress: Fix issues in runtime tests for fss_read not relating to Embedded List and Payload.
More runtime tests now pass.
The Extended List tests still fail in some cases.
I noticed that the Extended List line count is not handling the closing brace.
The count is inaccurate.
This is a bug in the 0.6.x branch and needs to be fixed there.
The fix is in place for this branch but the tests currently fail because they generated expect files are incorrect in this case.
There are other similar problems in different FSS read programs regarding --total and parameters like --at or --line that need to be fixed in the 0.6.x branch as well.
The Embedded List and Payload need special handling and are not addressed here.
Other things regarding fss_read not done:
- The help printing needs to be updated for each program.
- Any remaining todo and fixme.
- The pipe input and output.
There is likely a lot of room for improvement but I am going to ignore such things for now as my priorities are elsewhere.
Kevin Day [Sat, 10 Jun 2023 04:04:33 +0000 (23:04 -0500)]
Update: Complete most of the runtime times for FSS Read program.
Note that this says "most".
I noticed a segmentation fault with FSS-0.6.x versions of fss_embedded_list_read.
This needs to be addressed but is not done so here.
This does not address the tests that fail.
A subsequent commit will follow to address these failures.
These failures are most likely due to that I have not finished migrating all of the fss_read standards.
This also adds some files with UTF-8 characters in the name.
Kevin Day [Fri, 9 Jun 2023 04:15:10 +0000 (23:15 -0500)]
Bugfix: Use arguments passed to fake when processing build with the custom build arguments.
The custom build arguments are passed when the make mode is being used to call the build mode.
The mode arguments passed to the fake program, these should be propagated into the custom build arguments for the build mode.
Kevin Day [Wed, 31 May 2023 03:07:14 +0000 (22:07 -0500)]
Bugfix: Fix runtime tests and problems exposed by runtime tests.
Add additional runtime tests to handle more cases.
The --select functionality is now completed.
This includes using --select with --name and --total.
The quotes are not being handled properly.
This has been fixed by the previous commit (e793c5a5b9f3c3c636e55e0b52df1a11590827cb).
The fss_read tests are updated to better test and expose this potential problem (adding single and double quote usage).
I used the 0.6.x fss_*_read functions to generate the expected output.
This exposed a mistake in the fss_extended_read in the 0.6.x branch where the wrong quotes are being used.
The expecations have been manually corrected and I now need to go back and fix this bug in the 0.6.x branch.
Kevin Day [Wed, 31 May 2023 03:00:02 +0000 (22:00 -0500)]
Bugfix: Quotes in FSS read functions are not being properly handled.
At some point in time the intended behavior changed from using the literal quote character to an enumeration representing the quote character on FSS read calls.
This transition is incomplete and broken.
Finish the transition, passing the enumeration representation rather than the literal character.
Remove an unnecessary initialization on the quote because the private function being called also initializes the variable.
Relocate the f_uint8s_increase() call to be after changing the error status to ensure that the quotes array is properly incremented.
Update the documentation comments to better clarify this behavior in regards to the enumeration.
Kevin Day [Tue, 30 May 2023 22:47:35 +0000 (17:47 -0500)]
Cleanup: FSS Read testfile and related.
Add some new lines to the testfile.
Remove a redundant directory create operation in the testfile.
Remove the '=' character as it does not provide anything useful when printing the test status.
I completely forgot that "location" is for the parameter location and is not the last value location.
Some part of me wanted a last value location.
Revert back to using "values.used - 1" instead of "location".
Kevin Day [Tue, 30 May 2023 01:15:55 +0000 (20:15 -0500)]
Progress: Add simple runtime testing scripts and testfile for fss_read.
This is an incredibly basic implementation.
I didn't bother to make is as flexible and portable as it could otherwise be.
Provide a way to test the runtime results of the fss_read programs.
I only got so far as to add tests for FSS Basic (FSS-0000) and FSS Extended (FSS-0001).
The tests for the FSS Extended (FSS-0001) currently has some failures.
I've noticed that I have not even implemented the --select functionality.
This is the likely cause for several of the test failures.
For now, I just cheated and used the 0.6.x version of the project to generate the expected output.
Any bugs in that output will be matched (ideally there are no bugs).
I did do a quick glance at some of these and they do look fine.
The source test files are copies of files I have used in the past but never made publicly available until now.
Kevin Day [Tue, 30 May 2023 01:06:54 +0000 (20:06 -0500)]
Bugfix: The set no EOL is misplaced on "extended" and should be on "basic_list".
The fss_read program is incorrectly settings the no EOL set function for the FSS Extended (0001) standard.
This should actually be on the FSS Basic List (0002) standard.
Kevin Day [Mon, 29 May 2023 23:26:57 +0000 (18:26 -0500)]
Bugfix: Handle f_directory_not status as an invalid directory.
The status f_directory_not is returned with the path exists but is not a directory.
The fake program can fail when doing something like this:
fake clean make -w /arbitrary_non_directory_file +V
The error message returned is not very helpful:
ERROR: (674) when calling function f_file_stat().
This is a known file-related error and so it is now handled appropraitely.
The new error message looks like:
ERROR: Invalid directory while trying to access directory '/arbitrary_non_directory_file'.
Kevin Day [Mon, 29 May 2023 23:18:28 +0000 (18:18 -0500)]
Bugfix: The testfile needs to handle the --build parameter and improve --work parameter handling.
Provide a new operation "build_path" to load the "--build" parameter properly.
The existing checks for the "--work" parameter is better suited checking against "work:value" rather than "work".
There may be an existing bug where the condition for "build" parameter is always returning true when it should not.
This requires further investigation and is not addressed within the scope of this commit.
Kevin Day [Mon, 29 May 2023 05:09:23 +0000 (00:09 -0500)]
Progress: Continue work on refactoring fss_*_read into fss_read, focusing on fixing issues.
Get the programs into better working state.
I found several problems resulting from the way in which I migrated and refactored the code.
I think the next thing to do is to instead start writing some runtime tests that can better find problems.
Of particular note, I found problems with the comments being printed properly (which generally means not printed).
Some parameter handling problems are also fixed.
The payload and embedded list need special handling and are very much not implemented.
Kevin Day [Sun, 28 May 2023 02:07:42 +0000 (21:07 -0500)]
Security: F_data_not is not being handled leading to invalid read or write.
At some point I changed the behavior to return F_data_not when the main string (usually buffer) has used set to 0.
I failed to update the FSS processing functions to handle this.
The documentation comments are also not up to date in this regard and is now updated.
Kevin Day [Fri, 26 May 2023 04:23:07 +0000 (23:23 -0500)]
Progress: Continue work on refactoring fss_*_read into fss_read.
This gets the programs compiling.
I decided not to get everything correct and instead decided to get everything compiling.
The memory allocation needs to be fixed.
There are a lot of fixme and todo comments to address.
The payload and embedded list need special handling and are very much not implemented.
Individual standard differences need to be handled (and some are stubbed out or copied over, making them invalid).
Kevin Day [Mon, 1 May 2023 03:02:04 +0000 (22:02 -0500)]
Progress: Continue work on fss_read, making relevant changes in other projects.
Start using "static" where it is safe to do so and easy for me to identify such cases.
I would note that a static array of const f_string_static_t does not work.
Kevin Day [Sat, 29 Apr 2023 01:25:14 +0000 (20:25 -0500)]
Bugfix: Incorrect return code in tests causes false failures in CI.
Recent changes of the code change the "failure" variable from being an empty string for no error to being the explicit digit of "0".
The change is incomplete and this caused the false failure by incorrectly returning "1" when instead "0" should be returned.
The Gitlab CI detected this but the Github CI failed to.
Kevin Day [Fri, 28 Apr 2023 03:00:47 +0000 (22:00 -0500)]
Progress: Make some progress towards getting fss_read up and running.
This mostly focuses on the print help functions.
Fix the incorrectly spelled "aplied".
Fix the help messages in the read man pages.
Add *_format_code_name_* for an upper-case human friendly name.
Add this to the fss_write as well given that the programs follow the "programs as a library" design.
Kevin Day [Thu, 27 Apr 2023 03:36:48 +0000 (22:36 -0500)]
Progress: Initial setup of fss_read for merging all fss_*_read programs.
This is just a copy and paste of fss_write with some very basic initial changes and refactoring.
This is not expected to work anytime soon and will be slowly converted.
Expect major changes.
I suspect that I will be working outward in to slowly add the needed functionality and to match the behavior with the fss_*_read programs.
All of the fss_*_read programs will be removed and replaced with this once this project is complete just like was done with the fss_*_write programs and fss_write.
Also fix an incorrect comment in fss_write that references "payload" when it should not.
Kevin Day [Thu, 27 Apr 2023 02:36:41 +0000 (21:36 -0500)]
Update: Slightly reduce recursion cost for private_fl_directory_do_recurse().
Make some constant structures static with the goal of reducing the cost of recursion.
Using static should help avoid redeclaring these variables per execution.
This should reduce memory for each recurse into the function.
Kevin Day [Tue, 25 Apr 2023 02:39:45 +0000 (21:39 -0500)]
Refactor: Mass change the macro initializer functions to always have an underscore and some identity.
The macro initializer functions can be a little confusing when there is macro_f_do_something() and macro_f_do_something2().
Change the behavior to something more like macro_f_do_something_1() and macro_f_do_something_2().
Kevin Day [Wed, 19 Apr 2023 03:21:32 +0000 (22:21 -0500)]
Progress: Unit tests and other minor changes.
Get more of the unit tests up to date.
I did not finish working on the f_file unit tests.
I specifically stopped on the stream functions, namely the f_stream_write().
Fix the file defaults, such as _di_f_type_file_defaults_ that should be _di_f_type_file_defaults_d_.
The file flags (wrapped by _di_f_file_flag_d_) must be located with the f_type type_file.h file.
Kevin Day [Tue, 18 Apr 2023 03:57:54 +0000 (22:57 -0500)]
Bugfix: Fix bugs in console parameter processing exposed by unit tests.
The f_console_identify() function is incorrectly assigning the bits for short alone values.
The mistake is a missing pipe character and as a result the flags are being assigned rather than being bitwise-or appended.
The short.used and long.used string checks should skip when the string is empty.
This is not happening due to an AND comparitor in the string.
This then causes a false positive and the unit tests identify invalid data.
The process found check outside of the loop that depends on the iterator "i" should also check that i is less than the total array length.
Kevin Day [Tue, 18 Apr 2023 00:29:59 +0000 (19:29 -0500)]
Progress: Address incomplete updates to several programs.
A previous progress commit (or series of commits) left these programs incompletely updated when they should otherwise compile.
Add "machine" name type to the fss_write matching logic.
Add missing macro function string fo f_thread_create.
Fix out of date initializes that now need different arguments or sets of arguments.
The changes to fss_write accidentally mass replaced the special fss_write_setting_load() uses that have a callback parameter.
The embedded list write has the wrong format code string ("basic" should be "embedded list").
The iki_write has an out of place declaration of iki_write_main_delete().
Kevin Day [Mon, 17 Apr 2023 02:36:04 +0000 (21:36 -0500)]
Progress: Wrap up most of the directory do related changes in Featureless Make.
I am hoping this is the last progress on Featureless Make to get it fully up to date with all of the changes.
While I won't be surprised if I missed something this feels like its ready.
Remove the directory recurse copy flags.
Use more caches in Featureless Make.
Move the directory do as a cache to better allow for reusing the path and path_custom strings.
Update the documentation comments regarding the caching.
The regression mentioned in commit 61a348ba714e41467da803f8220a31c126581a01 is resolved.
The regression is that I appended the path separator out of scope (outside of a relevant condition check).
I noticed another regression where when source.used is 0 the action is not performed.
This is incorrect because the source may be 0 and the paths being used are just relative paths.
Fix a mistake where the f_file_copy() and f_file_clone() are passed invalid flags.
Make sure to pass the appropriate flags to the f_file_clone() calls in the directory do handle callback.
Kevin Day [Sun, 16 Apr 2023 03:19:04 +0000 (22:19 -0500)]
Progress: Additional file copy, clone, and move changes.
Remove code relating to the recursive copy functions.
Remove the fll_file_move() function.
The fll_file_move() has some additional logic for handling a case where the return status is F_mount.
If this is still a problem then I will have to address this.
The fll_file_move() doesn't make as much sense now that thee is an fl_directory_do().
Most of the logic needed is now outside of the FLL project and inside of the projects utilizing the library.
The fl_directory_copy() function is now fully replaced by the fl_directory_do() function.
This has an upside of being more flexible but a downside of putting more of the design burden onto the caller.
This overall appears to be resulting in a cleaner and simpler design.
Move the fl_directory_do() related callbacks into a new source and header file in Featureless Make.
I have noticed a regression, of which I would wildly guess be related to the recent cache design changes, where testing Featureless Make against bzip is not working anymore.
There is a path separator at the start of the files when there should not be.
This regression is not fixed here.
I only wanted to record it.
Kevin Day [Fri, 14 Apr 2023 00:42:44 +0000 (19:42 -0500)]
Progress: Focus on directory recursion related changes and Featureless Make.
This should wrap up most of the initial work creating the copy recursion.
There are other areas to update but this is the start.
I forgot and accidentally added "custom" to the fl_directory_do_t.
I should be using the custom from the state variable.
Now that I have had a chance to experiment with the new fl_directory_do() design I have managed to come to some more decisions.
The parameter checking will not have the f_directory_recurse_do_flag_path_e bit set for the error handler.
The before and after should be called not on just the directory recursion but also before and after each non-recursion file action.
This better allows for setting things up in a sane way as is appropriate when performing a copy operation.
I decided to provide some convenience variables.
This is not a great idea for a recursive function but it is a start.
I should investigate moving this array into a static array that is global to the private file but not shared beyond that.
This would prevent the cost of allocating the array for each recursion.
It would be a good idea to bind some of the strings to the cache and update them to better avoid additional allocations.
I think I need a cache_3 to achieve this.
I added todo comments in areas where I think this is relevant.
Do some minor clean ups on the printing in certain areas.
Kevin Day [Sun, 9 Apr 2023 23:21:10 +0000 (18:21 -0500)]
Progress: Focus on directory recursion related changes and Featureless Make.
I decided to offload some of the design in fl_directory_do().
The caller provides a callback and handles the combining of the path and the base file name.
This should allow for more optimization in string allocation and reduce some of the overhead of recursion.
The recursion now only records the used string rather than allocate an array of the path each time.
This should ideally reduce the amount of memory in the recursion.
The caller can now provide a custom variable to pass local data to the callbacks.
Rename 'first' and 'last' into 'before' and 'after', respectively, to be more semantically accurate.
Initial implementation of callbacks for action and handle.
I may have more work to do in the error handling, but I decided now is a good place to stop and save the progress.
Add code property to f_state_t to provide custom flags for the caller to control.
Create fake_local_t to pass custom information to the recursion functions.
Begin setting up and populating the failures structure.
Take care more cases where the interrupt needs to be handled.
This now sets the interrupt function globally and so the interrupt should be checked more often (such as in FSS Basic List read functions).
Make sure the interrupt is not checked twice once a signal is received.
This can happen after a program returns due to an interrupt.
Kevin Day [Thu, 6 Apr 2023 01:33:33 +0000 (20:33 -0500)]
Bugfix: The stage files should not begin with "-".
I haven't looked at the stage files in a while because it just works.
I happened to notice that they are beginning with "-".
This is incorrect.
Turns out that at some point in time the separator got pulled outside the process.used condition.
This results in the "-" always being added when it should not be.
The problem is introduced in this completely erroneous commit 8cb1d765b75403e242e307590842628aad7ad91b.
Add the same logic check to the name because it also append a "-".
Also reset the used length at the start of population of the stage file strings.
Improve the thread configuration to make it easier to enable or disable thread support.
Add documentation regarding the build modes supported in each of the build settings files.
Update the build scripts to better handle the now additional build modes.
The build scripts now use braces everywhere.
Doing this should make it easier to be compatible with other scripting engines such as ZSH.
Kevin Day [Mon, 3 Apr 2023 00:17:48 +0000 (19:17 -0500)]
Update: Implement threaded signal handler in Featureless Make.
Bring in the threaded signal handler design that I experimented with in the Kevux Tools project.
This works by creating a thread that waits for the signal and nothing else.
The threaded design avoids the signal check and therefore avoids period calls to kernel space.
When thread support is diabled, this falls back to the traditional approach.
Kevin Day [Sun, 2 Apr 2023 20:34:44 +0000 (15:34 -0500)]
Progress: Continue program related work, focusing on Featureless Make.
The Featureless Make is not handling the return status correctly on error.
This is due to a regression from switching to having status on state.
There are a couple of separate reasons:
1) One function is not doing the pre-check for error and then overrides the status.
2) Other functions that handle the error printing are calling f_fss_count_lines() which overrides the state.
The first situation is easily solved with a condition check.
The second case requires saving the status and then restoring it for error handling functions calling f_fss_count_lines().
Change the code were reasonably possible to use const on the return code.
Don't bother with return_code != 0, as removing the != 0 should be effectively the same check.
Make sure path separator is only added if it is not already present.
The migration of status into main.setting.state.status incorrectly changed fake_make_operate_validate_define_name().
This function does not set the status on main.setting.state.status.
Make sure a single white space is after simple variable print messages (before the quoted variable).
Reduce the number of pointer accesses (such data->main->... into main->...) by using a variable.
This costs some memory but should reduce having to navigate two pointers constantly.
Doing it this way also avoids having to add a parameter to each function.
Kevin Day [Sun, 2 Apr 2023 00:06:32 +0000 (19:06 -0500)]
Progress: Centralize Featureless Make cache and update directory code.
The Featureless Make program now uses a more centralized cache.
This requires some delicate handling in certain areas and testing is needed to assure that there are no regressions.
Continue some work regarding the recursive directory functions.
This program correctly errors when there is no "main" section.
When specifically asking to run a named section rather than the default "main", who cares if there is no "main"?
Based on that logic the lack of a "main" section should not be an error.
Kevin Day [Thu, 30 Mar 2023 04:54:50 +0000 (23:54 -0500)]
Update: Add unit tests for f_compare utf string functions.
I completely forgot about these and later noticed that they are not implemented.
This exposed problems where I neither had up to date utf stings nor did I have all of the expected functions implemented.
I took the lazy route to avoid spending time manually converting everything.
The files are direct copies from the non utf string compare functions.
I then provided functions that convert the regular strings into utf strings.
The comparisons are then against the generated utf strings.
Kevin Day [Wed, 29 Mar 2023 23:30:15 +0000 (18:30 -0500)]
Regression: Build test.sh script is not properly running.
Two mistakes are introduced by the commit 8f5854676725879488eaa1b378dc5d02e8169ae5.
1) The error handling return status checks are against empty string and not "0".
2) Accidental copy and paste mistake where print variable is being used as if it were a function.
Remove the failure=0 assignment.
The default of failure="" is what is needed.
The variable print_line_first is supposed to be test_print_first.
Kevin Day [Wed, 29 Mar 2023 03:37:05 +0000 (22:37 -0500)]
Security: Invalid read in trim comparison functions.
Writing unit tests exposed this problem.
The last1 and last2 positions could be the exclusive stop points.
The comparison checks fail to handle this situation and expect the last1 and last2 variables to not be positioned at an exclusive stop point.
This results in an invalid read.
Kevin Day [Mon, 27 Mar 2023 12:35:06 +0000 (07:35 -0500)]
Bugfix: The f_parse parsing functions do not check buffer.used.
The range length is being performed but not the buffer used length.
Add the appropriate return codes to represent end of string (buffer used length is reached).
This is applicable for the dynamic strings but is not applicable for the regular strings.
Kevin Day [Mon, 27 Mar 2023 02:11:20 +0000 (21:11 -0500)]
Refactor: Redesign fl_string and fl_utf_string, relocating into f_compare, f_parse, and f_rip.
The fl_string and fl_utf_string projects only depend on the core projects.
They could easily be moved into the level_0 project directory.
The problem is that they cannot be part of the f_string project due to depending on f_utf.
The f_string project is before the f_utf.
The solution is to break the fl_string into three projects:
- f_compare
- f_parse
- f_rip
It just so happens that the fl_utf_string is in the same situation as fl_string.
Move fl_utf_string into these three projects as appropriate.
This adds some initial unit tests to f_compare.
I didn't have enough to to finish f_compare, let alone get to f_parse and f_rip.
Kevin Day [Sun, 26 Mar 2023 00:40:51 +0000 (19:40 -0500)]
Update: Add fl_directory_do(), add new status codes, update fl_directory_copy(), and other changes.
An alternative to the ftw() is desired.
The function, fl_directory_do() is provided to perform generic recursive tasks.
This is based off of the fl_directory_copy() function.
This is not yet tested and there may be changes in the future once this is tested.
I noticed some things that could be improved in fl_directory_copy().
The recursion structure is actually specific to fl_directory_copy(), so rename it with "copy" in the name.
Kevin Day [Thu, 23 Mar 2023 02:58:27 +0000 (21:58 -0500)]
Progress: Continue program related work, focusing on print and main structures for already migrated projects.
I did a lot of mass replacements with absolutely no consideration to the non-migrated projects.
The files were probably process and likely have a mess of some of the changes while not having any of the other migration changes.
I've updated and did minimal runtime tests to confirm that the following projects work:
- fake
- fss_write
- iki_read
- iki_write
- status_code
- utf8
Kevin Day [Wed, 22 Mar 2023 05:15:41 +0000 (00:15 -0500)]
Progress: Continue program related work, focusing on printing.
Lots of printing related changes and clean ups.
Begin preparing things for switching to the *_main_t structures.
The fake, status_code, and utf8 projects are already converted to this.
There is a lot of stubbing in this commit.
I am probably going to just start a clean slate when building fss_read.
The fss_read will be based off of fss_write's design.
For this reason, I am being lax and negligent on the fss_*_read projects as they are going to get replaced and merged into fss_read.
Kevin Day [Tue, 21 Mar 2023 03:50:55 +0000 (22:50 -0500)]
Bugfix: Out of date repository build scripts.
The repository build scripts are very much out of date.
A recent bugfix, commit 831e5d8b0dce5279964987baa43201b63c12c203, attempted to partially address this.
It turns out that there is a lot more that needs to be done.
All of the repository build scripts are now updated.
Make sure the copyright parameter is available.
Make sure the "+Q/++quiet" and "+E/++error" parameters are correct and working.
Make sue the "+F/++line_first_no" and "+L/++line_last_no" parameters are working.
Utilize "+F" and "+L" where reasonably possible in the example bootstrap and test scripts.
Improve return status handling.
The goal here is to avoid calling "exit".
The use of "exit" is not safe as under certain conditions it can close terminals that the script is running in.