Solitude-Software-Solutions / OstrichDB

WIP | A document-based NoSQL, JSON-esque database for local machine use
Apache License 2.0
29 stars 5 forks source link

CRITICAL: Program does not work properly on Odin Version: dev-2024-09 #121

Closed SchoolyB closed 4 weeks ago

SchoolyB commented 1 month ago

After migrating my primary development environment from Linux to MacOS I decided to also update the version of Odin I use to develop OstrichDB. As of me writing this issue OstrichDB has only been written in Odin version dev-2024-06. After updating versions and migrating OS's, several program breaking bugs have come to light.

Instead of creating a separate issue for each bug found due to this update/migration, this issue will have a checklist of all of them

BUGS After deleting the /bin dir and doing a fresh rebuild and run of the project:

  1. error thrown from the OST_READ_CONFIG_VALUE proc. For some reason the program cannot read the config file even though it is created properly. Subsequently the next error thrown is triggered by this error.

  2. error thrown from the OST_FIND_CONFIG proc. This proc is being call in the OST_FIND_ALL_CONFIGS proc. which in turn is called from the OST_CREATE_CONFIG_FILE proc. This confises me because the file is indeed created but for some reason it cannot be read.

  3. error thrown from the OST_CHECK_IF_USER_ID_EXISTS proc. This is a crazy bug. In this snippet of the procedure

    OST_CHECK_IF_USER_ID_EXISTS :: proc(id: i64) -> bool {
    buf: [32]byte
    result: bool
    openCacheFile, openSuccess := os.open("../bin/secure/_secure_.ost", os.O_RDONLY, 0o666)

    You can see that the proc is trying to make a _secure_.ost file. This file was deprecated for v0.3.0. Before v0.3.0 the all user data was stored within this file but now each user has their own "secure" file. This technically should have been breaking the program for several weeks now but I guess Odin wasnt catching it.

SchoolyB commented 1 month ago

So it seems that the first two bugs mentioned above only occur on the initial startup of the program. After starting it a second time those two errors do not appear. It is possible OstrichDB is trying to read the ostrich.config file before it is created...

After the initial start up a new error is thrown from the OST_GEN_SECURE_DIR_FILE proc. Which is also odd because it did its job correctly and created the secure directory and yet threw an error.....

SchoolyB commented 1 month ago

After modyfing the code a bit to fix the above bugs and successfully starting the program. after creating the admin accouint and restarting OstrichDB the program is re-running the user creation process. Even though the configs OST_ENGINE_INIT value shows true the program is getting an empty string preventing the user from moving forward as intended

SchoolyB commented 4 weeks ago

Mostly fixed for MacOS and Linux