Kevin Day [Thu, 29 Jun 2023 04:38:30 +0000 (23:38 -0500)]
Update: Relax the requirement in the license to be less verbose.
Do not specifically use my name "Kevin Day".
Instead refer to the "original license owner" or some authorized party.
This will make the license more flexible.
This also addresses a define name design problem where I have two cases that _F_type_array_file_h would be defined.
For now, just rename the _F_type_array_file_h to _F_type_array__file_h for the top-level file.
Kevin Day [Sat, 24 Jun 2023 20:58:06 +0000 (15:58 -0500)]
Feature: Add f_file_select() for select().
This is more of a wrapper around select() (unlike f_file_poll() which is a bit more than a wrapper around poll()).
The arguments would be more difficult than worth it to simplify and normalize in the FLL typedef style.
Kevin Day [Sat, 24 Jun 2023 03:08:45 +0000 (22:08 -0500)]
Feature: Add additional network and socket related functions.
Add the following:
- f_file_poll() for poll().
- f_socket_read_stream() for recv().
- f_socket_write_stream() for send().
Add f_poll_t, f_polls_t, and f_pollss_t typedefs.
This adds the appropriate array management functions.
To be consistent with type_file.h a new type_array_file.h is created to manage these.
Update the existing f_signal_read() to use the new typdef f_poll_t.
Kevin Day [Thu, 22 Jun 2023 03:26:54 +0000 (22:26 -0500)]
Feature: Add f_network_to_ip_string() and f_network_from_ip_string() functions.
Provide support for inet_ntop() and inet_pton().
String are handling in FLL via f_string_static_t and f_string_dynamic_t.
The functions f_network_to_ip_string() and f_network_from_ip_string() are written to convert to these string types.
This implements a custom f_network_family_ip_t type to pass the digit IP address.
The idea here is to help reduce how much the FLL API is locked into the "libc" or POSIX API.
The structures are allocated using "{ 0 }" to take advantage of the supposed relatively new feature that treats this as an initialize all to NULL.
Kevin Day [Wed, 21 Jun 2023 01:54:31 +0000 (20:54 -0500)]
Feature: Add f_file_manipulate() as a wrapper for fcntl().
This also adds the unit tests.
The unit tests includes additional fixes where several of the wrapped functions are not being setup properly.
The fact that has not triggered an error in the past is concerning.
Kevin Day [Wed, 21 Jun 2023 01:51:05 +0000 (20:51 -0500)]
Feature: Add F_again and F_again_not status codes.
The fcntl() function uses two forms of privilege failures.
The EPERM is already translated to F_prohibited.
Therefore, add F_again (and F_again_not) so that EAGAIN can be used for that.
Kevin Day [Tue, 20 Jun 2023 02:52:12 +0000 (21:52 -0500)]
Feature: Add f_socket_name_host() and f_socket_name_peer().
Add missing network socket related functions for getting the "name" of the local or remote connections.
The local name is retuned as a string.
The remote name is returned on the f_socket_t structure.
I considered doing the work necessary to better generalize this but I decided not to.
I can leave that for once I am better experience in the network programming.
Kevin Day [Tue, 20 Jun 2023 02:51:00 +0000 (21:51 -0500)]
Cleanup: Rename *_total_parameters_d to *_parameter_total_d.
The naming scheme for the total parameters define is out of synchronization with the practices.
Rename this to be more in line with the current practices.
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.