Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

disallow nullptr as pool layout? #1194

Open
lukaszstolarczuk opened this issue Aug 12, 2021 · 1 comment
Open

disallow nullptr as pool layout? #1194

lukaszstolarczuk opened this issue Aug 12, 2021 · 1 comment
Labels

Comments

@lukaszstolarczuk
Copy link
Member

libpmemobj allows using NULL as a proper layout for pool create/open.
In libpmemobj-cpp, when we provide nullptr as layout` we get (at runtime):

basic_string::_M_construct null not valid

I believe we should fix this - either check for nullptr and exit gracefully or, as in libpmemobj, use an empty layout.
Of course, we have to add a test and extend docs, after that.

In general, pool class documentation is written a bit poorly - it lacks lots of information (which for us are trivial, but are missing for users, who may not read PMDK's manpages before). We should, the very least, add a link to manpage: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_open.3

@igchor
Copy link
Contributor

igchor commented Sep 8, 2021

Well, libpmemobj-cpp version takes std::string and constructing std::string from nullptr is UB. Maybe just using "" (an empty string) would be a better alternative?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants