Kevin Day [Tue, 27 Feb 2024 04:45:17 +0000 (22:45 -0600)]
Progress: Begin next development pass on fl_fss_payload_header_map().
Preserve the error status when exiting by checking and returning at the end of the function (before setting F_okay).
Fix the logic regarding the number macros when it comes to expanding an array of numbers into multiple destinations.
The object key must be set.
The macro needs to be accepting the destinations array rather than the specific destination string.
The case where f_fss_payload_header_map_flag_join_digits_e is set is not yet tested or reviewed.
In the 0.6, this problem happens only on printing.
In this branch, the 0.7 development branch, this is used in different parts of the code and may have unintended functional consequences.
Oddly, this problem is not observed for the same files that the problem can be seen when using the 0.6 branch built programs.
I have opted to fix the problem rather than to investigate further.
The logic is clearly flawed and the fix is identical from the 0.6 branch.
Kevin Day [Sun, 25 Feb 2024 16:29:52 +0000 (10:29 -0600)]
Update: Disable -fstrict-flex-arrays=3 flag because it doesn't work on GCC 11.
I just did tests on GCC 11, which is not too old.
The -fstrict-flex-arrays flag does not work there.
For now, just disable the flag by setting it to the non-existent gcc_13 mode.
The mode can be added to the mode list and enabled if so desired.
I may make version specific modes available in the future (or not) but that will require some planning.
The fakefile should be designed to test the GCC version, but I would rather avoid such logic by design.
Let the distributor or the system administrator handle such decisions.
Kevin Day [Sat, 24 Feb 2024 23:42:26 +0000 (17:42 -0600)]
Update: Make the Open Standard License 1.0 formal.
I don't see any opportunities to get this reviewed and finalized and so I am formalizing it as-is.
I can always improve it if the opportunity arrives and increment the version number.
There are no changes to the license other than remove the "informal" and "draft" parts.
Kevin Day [Sat, 24 Feb 2024 21:10:34 +0000 (15:10 -0600)]
Feature: Add -a/--analyze to test.sh script.
Adding the -a/--analyze parameter to the test.sh script should allow for easier testing with the analyze option.
The idea here is to make it easier to perform these checks and to improve the quality of the releases.
Kevin Day [Wed, 21 Feb 2024 02:02:38 +0000 (20:02 -0600)]
Update: Add the ability to explicitly skip a program.
The controller program is not yet migrated to compile under 0.7.x.
This adds the ability to the bootstrap example script to allow for simply skipping packages.
Kevin Day [Wed, 21 Feb 2024 02:00:10 +0000 (20:00 -0600)]
Bugfix: Remove unused files from build settings that break the build.
For some reason going through the bootstrap example script reveals this problem but directly using the packaging system does not.
This likely means that there is a difference between the system fake program and the one used during the bootstrap example script process.
Kevin Day [Tue, 20 Feb 2024 23:48:03 +0000 (17:48 -0600)]
Update: Get the Byte Dump stand alone build working.
Add missing f_compare dependency.
The f_compare dependency is ultimately not needed.
There are no f_compare functions used because the dependent projects' functions that use f_compare are disabled.
The design could be further improved by adding disable defines around specific headers the might be worth disabling when the dependent module is not needed.
Such a change is considered out of scope.
Kevin Day [Tue, 20 Feb 2024 23:45:59 +0000 (17:45 -0600)]
Bugfix: Disable defines used for private_f_memory_adjust() and private_f_memory_resize() are incomplete.
There are additional functions that call these private functions that require additional disable defines added.
The _f_memory_FORCE_secure_memory_ and _f_memory_FORCE_fast_memory_ should be paired with their appropriate _di_f_memory_resize_ and _di_f_memory_adjust_ disable macro.
Kevin Day [Tue, 20 Feb 2024 05:53:56 +0000 (23:53 -0600)]
Update: Add -Wno-missing-braces, remove unused threadless, fix test.sh parameter, and fix minor mistakes in programs.
Add the -Wno-missing-braces to all settings.
This warning is not exactly accurate and it is annoying.
Remove stale code around individual_threadless from package.sh.
The test.sh has a parameter to test_operate_build_project() that is missing.
The lack of this is causing the test_thread_individual variable from not being received.
Several of the programs have some mistakes that come to light only when using -Wall.
- Remove unused variables.
- Should be using "void_main" rather than "main" in specific situations.
- Add missing return statement.
- Add missing f_abstruse dependency in fss_read.
Kevin Day [Tue, 20 Feb 2024 04:39:13 +0000 (22:39 -0600)]
Update: Get clang working by separating out gcc specific settings, such as -fstrict-flex-arrays=3, and related changes.
The "-fstrict-flex-arrays=3" flag is not supported by clang.
Create a new mode call "gcc", make that the default, and move the "-fstrict-flex-arrays=3" into the gcc-specific setting.
Update the unit tests and mocks with these changes.
Make the unit tests and mocks more consistent by having these same settings.
Add a missing period at the end of the clang specific mode documentation comment.
The example bootstrap script handling of threads is improved.
Kevin Day [Sat, 17 Feb 2024 22:10:28 +0000 (16:10 -0600)]
Update: Finish refactoring firewall from 0.6.x to 0.7.x/0.8.x.
I have tested this out and compared the show results between the 0.6.x version and the 0.7.x version to confirm consistent results.
From this point forward problems are to be up for consideration as possible regressions.
Separate out more of the functions into separate files.
I reviewed the header includes and removed the headers that do not have apparent direct use.
Kevin Day [Fri, 16 Feb 2024 05:56:20 +0000 (23:56 -0600)]
Progress: Continue refactoring firewall from 0.6.x to 0.7.x/0.8.x.
This gets the programming compiling.
There still remains some code to change.
The runtime needs to be tested.
I expect that there are things wrong given how much I jumped around while migrating this.
Kevin Day [Thu, 15 Feb 2024 04:28:10 +0000 (22:28 -0600)]
Cleanup: Switch from _ui_ format string to _un_ format string to match the print format arguments.
The _un_ format string is provided to directly match '%un' which is intended to directly match f_number_unsigned_t.
This is intended to make things easier (and safer) to hack.
That is, changing the data size of f_number_unsigned_t.
The _ul_ format string is specifically intended to be an unsigned long, period.
Kevin Day [Thu, 15 Feb 2024 04:25:53 +0000 (22:25 -0600)]
Progress: Continue refactoring firewall from 0.6.x to 0.7.x/0.8.x.
This is very close to be ready for review and testing.
I converted most of the buffers into the new structure but I need to check for isolation.
I am pretty sure that there are currently some isolation problems with the FSS Object and Content ranges.
I also noticed some typos and such that will need to be fixed (this therefore probably does not compile just yet).
Kevin Day [Sun, 11 Feb 2024 04:14:23 +0000 (22:14 -0600)]
Progress: Refactoring firewall from 0.6.x to 0.7.x/0.8.x and other FLL project wide changes.
Add the f_console_parameter_state_type_total_d and update all programs.
Add (and use) additional f_string_format strings.
Add fll_program_print_help_operations().
Add fll_program_print_help_special_options().
Begin using more helper flags for common behavior, such as "main_flag_version_copyright_help" type of flags.
Add missing documentation comments for some functions.
Remove duplicate "#ifdef __cplusplus" blocks in several programs.
Begin to refactoring firewall to follow the 0.7.x and eventually 0.8.x project design.
The firewall program is far from ready and will not yet compile.
Kevin Day [Fri, 9 Feb 2024 05:10:34 +0000 (23:10 -0600)]
Update: Use typedef on a structure tag to avoid the need for void pointer on the callback for f_state_t.
Using a typedef on the structure tag allows for having the structure reference itself.
In this case, the callback that is part of the structure accepts its own structure as one of the callback parameters.
I previously did not know that I could do this and opted to use a void pointer to provide this.
With this approach I get more safety, integrity, and less memory usage (for not having to add a variable that is a cast of the void pointer to the f_state_t).
Kevin Day [Fri, 9 Feb 2024 04:34:55 +0000 (22:34 -0600)]
Feature: Add _f_memory_USE_reallocarray_ and _f_memory_NO_zeroing_on_larger_ macros.
The _f_memory_USE_reallocarray_ designates to use reallocarray() rather than realloc() in the f_memory project.
The _f_memory_NO_zeroing_on_larger_ designates to not perform the memset() to 0 for malloc() or realloc() calls where the new size is larger than the old size.
The programs provided by this project might expect the memory to be zeroed.
Please use _f_memory_NO_zeroing_on_larger_ carefully.
Kevin Day [Fri, 9 Feb 2024 03:55:08 +0000 (21:55 -0600)]
Update: Add restrict optimization to f_memory functions.
The design of the memory operations require that array, used, and size do not point to the same memory address.
Help prevent potential aliasing by adding restrict keyword.
The functions with only a single pointer in its parameters still has the restrict keyword added.
I opted to avoid adding the restrict keyword to some of the append and append all functions.
Those would require more attention before I am certain whether or not they should be allowed to have overlapping addresses.
I think they should not, but just in case, I put doing that on hold.
The callback could also use restrict but I have decided not to do that as well due to the number of files that I will need to change.
I will do this later.
Kevin Day [Fri, 9 Feb 2024 03:24:54 +0000 (21:24 -0600)]
Progress: Begin adding unit tests for fl_fss_payload_header_map().
I added the single digit unit tests for signed and unsigned.
I started to add uint8_t with the test files but then I realized that I actually should implement uint8s_t.
I am leaving those test files currently but I will change them at a later date.
This adds a helper file for the payload header map private functions to simplify some of the code.
Kevin Day [Sun, 4 Feb 2024 23:34:53 +0000 (17:34 -0600)]
Progress: Wrap up initial pass of fl_fss_payload_header_map().
Everything for the fl_fss_payload_header_map() function is written.
I can guarantee that there is some logic error or mistake somewhere due to the codestorming practice that I did with this (in addition to doing it across multiple weeks).
I experimented with different approaches in the different private functions.
I will eventually follow up this with a clean up pass that add functions to reduce the redundant code and also standardize the logic implementations where reasonable.
My next task in regards to this function will be to write unit tests.
This will find the problems and I will use the unit tests to kick off the rewrite of the private functions.
Kevin Day [Sat, 3 Feb 2024 23:45:31 +0000 (17:45 -0600)]
Refactor: The f_string_quantity_t into f_quantity_t.
This makes the f_string_quantity_t consistent similar to how f_string_range_t was refactored into f_range_t.
This is done because there is no actual string value in f_string_quantity_t.
There are only numeric values.
Kevin Day [Sat, 3 Feb 2024 23:43:53 +0000 (17:43 -0600)]
Bugfix: Runtime tests have incorrect space for "not a comment" line tests.
I overlooked a bug when I generated these files.
Now that the bug has recently been fixed, the unit tests are failing as they should.
Fix the incorrect tests so that they pass and fail correctly by fixing the "expect" relevant files.
Kevin Day [Fri, 2 Feb 2024 04:26:16 +0000 (22:26 -0600)]
Progress: Continue working on fl_fss_payload_header_map().
Mostly focus on private_fl_payload_header_map_maps().
There is a lot of similar code design with subtle but key differences.
This is going to be really easy to make an mistake with.
Writing unit tests is going to be the ideal way to ensure the logic here is correct.
I did a lot of back and forth jumping around while trying to remember where I was last and what I need to do.
Make the build settings files more consistent in regards to threads and coverage modes.
Kevin Day [Thu, 1 Feb 2024 05:29:57 +0000 (23:29 -0600)]
Update: Add hopefully more secure compiler flags by default.
Use the "-Wl" for specifying the linker flags.
- Make sure "now", "relro", and "nodlopen" are set.
Add FORTIFY_SOURCE set to 3.
Add stack-clash-protection and strict-flex-arrays set to 3.
This project is designed around NULL checks.
- Make sure the no-delete-null-pointer-checks flag is set to prevent the compiler from removing these security/integrity checks.
Use stack-protector-strong rather than stack-protector for test flags.
- Future versions may enable stack-protector-strong by default for regular compiling.
Kevin Day [Wed, 31 Jan 2024 05:39:26 +0000 (23:39 -0600)]
Bugfix: FSS Basic List and FSS Extended List print comment at the start of the Content.
When the Content exists at the start of the Content, the comment character ('#') is printed when it should not be printed.
This is a bug where the code initializes the newline_last at the range.start.
The code logic then always expects the newline_last to represent an actual new line.
This is not necessarily the case for when newline_last is pointing to the initial range.start position.
Add a check when processing a comment to ensure that the newline_last is in fact a new line.
Restructure the not used checks to a single location to make reading the code easier.
Make sure to only increment the line on empty Content when the empty Content flag is set.
Kevin Day [Sun, 28 Jan 2024 06:32:13 +0000 (00:32 -0600)]
Progress: Improve FSS program processing and fix related bugs.
Clean up the logic in the fll_fss functions, removing redundant code.
Improve handling of F_fss_found_object_content_not cases in a more consistent manner.
Improve logic of the fll_fss payload functions.
Remove dead code that does nothing.
Have the payload processing properly determine and communicate when the "payload" section is missing.
Update the documentation comments.
Improve the FSS read programs relating to the above changes.
Fix problems in the FSS read programs where sometimes the EOL string is directly printed rather than calling the appropriate object/content end callbacks.
The callbacks handle the uses cases for when the pipe is used but the direct EOL string printing does not.
Rename the FSS read progams print functions to have the "data", "message", "error", and such practice be more consistently followed.
This fixes several of the problems in the FSS Read programs where the "-e/--empty" parameter is not being properly respected in many cases.
I am not sure I got all of the situations and the logic from all of the changes that I made needs some review.
For the FSS payload read program, add a new special parameter called "--payload".
This allows giving the user more control over how to handle the cases where the payload section does not exist.
Specifically, there is a payload "create" mode that allows for ensuring that the "payload" section always exists.
This should ideally help make scripting simpler and therefore easier.
The parameters must be re-processed once the '-A" is passed for the fss_read combined program.
I added a print_content_empty callback and then commented it out in this commit.
This seems like it would be practical to have but I am not certain any FSS specification would need this at this time.
Further investigation is needed in this regard.
Add some more TODO and FIXME comments so that when I come back to this code and can better resume where I left off.
The following Content should now be returned:
[0] = "
[1] = b
[2] = c
[3] = d.
This adds a new FSS state flag 'f_fss_state_quote_not_e' to give the caller the ability to manually designate that the quotes are being disabled.
Currently only the FSS Extended utilizes this flag.
Refactor the private function private_fl_fss_basic_read() into private_fl_fss_basic_or_extended_read() to make it more explicitly clear that it provides functionality fo both FSS Basic and FSS Extended.
This changes to the code such that when an unterminated quote is detected then the calling function will set the disable quote flag and then call the function again.
Writing these unit tests exposed some bugs, such as:
- The one solve in commit ba257a8b8385ec8dedfc9bc9bb596e420ca552f8.
- The FSS extended read is not handling unterminated single quote correctly.
An unterminated single quote in an extended requires that the quotes be treated as normal text, as per the standard.
This means that the quote should be broken up into unquoted content.
This is not the case and is considered a bug.
For example, consider the following line:
a " b c d.
That line is currently being interpreted by extended read as a single content called:
[0] = " b c d.
Instead, this should end up being 4 contents:
[0] = "
[1] = b
[2] = c
[3] = d.
The unit tests files that I created here should expect this and therefore the extended read tests currently fail.
I am also adding the basic list tests but I did not get to implementing the basic list content read tests yet.
The test data files exist but I need to review them and write the appropriate code.
The extended list and the embedded list tests are not yet written.
Kevin Day [Wed, 24 Jan 2024 05:54:07 +0000 (23:54 -0600)]
Bugfix: Incorrect stop position is calculated when FSS content ends at the start position on FSS read operations.
When the start position is say, 0, and the determined stop position ends up being 0, then an incorrect stop range is calculated.
This happens because the stop position is subtracting one from the current position.
Add checks to ensure that the stop position is never subtracted beyond the initial start position.
The initial start position is saved at the beginning of each affected FSS read function.
This now potentially returns a start range before the stop range.
The FSS read programs should also need to be updated following this commit to handle these cases.
Kevin Day [Tue, 23 Jan 2024 03:42:07 +0000 (21:42 -0600)]
Progress: Add "works" unit test for basic object read and basic content read.
My goal is to get to writing the payload tests but getting these other unit tests figured out first will make that process easier.
These "works" unit tests are intended to be very simple at this time.
There are no checks for comments.
The NULL data is not checked, partially due to the use of getline() and string comparison.
This also adds the beginnings of unit tests for the fl_fss project, specifically for the fl_fss_payload_header_map() function.
The tests for fl_fss_payload_header_map() will be rather complex and so I will likely break the tests for fl_fss_payload_header_map() into multiple files.
Kevin Day [Fri, 19 Jan 2024 03:08:51 +0000 (21:08 -0600)]
Cleanup: Invalid environment define "CMOCKA_TEST_ABORT" in testfiles.
This invalid configuration doesn't break anything unless someone uncomments it.
Then, the expected functionality does not happen.
The fix is easy, just add "define " at the start of that line to the right of the comment character.
Kevin Day [Thu, 18 Jan 2024 02:49:00 +0000 (20:49 -0600)]
Bugfix: Function private_fl_fss_basic_write() is missing "const".
The function implementations for private_fl_fss_basic_write() is missing the "const" type attribute in some parameters.
The declaration of these has the "const" type attribute as expected.
I did a lot of cleaning up and reorganization.
This adds a several flags that I intended to use but the current state of these is highly subject to change.
There are still a lot of incomplete changes, especially regarding existing code and the newly added flags.
Kevin Day [Tue, 16 Jan 2024 14:22:03 +0000 (08:22 -0600)]
Feature: Add f_string_dynamic_strip_null() and f_string_dynamic_strip_null_range().
The ability to strip out NULLs from a given string as a common function is needed.
Provide two similar but different functions.
The f_string_dynamic_strip_null() moves the NULLs to the end of the string and the shrinks the string used length as appropriate.
The f_string_dynamic_strip_null_range() shifts all of the NULLs found to the end of the given range without modifying the array used length.
Unit tests are added.
Only basic logic is applied and so there is no especially focused optimization in the parsing logic.
Kevin Day [Mon, 15 Jan 2024 18:34:10 +0000 (12:34 -0600)]
Refactor: The backtick into the grave.
Both the Unicode standard uses the word "grave" rather than the word "backtick" to commonly refer to the U+0060 character.
Change the use of the word from backtick to the word grave throughout the project.
This is a breaking change for the relevant programs, such as fss_write and iki_write.
Documentation, such as the website documentation and specifications, will need to be updated following this change.
Kevin Day [Mon, 15 Jan 2024 03:18:46 +0000 (21:18 -0600)]
Progress: Make control program at least compile.
I just did some quick tests and getting the control program to compile is just this simple change.
I believe there are still several programs, like the control program, that still need to be migrated from the 0.6 style to the 0.7 style.
Kevin Day [Mon, 15 Jan 2024 03:13:47 +0000 (21:13 -0600)]
Update: Switch to using the common format string structure where possible.
There may be other cases, but these are the ones I was able to quickly find.
After glancing over this I would also note that the common parameter argument printing could also be made common strings.
These would be common strings that are specific to something like fll_program.
Kevin Day [Sun, 31 Dec 2023 02:33:20 +0000 (20:33 -0600)]
Update: Explicitly cast UTF conversion to/from and simple packet bit operations to a uint32_t.
If the type is changed or the defines are used with different types, then the shift operators may become problematic.
Prevent this potential problem from happening through explicit casts to uint32_t.
Kevin Day [Sat, 16 Dec 2023 01:37:50 +0000 (19:37 -0600)]
Bugfix: Fix incorrect wording regarding negative times and add some clarification regarding defaults.
The time specification is mistakenly using the word "after" when it should be the word "before" for the example "2022:-5".
I decided that I needed to better clarify what I meant by default and not make it sound so strict.
Add additional language to better communicate that when the year is not specified, it is not specified.
There is no required interpretation and a default is simply a recommendation.
I am going to start trying to establish a habit of using UTC for my timestamps.
My local time zone, the date of the specification is still the 15 of December, 2023.
However, to stick with UTC for records purpose I need to the start doing this now.
There may be occasional inconsistencies for a while until I establish the habit of using UTC.
Kevin Day [Thu, 14 Dec 2023 02:27:54 +0000 (20:27 -0600)]
Refactor: The fss extract functions to be fss decode functions.
The commit 4713c80244fe1bc00da097eb27987e77c98601f0 introduced f_fss_simple_packet_encode().
Rename the f_fss_simple_packet_extract() and similar functions to f_fss_simple_packet_decode().
This makes the language more consistent between the two different functions.
Kevin Day [Tue, 12 Dec 2023 02:18:03 +0000 (20:18 -0600)]
Update: Strip NULLs from the payload number converters.
Add logic to strip the NULLs from the numbers.
The FSS functions use NULLs to reduce reallocations but the payload sends everything.
Don't introduce unexpected NULLs when writing the numbers.
I need to review the logic for any mistakes which I find is often best after sleeping on it.
Even better, I should write some unit tests to expose any potential logic flaws more easily.
Kevin Day [Mon, 11 Dec 2023 06:26:27 +0000 (00:26 -0600)]
Update: Socket size_read/size_write checks, result == -1, and explicit passing .generic.
Make sure size_read and size_write are not 0.
If either is 0, then return F_data_not.
Make sure the result checks are "== -1" rather than "< 0".
Explicitly pass .generic for the address union.
This probably isn't necessary but being explicit seems safer.
The memory address of the address union, regardless of the union type being used, is cast to 'struct sockaddr' in most cases.
This makes the use of ".generic" very practical.
Add documentation comment about F_pipe being returned.
Problems with the address unions ".sin_family" must be set or unclear F_pipe errors are returned.
I may in a future commit perform this assignment during setup because the "form" parameter makes this practical and reasonable to do.