Kevin Day [Sat, 23 Nov 2024 22:26:01 +0000 (16:26 -0600)]
Bugfix: FSS Read unit tests, fix file names, and fix FSS-0008 test files.
I noticed that I had several of the test files misnamed.
Many of the test files should have a prefix of `name_` in from of parts of the file name relating to the name parameter.
I had originally created the test data for FSS-0008, FSS Embedded List Read, tests just using the output data as generated.
I knew that there was a good chance that any mistakes would be treated as valid.
This saved time and allowed me to work towards improvements.
I have identified and fixed several bugs.
This has then revealed that several of the tests have invalid data.
I manually reviewed several of these and confirmed that the newly generated code looks more correct.
There is still an opportunity for an oversight or mistake but I believe this is more progress forward.
My goal is not to spend too much time directly on this with the expectation that I will test and resolve these problems over time before a stable release.
This is more of a matter of time allocation and priorities rather than a technical correctness and accuracy issue.
Kevin Day [Sat, 23 Nov 2024 03:08:58 +0000 (21:08 -0600)]
Bugfix: The FSS Read process at should only process if index_at is non-zero.
The FSS Embedded Read recursive logic exposes this problem.
The at flag bit is set when the at parameter is passed.
The at parameter being passed when there are multiple depths does not mean that the specific depth in question should be using the at position.
Add a check that ensures that the current depth needs the at position processed.
Kevin Day [Fri, 22 Nov 2024 05:53:50 +0000 (23:53 -0600)]
Update: Refresh the stand alone builds.
I ran the commands as written in the commented out parts of the config.h files.
The order of the defines somehow changed.
I must either have done something weird, wrong, or different last time to result in the differences.
To save time, I short circuited some of the process.
This means that there is a chance that I commented out defines that don't need to be commented out.
I've tested and confirmed that these compiles.
I have not checked the before and after sizes or symbols.
Kevin Day [Thu, 21 Nov 2024 05:24:17 +0000 (23:24 -0600)]
Update: Fix IKI write and add EKI write functions for f_iki.
Fix the backslash handling now that I have figured that whole situation out and updated the specifications.
Adding support for the EKI write.
Add more extensive unit tests for both IKI write and EKI write.
I am trying to keep both the IKI write and the IKI write works functions as similar as possible.
The "works" write tests are already big enough anyway.
Implement a separate test for EKI, called `test__f_iki_eki_write__works_for_multiple`, to handle the multiple vocabularies case.
This will be structurally identical to the regular works tests but instead has multiple vocabularies.
Kevin Day [Thu, 21 Nov 2024 04:54:05 +0000 (22:54 -0600)]
Bugfix: IKI and EKI specifications, clarifying backslash escaping.
I made several improvements in my previous commit e9621b09db34cfd9ac6264c77068c34afa5bfb17.
I added documentation regarding the backslashes similar to how the FSS backslashes are handled.
For the IKI and EKI specifications, this is not the case.
Update the specification to clarify this situation.
Update the examples to better describe this.
Fix the examples to be accurate.
Kevin Day [Tue, 19 Nov 2024 02:17:38 +0000 (20:17 -0600)]
Bugfix: The IKI and EKI specifications have mistakes and needs clarifications.
The wording of the specification is now greatly improved.
I noticed that some of the specification is actually incomplete.
I removed the incomplete sentence.
Make sure the FSS-000C specification is updated to add allowances for the EKI specification.
The example in both the IKI and the EKI specifications has several mistakes.
Use the grave character (U+0060) for the code to help avoid needing to escape the single quotes.
The IKI inside of a valid IKI Variable do not need to be escaped.
The example that directly states "is escaped to not be treated as IKI Variable" is incorrectly being documented as a valid IKI syntax (a significant mistake on my part).
Add explicit escaping examples to help make the escape behavior more explicit and clear.
I believe the current escaping logic in the IKI processing code is incorrect and will need to be updated and corrected following this commit.
I remembered this time to make the date based on UTC.
The version date in this commit is based on the current UTC Earth day.
Kevin Day [Mon, 18 Nov 2024 04:58:54 +0000 (22:58 -0600)]
Feature: Add f_iki_write() along with appropriate unit tests.
The `f_iki_write()` function is missing.
Add appropriate unit tests.
I also need to add tests with existing slashes.
I think I noticed a bug in the IKI read functions regarding slashes and I will investigate that before I add such tests here.
I will write the EKI write functions once I have done further review and fixed the likely IKI read bugs that I believe that I have observed.
Kevin Day [Sun, 17 Nov 2024 23:22:29 +0000 (17:22 -0600)]
Feature: Implement EKI at level_0.
This provides the initial eki implementation and unit testing.
I had to choose between making an f_eki compliment of f_iki or appending EKI into f_iki.
I ended up choosing the latter because it is simpler and will require fewer cross-dependencies when using higher levels.
There is enough overlap in functionality to justify this.
These are almost completely identical specifications.
Add additional unit tests to catch more problems and implement these same unit tests in f_iki for consistency purposes.
This includes some code clean up.
The `wrapped` is changed to use `0x0` and `0x1` rather than `F_false` and `F_true`.
These are functionally identical but the code is more consistent when having `0x0`, `0x1`, and `0x2` instead of `F_false`, `F_true`, and `0x2`.
Kevin Day [Fri, 8 Nov 2024 05:15:39 +0000 (23:15 -0600)]
Cleanup: Print new line to test.sh script on install.
I noticed that the "All operations complete." runs into the "Installing individual project '..." line.
The `test.sh` now prints a new line before the "Installing..." message.
Kevin Day [Fri, 8 Nov 2024 04:53:36 +0000 (22:53 -0600)]
Update: Add FSS Embedded List read depth tests and fix test script files.
Add tests for the FSS-0008 standard using depths.
I generated these test expectations.
I will have to slowly review these over time or fix them when I identify one is wrong.
I did do a test by building the same tests on both the 0.6 and 0.7 and found that they both pass.
I either have correct logic or I have consistently bad logic.
This adds a lot of FSS-0008 depth tests, however, the amount of tests needed is a lot more than what I have done here.
I think this large number is a good start.
Add special cases functions for the script tests.
I noticed that the failure code is incorrectly being set (the logic appears reversed).
The conditional argument used to determine which test being run in the test script is wrong.
Create a new variable called `test_set` and use that.
The `standard` variable can then be extracted from the `test_set`.
The test script incorrectly is missing the `-o` for the Object in some cases.
Kevin Day [Thu, 7 Nov 2024 02:20:38 +0000 (20:20 -0600)]
Update: Implement the fss_embedded_read depth logic using recursion.
I only did cursory review of the code and functionality.
I need to do more extended review to make sure there are no mistakes or logic flaws.
I need to write unit tests to identify these cases.
Kevin Day [Mon, 4 Nov 2024 03:11:25 +0000 (21:11 -0600)]
Feature: Add EKI specification for EKI standard, a slightly updated IKI standard.
Think of EKI as an extended IKI.
This introduces a single change (and its accompanying requirements).
Multiple IKI Vocabularies are now supported.
I have been using IKI in practice for a while now.
A need has risen up where I really want to be able to easily designate multiple IKI Vocabularies for a single IKI Variable.
This new format allows for me to do something more similar to HTML.
I have been using IKI as part of a templating process.
With EKI, unlike IKI, I can now make something both bold and italic.
Whereas with IKI, I would have to create a new type that combines them (like `bold_italic`).
I would then have to create two types if I wanted to be order agnostic, such as `bold_italic` and `italic_bold`.
This would get progressively worse if I added a third or more Vocabularies.
With EKI, I don't add any new IKI Variables and the order does not necessarily matter.
Example: `bold:italic:"My example"` (and `italic:bold:"My example"`).
This would have `bold` and `italic`.
The order should be preserved in case something does care about order.
The order can be ignored if something does not care about order.
Kevin Day [Sat, 12 Oct 2024 03:52:17 +0000 (22:52 -0500)]
Regression: Make sure FSS Payload Read compiles after recent changes.
This commit 3b8b0cba03096e764194db8bb889cd94a8d97f5b has a mistake.
I ran the `testfile` tests, which does not use the `main` programs for specific types.
The `testfile` tests only uses the `fss_read` program.
I forgot to check and compile the main programs.
Replace the non-existent functions for the Payload main program.
Kevin Day [Sat, 12 Oct 2024 03:38:01 +0000 (22:38 -0500)]
Cleanup: Re-organize the process_normal files.
I was originally thinking of having `process_X()` and such functions.
I created `process_normal()` functions as the standard functions to use.
I ended up not doing this but the `process_normal` use remained.
This is the first step into cleaning up the structure to a simpler naming system.
All this does is rename the files and anything using the files by name.
Changes to the functions will be in a follow up commit.
Kevin Day [Sat, 12 Oct 2024 03:28:04 +0000 (22:28 -0500)]
Bugfix: The FSS Payload Read is not treating the Payload as raw when printing.
Special handling is needed to process the `payload` section.
The content functions all need to have the `at` position to determine this.
Update the callbacks to allow for this.
The function `fss_read_print_content_empty()` is defined and used but it is used only for the `print_object_end_empty()` callback.
Add a `print_content_empty()` callback to provide this.
These changes allow for removing redundant functions.
Kevin Day [Thu, 3 Oct 2024 05:12:22 +0000 (00:12 -0500)]
Bugfix: Empty Objects are preserving leading white space when in original mode.
This (unfortunately) adds more logic to processing the case when `--original` is used and the Object is empty.
This makes me wonder if I have to implement the opener range.
I was not happy about adding the `close` for memory and space reasons.
Adding this would introduce more inefficiencies.
I may end up having to add support for processing different types of structures if I want to support the simple Object and Content without the `open` and `close` positions as well as with those positions.
The focus in this commit is only on fixing the printing and does not introduce any of the behavior that I described here.
Kevin Day [Tue, 1 Oct 2024 02:05:21 +0000 (21:05 -0500)]
Update: The bootstrap example script now handles building using fake.
The bootstrap example script is generally for using bootstrap scripts.
I have ended up using this for regular building because it is simple and already written.
The FLL 0.7 development now has build settings for some programs that do not build using the bootstrap without additional parameters.
Add support for the bootstrap script to use `fake` directly if it exists in the PATH for these particular programs.
Kevin Day [Mon, 23 Sep 2024 02:08:03 +0000 (21:08 -0500)]
Feature: Fake settings specification updates and enable simple golang support.
The Featureless Make is intended to not be language specific since its inception.
I did not know how the languages were to work, so I mostly built this to guarantee C/C++ support.
I found that the `golang` supports some command line based compilation.
This adds support for `golang` in the most basic way.
This support is not well tested.
An `example_go` project is added.
I have only tested the basic build and I have not done anything advanced.
This relaxes some of the requirements.
The `bash` is changed to `shell` to encourage more types of scripts.
The `custom` is added and used as a fallback if `build_language_path` is not used.
I found that there needs to be some additional settings in the `settings` specification.
This updates the specification and adds:
- build_compiler_arguments
- build_compiler_arguments_shared
- build_compiler_arguments_static
- build_compiler_arguments_library
- build_compiler_arguments_library_shared
- build_compiler_arguments_library_static
- build_compiler_arguments_object
- build_compiler_arguments_object_shared
- build_compiler_arguments_object_static
- build_compiler_arguments_program
- build_compiler_arguments_program_shared
- build_compiler_arguments_program_static
- build_language_path
This also fixes some mistakes in the language of the specification.
Kevin Day [Thu, 19 Sep 2024 03:52:32 +0000 (22:52 -0500)]
Feature: The firewall program should have better IPv4 vs IPv6 support.
Add two parameters to explicitly chose between IPv4 and IPv6 (`-4` and `-6`, respectively).
The default behavior is to display both.
This default `firewall show` will now therefore show both IPv4 and IPv6.
Add `(IPv4)` and `(IPv6)` to the output from the `firewall show` command.
When the firewall rules set the tool to either IPv4 or IPv6 but the command line is designating that either IPv4 or IPv6 is specifically enabled or not, then do operate on the tools that are not enabled.
Therefore if the firewall rules have an IPv6 tool (as is the case in the example/default settings for `icmpv6`) and something like `firewall start -4` is used then those IPv6 ruls are ignored.
Kevin Day [Tue, 17 Sep 2024 02:11:23 +0000 (21:11 -0500)]
Update: Refresh firewall iptables rules and relax some of the defaults.
Relax some of the defaults so that there will be less immediate failure.
Provide a lot of the previous `DROP` statements for easy re-assignment by just uncommenting.
Add some specific wrapping tools around IPv6 related rules.
Kevin Day [Wed, 4 Sep 2024 23:29:17 +0000 (18:29 -0500)]
Feature: Add support for building under Android.
This is a forward port of the changes from the 0.6 branch without any testing.
This is not well tested or well supported.
This does have limited testing under the Termux project environment using CLang.
Add a new configuration option to build and run the project in an Android environment.
The test system had problems with text relocations but then required PIE.
This disables the relro in some spots (libraries) while enabling it in others (programs/executables).
Disable a lot of the functions that are not available or supported.
I have observed several warnings about `DT_FLAGS_1=0x41` being unsupported flag.
That is not a very helpful warning.
I have no idea what `0x41` is.
This causes a problem where the output of programs displays these warnings.
This can break programs that require I/O formatting and processing.
This has been tested to build using `bootstrap.sh` and then using `fake`.
Example build and install process:
# mkdir ~/software
# cd fll-0.6.X/
# ./bootstrap.sh build -m monolithic -m thread -m clang -m android && ./install.sh ~/software
# cd ../fake-0.6.X/
# ./bootstrap.sh build -m monolithic -m thread -m clang -m android -w ~/software && ./install.sh ~/software
# export LD_LIBRARY_PATH=~/software/libraries/shared
# export PATH=~/software/programs/shared
# cd ../byte_dump-0.6.X/
# fake -m monolithic -m thread -m clang -m android -w ~/software && ./install.sh ~/software
Example execution of `byte_dump` of `bash` program (this is a large dump).
# byte_dump -wt 7 $(type -p bash)
Kevin Day [Tue, 3 Sep 2024 03:59:59 +0000 (22:59 -0500)]
Update: Improve error reporting resulting from unsupported file formats.
The file is either an unsupported format or has syntax errors.
Provide a more human-friendly error message rather than the default catch-all error with a status code.
Kevin Day [Mon, 2 Sep 2024 20:17:19 +0000 (15:17 -0500)]
Update: Implement Object alignment and trim expanding in FSS Read programs and restructure the program flags.
The program flags for the standard-specific functionality vs the program arguments were previously stored in the same bit space.
This breaks the two parts into the main program flags and the "feature" flags.
Implement support for new functionality where the Object structure can be optionally preserved.
Implement support for new functionality where the tabbing of the Object can be preserved, even when trimmed.
This is a step towards a "pretty print" mode that is more or less an "original print" mode.
The tabbing structure is now well preserved for standards like FSS Extended List (FSS-0003).
The Object alignment can determined from the Object close.
Use the `closes` structure to identify how the Object end is tabbed.
Then use that tabbing for the Object.
When trimming is enabled, still apply that tabbing.
This is done only for standards where such behavior makes sense.
The original print is now better preserved.
Printing an Object can now print the before and after Object characters (usually white space).
The trimming and original print may be used together to produce the results where the is no white space before or after the Object but everything else from the original source is preserved.
This combination of trim and original essentially ensure that the old behavior can be still produced.
I would further note that the processing of the FSS Embedded List (FSS-0008) Objects is not recursively performed.
No trimming or anything like that is applied at this time.
Only the selected depth is recursed into such that the Object and Content are processed.
I made this decision to keep the design as simple as possible.
Should I get the motivation and the time, then I may at some point in the future decided to recursively process and format all of the embedded structures.
I happened to notice duplicate and unused flags.
These are now removed.
Update the runtime tests accordingly.
Add new runtime tests to test the updated behavior.
I used the 0.6 and 0.7 to test these and I compared the results.
There is a discrepancy in some of 0.6 and 0.7 tests.
I will have to follow this commit with additional test fixes as necessary pending further review.
Kevin Day [Sat, 31 Aug 2024 23:43:50 +0000 (18:43 -0500)]
Update: The FSS Lists (FSS-0002, FSS-0003, FSS-0008, etc..) to match recent specification changes and reduce redundancy.
Update the Object read functions to be in compliance with the latest specification changes.
Review and update the code, fixing any observed problems and perform some clean ups.
I noticed that several of the list functions for Object read are almost identical.
Move this logic into into a shared private function to reduce repeated code.
The runtime tests are also updated.
I still need to review the Content read functions.
I probably may be able to also find similar, if not identical, code for the list write functions as well.
I will review the code and create a private function similar to what is done here if deemed possible and reasonable.
Kevin Day [Fri, 30 Aug 2024 02:23:17 +0000 (21:23 -0500)]
Update: The FSS-0002 and FSS-0003 standards, modifying the space after Object rules.
My previous changes did not alter the behavior of the standard.
I spent some time considering this and decied that I should make this change.
The new behavior is that white spaces after the last printable character (aka "graph" character) in a valid Object is no longer considered part of the Object.
I decided to do this because supporting the space after the Object but not the space before the Object is awkward and also makes Object name matching more difficult.
One of the pillars of this project is "human first".
Doing this change makes it easier for a human to use by relaxing the exactness of a match when it comes to white spaces before or after a valid Object.
The specifications specifically include optionally supporting untrimmed Objects that include the white space before or after the Object to help accommodate the previous behavior.
I do not want to add quote support in the Object names here to keep it simple.
This new behavior seems to be a good compromise.
Kevin Day [Thu, 29 Aug 2024 03:25:33 +0000 (22:25 -0500)]
Update: Clarify the FSS-0002 and FSS-0003 standards regarding the white space before and after a valid Object.
I updated my 0.7 code and back ported some of the generated runtime tests.
I discovered problems and realized that the standard could be more clear according to the spaces before and after the Object.
This does not change the FSS-0002 and FSS-0003 standards in any functional way.
The simply clarifies the standard regarding the spaces to make it more clear and reduce the chances for a mistake.
Kevin Day [Wed, 28 Aug 2024 03:26:32 +0000 (22:26 -0500)]
Progress: Continue working on getting FSS Embedded Read working.
The runtime tests currently pass but I am not done with the changes.
Fix several problems with the Embedded List processing from fl_fss.
- The comments are now being handled correctly along with the `close`.
I noticed that the `--columns` could be opposing `--object` and `--content`.
This would make more sense as the combination of `--object` is meaningless.
I could also just throw a parameter error the `--columns` cannot be used with `--object`.
Then I could update the runtime tests to make more sense regarding the combination of `--object` and `--columns`.
Kevin Day [Tue, 27 Aug 2024 04:22:59 +0000 (23:22 -0500)]
Progress: Continue working on getting FSS Embedded Read working and tweak allocations.
The extended list needs a separate parameter and make the `line_start` match the `newline_last` at the start of the function.
Record `newline_last` and `line_start` whenever possible once a new line is found.
Use the variable `comment_start` to make the purpose more clear.
The `closes` array should be initialized before calling `fl_fss_extended_list_content_read()`.
Make sure the `closes` array value is reset when the Content is not found.
Make sure the `closes` array used length is incremented.
The FSS Read functions now handle printing the close strings.
I am now considering adding an `open` variable.
Doing this would then merit moving most things into the `f_fss_item_t`.
Tweak some of the allocations in other FSS functions for allocations that need explicit sizes (`f_memory_array_increase_by()`).
Kevin Day [Sun, 25 Aug 2024 22:07:47 +0000 (17:07 -0500)]
Progress: Continue working on getting FSS Embedded Read working and also add Object close support.
This starts the work for the handling of the depths.
I noticed the tests now pass despite the depths being incomplete.
Looks like I need to add some runtime tests for depths for both 0.6 and 0.7.
This brings in the runtime test expects from the 0.6 branch.
I have some brain storming to do so that I can determine how I want to handle the depth processing logic.
I decided that now is a good time to add support for the Object close.
This is to address the problem where I cannot print the original Object close for FSS Extended List and FSS Embedded List.
The reason being that the necessary data is not actually recorded.
I have not yet updated the unit tests.
I have not yet did any actual tests to confirm that this works.
I have not yet actually utilized this in the FSS Extended List Read and FSS Embedded List Read programs.
I have only made the low level changes and made sure everything compiles.
Kevin Day [Sat, 24 Aug 2024 03:18:33 +0000 (22:18 -0500)]
Progress: Continue working on getting FSS Embedded Read working.
I noticed that I forgot that I had intentionally set the size of the static array to 777 to try and trigger any problems.
I forgot about that and committed this in my previous progress commit.
This is now restored to a valid value.
This adds additional checks to the quotes and delimits arrays.
These are used in such a way that they much match the length of the Objects and Contents.
The current, incomplete, design with the FSS Embedded Read is copying over the Objects and Contents but has not yet properly set the delimits and quotes.
This exposes that there needs to be explicit checks between the loosely associated Objects and Contents with the delimits and quotes.
I noticed that the `--object` should always result in showing things even if the `--select` number is infinitely large but does not.
This is now fixed so that it always does this.
The runtime tests are updated as appropriate.
Kevin Day [Thu, 22 Aug 2024 04:15:13 +0000 (23:15 -0500)]
Progress: Begin working on getting FSS Embedded Read working.
The FSS Embedded Read is not working because nothing is actually implemented.
The problem is that the Nest structure is different from the standard Object and Content structure.
Only a single depth is to be processed.
This means that I can construct an Objects and Contents from the Nest based on the depth and pass that to the existing functions.
The initial work has been started but it is very much incomplete.
There is a lot of work to do in this regard.
Kevin Day [Wed, 21 Aug 2024 01:10:55 +0000 (20:10 -0500)]
Update: The runtime test files for FSS Embedded Read.
Update these based on the 0.6 branch that currently works.
I neglected this format during the transition and the FSS Embedded Read is currently non-functional.
The runtime tests should fail in most cases.
I will follow this change with the appropriate fixes once I identify and solve the problems.
The '}' gets printed on empty Content, which is invalid.
Set the range to out of range when the start position is the line start.
This should only happen for empty Content because valid Content is only closed when '}' is on its own line.
Move the internally managed allocation into externally managed allocation.
This allows for better memory control and optimization by the caller.
The use of `f_memory_array_increase()` is incorrect in several cases.
Switch to `f_memory_array_resize()`.
Add 2 when resizing to account for the depth position but also an additional element as a minor memory allocation optimization.
Get rid of headers that should not be included.
This does not address any of the other problems with the FSS Embedded Read functions.
Kevin Day [Sun, 18 Aug 2024 01:09:30 +0000 (20:09 -0500)]
Update: Improve FSS Read function correctness based on runtime unit tests.
This improves the runtime unit tests to be more correct as per the standard.
The standard allows for spaces after an Object.
There is no reason to print these extra spaces.
Add additional logic to better handle this behavior.
The FSS Basic Read and FSS Extended Read should not print this extra space after the Object when there is no Content to be printed.
The pipe mode should wrap empty Content with the start and end pipe characters.
This pope mode is still not well tested (or reviewed) and will eventually need further review and runtime tests.
The handling of `--empty` should only apply to when there is empty Content and not when there is no Content at all.
This adds new callback and flags to better handle these situations.
Update the `verify.sh` script (and associated `testfile`) to print the test name.
Update the `generate.sh` and `verify.sh` scripts to safely pass arguments with spaces using `"$@"`.
Kevin Day [Mon, 12 Aug 2024 02:51:40 +0000 (21:51 -0500)]
Bugfix: FSS Read functions are not handling the --columns and --empty properly.
When the `--columns` is specified, then the max columns should only be calculated if the used array size is greater than zero.
In addition, if the `--empty` is not specified, then the columns must also have non-empty Content.
For single Content standards, such as with `fss_basic_read`, the max was always being set to one even if the `contents.used` is zero.
This change will need to be back ported.
This includes updates to the runtime tests.
I still need to do some in-depth review.
I overlooked a situation during the release of the 0.6.11 branch regarding the `--empty` or lack thereof.
I will likely have to fix a bug and update all of the runtime tests in the 0.6.11 for the FSS Read programs.
Kevin Day [Sun, 11 Aug 2024 21:45:02 +0000 (16:45 -0500)]
Bugfix: Incorrect runtime tests for FSS Read programs.
I mass updated the FSS Read tests in the 0.7 branch.
I chose the quick route of just using the program to generate the tests.
This requires that I trust the results to be correct.
I figured I would eventually go through each one and make sure that they are correct at a later time.
It is a development branch, after all.
However, back porting these tests to the stable 0.6 branch revealed some bugs.
I reviewed the failing tests and files and I confirmed that the 0.6 branch is getting correct results and that the tests are incorrect.
The runtime tests in the 0.7 development branches will have to be updated and the bugs there will have to be fixed.
Kevin Day [Sat, 10 Aug 2024 03:54:14 +0000 (22:54 -0500)]
Update: Add comments in some of the fss_read runtime tests.
These comments should not end up in the results and so only the source files are changed.
This should help increase the chances of catching an fss_read bug for the particular standard.
The specific comments added would otherwise be valid Object and Content data except for being commented out.
Kevin Day [Tue, 6 Aug 2024 03:12:48 +0000 (22:12 -0500)]
Security: Missing range checks on comment processing.
The fss_payload_read such as the runtime test is wrong:
# fss_payload_read -ocn payload level_3/fss_read/tests/runtime/fss_000e/source/test-0002-mixed.fss -t
The output is 1 but should instead be 4.
# fss_payload_read -ocn payload level_3/fss_read/tests/runtime/fss_000e/source/test-0002-mixed.fss | wc -l
Investigating this problem revealed that the comment handling code is failing to perform a range check.
The overflow is causing the stop range to point to some random memory address which is almost always larger than the file.
This results in the count being wrong.
This bug is a security concern.
Add the range check in all places where this range check is missing for the comments.
Add additional runtime tests to reflect the condition that exposed this issue.
There is now a "payload" test for all runtime tests.
Update the testfile to make manually generating and verifying the runtime tests easier.
The "generate" and "verify" fakefile operations could not be directly called due needing additional data setup.
Also expose the "test-" setting as a parameter to make changing it easier.
I also overlooked some cases where I could perform the same optimization used for the referenced commit in some places.
Also use the literal ASCII characters rather than the strings.
The ASCII codes are required and expected and substitution of the characters for the algorithm do not make sense here.
These are characters rather than strings.
Kevin Day [Mon, 5 Aug 2024 01:14:19 +0000 (20:14 -0500)]
Bugfix: Incorrect settings in the fss_read runtime tests.
Several of the tests are "object" tests but use "content" data.
Some tests are both "object" and "content" tests but do not use both.
This is now updated, however there are too many tests to update and fix.
The output is simply re-generated, which to forces a success (even if they should fail).
I need to come back at a later time and review the output.
There are some known problems such as:
# fss_basic_list_read -oc -n hi -t level_3/fss_read/tests/runtime/fss_000e/source/test-0002-mixed.fss
Which results in a wrong count.
# fss_basic_list_read -c -n hi -t level_3/fss_read/tests/runtime/fss_000e/source/test-0002-mixed.fss
vs
# fss_basic_list_read -c -n hi level_3/fss_read/tests/runtime/fss_000e/source/test-0002-mixed.fss | wc -l
Historically the step was always 3.
I found, over time, that increasing the step greatly to something like 128 could greatly reduce memory consumption and performance in many cases.
In the situation where a large number of small objects are allocated then this number like 128 becomes highly abusive.
The simple low allocation step will only allocate a single unit on the very first allocation.
If the next allocation is on an array that has a size greater than one and less than four (via the tiny define), then the step size is set to four during allocation.
If the next allocation is on an array that has a size greater than four and less than eight (via the small define), then the step size is set to eight during allocation.
If the next allocation is on an array that has a size greater than eight and less than sixty-four (via the large define), then the step size is set to sixty-four during allocation.
In all cases, if the request step is less than the calculated step, then the requested step is used.
For example, if the requested step is twelve, then after eight is allocation, then the next generated step size is twelve rather than sixty-four.
Using some test files, shows the following reduction:
- Old: ~8GB of RAM -> New: ~200MB of RAM.
- Old: ~500MB of RAM -> New: ~20MB of RAM.
Update the unit tests accordingly and fix any problems exposed.
Kevin Day [Sun, 4 Aug 2024 00:40:49 +0000 (19:40 -0500)]
Update: Optimize away the isdigit(), isalpha(), isalnum(), and isxdigit().
I did some research and learned that the "is*()" functions can greatly affect performance due to locale and other manners.
I originally used these to allow for well established optimization to take place.
Replace these with some mathematical operations that should increase performance.
This also means no function call on the stack.
This project is already function stack heavy by design and so reducing functions when easy is a great thing.
Start using literal characters rather than the standard strings for the UTF related functions.
In these cases the ASCII expectation is guaranteed.
The ability to override these is also not practical as the meaning should not change.
I have not looked at all of the "is*()" functions and I may address any remaining ones at a later time.
I potentially may also investigate mapping tables to further improve performance.
These math calculations can be used in a lot of the non-ASCII UTF ranges as well.
I opted to not do these just yet given that such work will take a large amount of time.
I have not done any performance analysis yet but I plan to do so.
Kevin Day [Sat, 3 Aug 2024 00:43:04 +0000 (19:43 -0500)]
Bugfix: The private_f_abstruses_delete_switch() and private_f_abstruses_destroy_switch() both need wrapping defines.
The previous commit a2e1999a3e5c02a980fcbe9977b059c4639ea741 has a wrong define wrapper added.
The _di_f_abstruses_delete_ was added when it should instead be _di_f_abstruse_map_delete_.
The private_f_abstruses_destroy_switch() is also overlooked by that commit.
This adds the _di_f_abstruse_map_destroy_ to the private_f_abstruses_destroy_switch().
Kevin Day [Thu, 1 Aug 2024 02:33:32 +0000 (21:33 -0500)]
Bugfix: Add stage setting to standards to prevent build state file conflicts.
The build state stage files are conflicting in some cases.
The old solution to this problem has been observed as insufficient.
The different build settings might have the same exact file name.
I have tossed around the idea of a settings Object such as "stage" in the past but I had previously opted against it.
I now believe that skipping over this was a mistake.
Add a new feature to the standards to fix this bug.
The "stage" value may now be specified.
The fakefile files accept the "stage" setting and passes the result along to any build settings.
The settings files accept the "stage" setting and uses the value by appending it to the stage files.
Only a single value is supported.
The forward and backward slashes are explicitly prohibited.
Other special characters are recommended to be avoided given the possibility of local file system problems.
Rather than erroring out, this slashes are stripped out.
The bootstrap.sh script is updated to support this.
The support for "stage" in the boostrap.sh script is very limited.
Kevin Day [Wed, 31 Jul 2024 02:45:20 +0000 (21:45 -0500)]
Refactor: Change bit-wise enumerations into defines.
I did some reviewing of how the enumerations used for flags are used.
These generally are not being used as a type.
An enumeration slightly increases the resulting binary size.
Enumeration values might be limited to just type of int.
This seems like an easy (small) optimization to just use defines rather than enumerations for flags and other bit-wise numbers.
Kevin Day [Sun, 28 Jul 2024 22:18:07 +0000 (17:18 -0500)]
Update: The format sentence end strings, making their usage more clear.
The sentence ends, unlike the other similar global static strings, does not have the "_single" in the name.
Add the "_single" in the name and then for consistency addthe case where there should be no "_single".
These cases are as a result now handled:
- ".%r".
- "'.%r".
- "%[.%]%r"
- "%['.%]%r"
- "%[%[.%]%]%r"
- "%[%['.%]%]%r"