kuzudb / kuzu

Embeddable property graph database management system built for query speed and scalability. Implements Cypher.
https://kuzudb.com/
MIT License
1.07k stars 77 forks source link

[cli]: Trailing slash in Kùzu db path causes IO exception #3363

Closed prrao87 closed 3 weeks ago

prrao87 commented 3 weeks ago

When creating/connecting to a Kùzu database in the CLI, adding a trailing slash in the path to the DB causes an IO exception (it shouldn't, the path is valid).

Example for creating a local DB called testdb

.$ /kuzu_shell ./testdb/ 
Opened the database at path: ./testdb/ in read-write mode.
Enter ":help" for usage hints.
IO exception: Failed to create directory ./testdb/ due to: IO exception: Directory ./testdb/ cannot be created. Check if it exists and remove it.

Expected behaviour is that the DB directory is created without errors.

acquamarin commented 3 weeks ago

I think it is a bug in libc++ as described here: https://github.com/llvm/llvm-project/issues/60634 Reason: std::filesystem::create_directories("./testdb/ ") returns a failure, even when succeeding. From strace, I can see the lib implem considers ./testdb/ to be different than ./testdb (2 mkdir, 2 stat). It does mkdir("./testdb/"), which passes, then mkdir("./testdb") which failed (directory exists).