Kevin Day [Sat, 18 Mar 2023 01:22:10 +0000 (20:22 -0500)]
Update: Relocate fll_path to fl_path.
I recently noticed that the fll_path has no level 1 dependencies.
I try to keep all projects as low as possible (level_0 being the lowest).
Move fll_paath to fl_path and update everything affected by this.
Kevin Day [Sat, 18 Mar 2023 00:48:45 +0000 (19:48 -0500)]
Progress: Continue program related work, focusing on Featureless Make.
THis mostly addresses comments.
This is a rather annoying and time-consuming process but it is worth it for long term maintenance.
I may have missed something but this should be acceptable.
Kevin Day [Thu, 16 Mar 2023 23:17:26 +0000 (18:17 -0500)]
Update: Add unit tests for fll_path.
I noticed that the '~' path is not expanded.
I checked to see if this is intentional or not.
It is intentionally not supported yet.
I need another function.
This check encouraged me to write some unit tests for the current behavior.
It seems that I had forgotten just how few unit tests I have.
Now there are at least more.
Kevin Day [Mon, 13 Mar 2023 03:12:28 +0000 (22:12 -0500)]
Progress: Continue program related work, focusing on Featureless Make.
This gets Featureless Make compiling again.
The program also appears to work.
I need to now start reviewing the code, fixing non-compile time catching mistakes, resolving any todd or fixme cases, and optimization.
There may also be some directory and file structure manipulation.
Kevin Day [Sat, 11 Mar 2023 02:42:49 +0000 (20:42 -0600)]
Update: Add example contrroller script for running under systemd using cgroups.
This provides an example cgroups setup.
I found that on systems with cgroups2, this is harder to figure out.
This turned out to be because of the existing setup used by many systemd systems.
This provides an example that I managed to get to work under some systems in some circumstances.
The biggest problems is that the subtree needs to be passed along and that tends to not be done by default.
The current user, if not root, usually lacks the privileges to do so.
The best case would be to use the cgroups generation when running as root to setup the appropriate user.
Then, use the program startup examples as the normal user.
This should show the cgroup situation.
I would not be surprised if the cgroup setup scripts has to be altered (not just the user and group name).
Kevin Day [Thu, 9 Mar 2023 05:07:50 +0000 (23:07 -0600)]
Feature: Add support for 'helper' mode to compliment the 'program' mode.
This is a bug fix disguised as a new feature.
When controller runs in program mode and is cancelled, all background (asynchronous) processes are cancelled.
My original thoughts were that background processes should stay open in program mode.
This is the bug being fixed.
I believe that there are use cases to operate in "program" mode and to always terminate the background processes in this manner.
Rather than fixing one case and breaking the other, this is a new feature that helps solve both cases.
The "program" mode operates in the same manner unchanged.
The new "helper" mode operates by detaching background (asynchronous) processes on exit.
The foreground process still runs and blocks normally.
A terminate signal might still terminate background processes.
More work is likely needed in this regard.
This stretches the original design to its limits.
The 0.7.x versions and later will need re-design to better handle these cases.
The original design I used was a learn as I go for thread design.
This resulted in rather messy code.
Now that I made it to this point, the controller program (0.6.x and earlier) can be used as a stepping stone for a better design.
Some of the problems are worked-around.
The program starts and exits too fast in controller mode.
The child processes end up getting terminated before a complete process is started and then backgrounded.
The work-around is to add a short sleep.
This is not reliable but for most cases it should be fine.
Additional work-arounds may be needed by the user such as executig their own sleep foreground process.
Kevin Day [Thu, 9 Mar 2023 02:31:39 +0000 (20:31 -0600)]
Bugfix: Multiple cancellations may occur, use mutex lock to prevent.
There is an existing check that prevents the cancellation from being called more than once.
What is not being considered is that if the main thread calls cancellation while another cancellation is active then the controller_thread_process_exit() gets called.
The controller_thread_process_exit() function will begin more forcibly shutting things down.
Avoid this by providing a mutex lock to lock the cancellation.
Only once the first cancellation is complete will the second (or more) then return without doing anything.
This clarification paved the way for a solution to the bug where lines with unterminated quotes are not getting anything at all.
By "favoring the typo", the rest of the line is preserved and is able to be printed.
Kevin Day [Mon, 6 Mar 2023 03:48:22 +0000 (21:48 -0600)]
Update: Further clarify quoting in FSS specifications.
I looked at the code and realized I should instead favor the "typo" behavior.
Process until the end of the line rather than break up the Object due to the quotes.
This means if the quote is unterminated then the rest of the line is considerd the Object.
Also document where Content utilizes the same rules.
Example Object and Content pair following FSS-0001:
Object "Content".
The Content would be "Content".
This behavior effectively preserves the period and also retains the quotes.
Another example (FSS-0001):
"Object 1" "Content 1" Content2 and_3
"Object 2": Content.
This second row shows the "typo" is favored concept.
The second row has no Content and instead has the following as the "Object: Object 2": Content.
Note how the quotes are kept when this situation happens.
I also updated the word "newline", replacing it with the words "new" and "line".
I noticed and fixed a mistake in the logic due to this refactor and a similar previous refactor.
Kevin Day [Mon, 6 Mar 2023 01:44:35 +0000 (19:44 -0600)]
Update: Clarify FSS specifications in regards to quote behavior.
I noticed a problem where something that is quoted with an immediate character after it does not get processed.
Example Object and Content pair following FSS-0001:
Object "Content".
In the above example, notice how there is a period after the quotes.
Also notice how the content has no spaces.
The current behavior would treat the "Content". as invalid.
I reviewed the specifications and found them lacking in regards to this dilemma.
I updated the specification to clarify the behavior.
With this change the FSS read functions will need to be updated.
Another example (FSS-0001):
"Object 1" "Content 1" Content2 and_3
"Object 2": Content.
In the above example for an FSS-001, the first row is straight-forward.
The second row is a problem.
Because there is non-white space after the quote, this cannot be treated as a quoted Object.
The behavior would then be to treat this as not quoted.
This means for row two, the object name is: "Object
The first Content is 2":
The second Content is Content.
Kevin Day [Mon, 6 Mar 2023 01:18:01 +0000 (19:18 -0600)]
Feature: Implement wrap support for IKI standard to be compliant with recent changes.
The wrap support for IKI (using open and close brackets '[' (U+005B) ']' (U+005D)) has been recently added to the specification.
This updates the project to be in compliance.
Kevin Day [Sun, 5 Mar 2023 03:52:34 +0000 (21:52 -0600)]
Progress: Continue program work, wrapping up side-track work and diving back into fake.
Update projects to have a print directory in a similar manner as a common directory.
The previously completed and working programs should now be working again.
The side-track changes that I set out to complete in regards to them is now complete.
There is a huge amount of work ahead in regards to Featureless Make.
Continue forward step by step.
Kevin Day [Sat, 4 Mar 2023 06:12:11 +0000 (00:12 -0600)]
Progress: Continue program related work, focusing on
The interrupt function behavior changed and the ampersand should not be passed now.
This is causing a double reference bug.
Explicitly allocate a small amount of memory for console parameters for the default allocation step.
Rename fll_program_standard_signal_state() to fll_program_standard_signal_handle().
Update fll_program_standard_signal_handle() to follow the new handle structure.
Reduce the first and last line functions and function calls.
I've decided to make some more initial assumptions to simplify the code.
Always print the first and last line to message.
This is a behavioral change.
I do not think the first and last line should be printed to error anymore.
This change simplifies the logic significantly.
Add the first printed check flag.
Update print functions.
Update file structure.
Update file documentation comments.
The iki_read and fss_write have more work to do.
Once that is done I need to resume working on Featureless Make.
Kevin Day [Thu, 2 Mar 2023 04:08:50 +0000 (22:08 -0600)]
Feature: The IKI standard now supports bracket wrapping.
I wanted to avoid this and keep IKI as simple as possible.
My recent uses have shown that I must have some sort of word-separator support.
This is the simplest implementation that I can think of at this time.
The brackets do not get escaped, instead the IKI gets escaped.
If there is no closing brracket in the correct spot, then the first bracket is not part of the variable.
The brackets other than the opening at the front and the closing bracket at the end are allowed.
The vocabulary name never includes the open and close bracket.
The following shows the heart of the problem this feature solves:
Consider:
- helloworld:"earth".
What if "world" is the variable name and hello is not supposed to be space separated?
With this featre, now the following is possible:
- hello[world]:"earth"
Note that the following are not valid (that is to say these are not IKI variables):
- hello[world:"earth"
- heloworld]:"earth"
- hello[[world]]:"earth"
Kevin Day [Wed, 1 Mar 2023 06:11:18 +0000 (00:11 -0600)]
Progress: Massive, but incomplete, refactor while originally focusing on Featureless Make.
Working on Featureless Make led to a need to refactor the directory recursion logic.
This led to me finally getting around to what I knew that I would eventually do.
Move the status returns into the state variable and use void returns.
I have had and continue to have mixed feelings about this.
This should, overall, be better long term for allowing more flexibility and fine-tuned control outside the project.
The switch to void returns when having a state variable is done to reduce complexity and confusion over which "status" variable is the correct one.
I would not that I also decided to move the "status" variable onto the state.
I was originally very undecided whether I should do this and had previously opted to keep the "status" and "state" separate.
Making more complicated projects has proven to me that it will be more maintainable just putting the status in the state.
These changes have a cascading effect on most of the project and its programs.
I got most of the projects done but I did not get around to fixing/updating the programs.
As always, with changes this big, look out for regressions and stupid simple mistakes.
The unit tests, once updated, will help find these problems.
The FSS and IKI processing code, however, need more unit tests to better catch problems.
These changes result in having the interrupt handler made more readily available.
Follow up changes will be needed to add more interrupt checks where long running or variable length loops are used.
The passing of "state" also reduces the number of times "f_state_t status" is needed and should reduce memory footprint to some degree.
This has a runtime costs where now in all of these cases a pointer must be resolved to get to the status.
This is to be treated as the cost of the newly provided flexibility.
There are some related file structure changes.
The recursion code has had a lot of redundancy removed.
I did not have a chance to properly review the code.
Manual testing on directory recursion operations like clone and copy will need to be performed.
Kevin Day [Wed, 22 Feb 2023 23:59:01 +0000 (17:59 -0600)]
Bugfix: Control group function is partially outdated and uses incorrect integer.
The F_control_group_path_system_default_s_length should not be used here when progressing the path string.
Use control_group.groups.array[i].used instead.
Kevin Day [Wed, 22 Feb 2023 06:25:23 +0000 (00:25 -0600)]
Progress: Continue work on Featureless Make, focusing on printing.
There might be a problem with any code that prints the error messages as non-errors with these changes.
I need to follow up once I am done with the print re-organization and make sure any non-error error printing still works.
Kevin Day [Tue, 21 Feb 2023 04:24:43 +0000 (22:24 -0600)]
Progress: Continue working on Featureless Make, focusing on printing.
I noticed some odd behavior during this process where the file size of the resulting binary is increasing by as little as 72 bytes per function created.
I experimentally created a "void example_print(void) { }" function and was able to get that 72 number.
Fully populating or using the example_print function did not reduce or noticeably increase the file size.
I gave up experimenting and decided to continue on.
When I got close to wrapping up the print functions in the make, the resulting binary file size suddenly dropped 10k or so at least.
Once that dropped happened the functions no longer appeared to increase file size.
I suspect that there was some sort of weird optimization going on.
Some of the generic print functions in the fake make will probably be moved into the common directory as common print functions.
Kevin Day [Mon, 20 Feb 2023 06:13:37 +0000 (00:13 -0600)]
Progress: Continue work on Featureless Make, focusing on printing.
Relax parameter checks on most of the print functions.
Add check to see if file.stream is set and if not return F_stream_not but not an error.
Make sue similar string checks are consistently used.
This should better allow for more flexible designs around stream and string data.
This eliminates a good amount of parameter checking.
Further simplify printing that has a common structure into more common print function.
This print function may end up being moved to a more common path as I can see printing from other directory trees in Featureless Make utilizing this.
Kevin Day [Mon, 20 Feb 2023 00:56:51 +0000 (18:56 -0600)]
Progress: Continue working on Featureless Make, focusing on printing.
The fll_error_print() and private_fll_error_print() functions now accepts a uint8_t flag instead of a boolean to designate options.
The fallback is still supported.
A new flag "simple" is provided to allow for printing a simpler message (helps avoid ridiculous messages like "Unable to find file, reason: file not found.").
Kevin Day [Sat, 18 Feb 2023 04:41:19 +0000 (22:41 -0600)]
Progress: Continue program related work, focusing on Featureless Make printing.
The console program has a bug where the found bit is not being properly preserved for value matches.
This is happening due to an incomplete refactor from value assignment to bitwise assignment.
Allocate extra space for the terminating NULL.
Print message rather than an error when termination signal is received.
Kevin Day [Wed, 15 Feb 2023 05:25:42 +0000 (23:25 -0600)]
Security: Invalid read or write while expanding operations.
The logic here is non-standard.
The normal logic operates on a pre-allocated basis.
That is, right before accessing the data perform the pre-allocation.
This code operates on the expectation that new variables are only added when conditionally required.
This results in a post-allocation basis where once a variable is known to expand then increment the used variable for the next pass.
The allocation checks need to happen after the increment on used.
There are some cases where this post-allocation is not happening.
This is probably a regression in the very recent bug fixes regarding expanding operations.
Be sure to ensure a clean state after the post-allocation process.
Kevin Day [Tue, 14 Feb 2023 05:12:37 +0000 (23:12 -0600)]
Progress: Continue work, focusing on organizing Featureless Make directory structure.
I am planning on moving all of the print functions into appropriate print source and header files.
While planning this it occurred to me that I first should restructure.
This restructures the code.
Some code has been copied into other files.
This makes the current state rather messy.
Expect follow up commits (eventually) to further clean and organize these.
Expect more files resulting from further clean up and organization.
Kevin Day [Sun, 12 Feb 2023 16:34:25 +0000 (10:34 -0600)]
Feature: Add Turtle Kevux path support.
This does not break API or ABI because it requires macros to be defined that would break it.
These macros, when in use, should not break API (but does extend it) but may break ABI.
The return value may have additional results and might be considered an API but not ABI breaking change.
There is already Kevux-specific code in FLL.
Temporarily continue that process as a short term solution.
In the long term, separate functions or files may be used (or an entirely separate project).
Kevin Day [Mon, 6 Feb 2023 03:01:24 +0000 (21:01 -0600)]
Bugfix: Invalid defines, incorrect comments, missing flags, and missing dependencies.
There is an inconsistency where _di_f_color_string_s_ and _di_f_color_strings_s_ are used.
Settle on _di_f_color_string_s_ because it is defined in the header file.
Incorrect defines, such as _di_f_utf_is_contro_codel_ are removed.
The *.config.h comment example doesn't work.
Consistently add fanalyzer mode and make sure it is available in both settings and fakefile files.
Some of the define macros are missing in regards to private functions.
The controller program is missing f_limit and fl_directory dependencies.
Kevin Day [Tue, 31 Jan 2023 03:01:29 +0000 (21:01 -0600)]
Update: Controller and Control man page documentation.
Move the specification details into man (5) pages.
This further allows for more explicit declaration of the license of the specifications.
The following are the commands used to help generated these man pages:
fss_basic_list_read entry.txt +Q -cn "Entry Specification" | iki_read +Q -w -W code '\fB' '\fR'
Kevin Day [Tue, 31 Jan 2023 02:22:24 +0000 (20:22 -0600)]
Update: Featureless Make man page documentation.
Move the specification details into man (5) pages.
This further allows for more explicit declaration of the license of the specifications.
The following are the commands used to help generated these man pages.
fss_basic_list_read dependencies.txt +Q -cn "Dependencies Specification" | iki_read +Q -w -WWW code '\fB' '\fR' bold '\fB' '\fR' FLL '\fB' '\fR'
Kevin Day [Sun, 29 Jan 2023 23:36:06 +0000 (17:36 -0600)]
Bugfix: The build settings 'path_sources' is incorrectly added.
The commit 79858cf386916fd25ccd3578797de53b16f5c446 fixed a problem with the sources path passed to the program.
This revealed a bug where the build setting 'path_sources' is being added twice.
This is probably why the previous bug was not noticed for so long.
Make sure to apply the passed path sources parameter when the build settings does not have 'path_sources'.
Kevin Day [Sun, 29 Jan 2023 05:31:35 +0000 (23:31 -0600)]
Progress: Continue program related work, with emphasis on Featureless Make.
The common.h and related files are now broken up a little more.
There is now a common-string.h and common-type.h (with matching source files).
This should make it easier to navigate, particularly when there are a lot of functions, strings, and types.
Lots of tedious updates to the Featureless Make.
There are still a lot of structural changes to make.
Add more parameters to Featureless Make to address the documents and the licenses directories.
There is still more work to do with those parameters.
Fix some observed mistakes in the level_0 console code.
Kevin Day [Thu, 26 Jan 2023 04:27:01 +0000 (22:27 -0600)]
Regression: Serial example rule is not working.
Investigation revealed that the commit 002bf17595459e65173be16f983977ead99593b6 introduced a regression where the cached data is being reset incorrectly.
The data is properly processed but when there is more than a single rule the previous rules are being cleared.
Kevin Day [Thu, 26 Jan 2023 01:23:53 +0000 (19:23 -0600)]
Update: Add additional sanity checks.
The GCC -fanalyzer is reporting a problem that as far as I can tell is a false positive.
This program is older code practices and will eventually be rewritten anyway.
Kevin Day [Thu, 26 Jan 2023 00:56:04 +0000 (18:56 -0600)]
Security: NULL pointer dereference in writer due to pipe function result handling.
The GCC -fanalyzer parameter helped me discover this one.
The status_pipe is being read and processed.
There is a case where the status_pipe is being set but it is not being reset after handling.
In a later loop the pipe does not get read but the previously set state is used bringing the code into a bad state.
Then the loop doesn't do the block buffer used check and this results in the eventual NULL dereference.
Kevin Day [Thu, 26 Jan 2023 00:53:39 +0000 (18:53 -0600)]
Update: Add fanalyzer build mode.
I keep forgetting to run the GCC fanalyzer sanity checks to help catch problems before making a release.
Add a formal mode in all of the build settings to make this processor easier and therefore easier to remember.
Add missing -Wall to some of the files for the test mode.
Kevin Day [Tue, 24 Jan 2023 05:32:01 +0000 (23:32 -0600)]
Bugfix: Fakefile processing with color context is producing extra spaces when unquoted.
Do not generate a new argument when calling fake_make_operate_expand_context().
The color context should combine with existing arguments.
This does not handle the last context argument and more work is likely needed to handle that one.
Remove the not quoted check that always generates a new argument.
The FSS Extended should support one or more Content per Object.
All others support the same number of Objects as Content (not referring to nested Content).
The error and error message when this is and is not correctly being handled.
The correct detection needs to count based on sub locations rather than locations.
Kevin Day [Mon, 23 Jan 2023 05:16:55 +0000 (23:16 -0600)]
Progress: Continue program related work and make f_console related changes.
Work on fake and then focus on the relating console changes.
I imported the recent bugfix regarding console arguments (ccd15d4e64848f29d36823ca92ee639057f544b7).
I opted to just copy and paste and then re-convert to the latest practice.
Look out for regressions, but this is development anyway.
I've added it to the console function.
As far as how the main programs declaring and using f_state_t to pass to the console program, I'm not sure how I want to handle f_state.
Kevin Day [Sat, 21 Jan 2023 06:53:38 +0000 (00:53 -0600)]
Progress: Continue program related work, focusing primarily on fake and console parameter handling.
I realized that the new callback console parameter needs to be implemented.
I reviewed the drafted design and changed it accordingly.
I've been able to reduce the need to have a callback for each parameter and have a single callback for the set of parameters.
The documentation for the console parameter callback change is incomplete for this and my next progress should complete this documentation.
I updated several programs regarding the console changes and noticed a small number of bugs in the UTF8 program.
The first line is now being printed, conditionally, but future work may be needed.
Kevin Day [Wed, 18 Jan 2023 03:59:17 +0000 (21:59 -0600)]
Progress: Continue program related work.
This focuses on getting the Featureless Make program to compile.
The settings and functionality is not yet updated so the program is not expected to work yet.
Kevin Day [Sat, 14 Jan 2023 23:13:37 +0000 (17:13 -0600)]
Bugfix: Several problems with the wrapping define macros, unused private functions, and non-existent functions.
The stand alone builds revealed several problems with the wrapping define macros.
The ones that I noticed or were blocking me from compiling have been fixed.
It will be no surprise if there are still more such problems hiding in the code somewhere.
Remove stale and unused private functions.
There is are no f_file_clone_at() and f_file_copy_at() functions.
Remove references and related wrapping define macros.
Kevin Day [Fri, 13 Jan 2023 23:56:06 +0000 (17:56 -0600)]
Bugfix: Incorrect macro definition _di_pthread_support_ vs _di_thread_support_.
The _di_pthread_support_ is used in the project but all of the programs have _di_thread_support_.
The project name is f_thread and not f_pthread so favor _di_thread_support_ over _di_pthread_support_.
Kevin Day [Fri, 13 Jan 2023 04:13:57 +0000 (22:13 -0600)]
Cleanup: Fix license confusion.
The documentation should be under the cc-by-sa-4.0 license.
However, the specification must be under the open-standard-license-1.0 license.
This file is documentation on the time specification.
If the documentation is under another license, the standard it describes must still be followed according to the open-standard-license-1.0 license.
The documentation would have to communicate that the standard it is describing is still under the open-standard-license-1.0 license even if the documentation itself is under a different license.
This creates a confusing and misleading situation.
Clarify the situation by setting the license to open-standard-license-1.0.
Setting the license explicitly to open-standard-license-1.0 should hopefully address any misunderstandings.