perl5-dbi / dbi

DBI - The Perl 5 Database Interface
Other
81 stars 58 forks source link

missing abs_path failure handling in DBD::File #116

Closed XSven closed 1 month ago

XSven commented 1 month ago

A misconfiguration of f_dir and f_file has led me to the error

Execution ERROR: -d : No such file or directory at .../DBI/DBD/SqlEngine.pm line 1538

It is the croak call that raises the exception. But the exception message is useless because $searchdir is undefined. $searchdir is undefined because the former abs_path call has failed. This OS failure ($! is different from zreo) was not handled properly. Instead it was shadowed by the following -d file test.

Tux commented 1 month ago

That indeed is DDB::File. Do you have a PR ready to improve on this?

XSven commented 1 month ago

No I have no PR yet. I will have a look at the current DBD::File implementation to identify the strategy to handle exceptions. Then I will try to raise a PR. Do you have any suggestion about the test scrict I could copy and adjust to keep the test coverage as it is today?

Tux commented 1 month ago

The more tests the better: tests are cheap. As DBD::File is the base for all DBD's that rely on files, they should all be tested on the new state (DBD::AnyData, DBD::CSV to start with)

Happy to see you involved in improving overall DBI/DBD experience!

Tux commented 1 month ago

One more Question: did you start from the git checkout? As 12e3b14f54524ca81498f40cfa3678604429b2d6 addressed f_dir

Do you have example code to test with?

XSven commented 1 month ago

No unfortunately not. I have tried to reproduce my wrong f_dir and f_file configuration. Now that I have read more about DBD::File and DBD::CSV it is hard to break things. For now I will close this issue.