You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@brlcad do you have any insights about the design intent here? Is rt_db_put_internal expected to work in this case?
Thank you for your attention.
I think most people would expect it will work unless it is explicitly documented, since... I mean, literally, why not?
As a matter of fact, I found this while using libged with inmem db.
It seems that libged can work with inmem db by giving "inmem" and the address of db_i pointer as arguments.
However, as soon as I attempted to make a geometry with "make" command, this failed because of this.
As I mentioned in the issue, I can use wdb_put_internal() but this is not possible when interop with libged because the rt_db_put_internal() call is done in libged side.
@bylee20 it's basically a bug. As you note, it could/can work, so why not. It should work. The practical issue is just that all the API code paths (and there's dozens of paths for this particular one) for reading and writing in-mem databases were narrowly developed for specific features, so more work is needed in other areas that are not yet exercised by an end-user feature.
I have created empty database with db_create_inmem() and It seems that
rt_db_put_internal()
does not work with inmem database.Here's my test code:
If you execute this code, you will see error message:
I did short grepping and found that this error comes from:
brlcad/src/librt/db5_io.c
Lines 767 to 773 in 02ba341
which is result of failure of
db5_realloc()
call and again, this failure is originated from:brlcad/src/librt/db5_alloc.c
Lines 135 to 141 in 02ba341
Here,
db_dirbuild()
call always fails for inmem database because of this check:brlcad/src/librt/db5_scan.c
Lines 387 to 389 in 02ba341
Since dbip is for inmem database, the file pointer will be always null and db_dirbuild() never work.
I also found that wdb_put_internal() works fine with inmem database.
Is this by design or a bug? Or, did I do something wrong?
The text was updated successfully, but these errors were encountered: