if hash_action in src/lib/libc/db/hash.c is called with HASH_DELETE, it will NOT return 1 if the key is not found as documented. Fix: in hash_action if the key is not found, the default action is to return -1. HASH_GET needs to be moved below HASH_DELETE and HASH_DELETE should return 1 instead of -1. PR misc/42422 needs to be fixed also if dbm_delete is work properly. Please see freebsd-hackers for email from me for the patches. How-To-Repeat: call dbm_delete from ndbm with a non-exist key. it will return -1 instead of 1 as documented.
Hello, Attached is a patch to correct this bug. GB -- GB Clark II | Roaming FreeBSD Admin gclarkii@VSServices.COM | General Geek CTHULU for President - Why choose the lesser of two evils?
Created attachment 153230 [details] Updated patch Here is a patch easier to read in bugzilla. Note that the current behavior is similar to the other BSD's and the db version carried kerberos in Illumos, so it might be that it's just the documentation that needs to be updated.
For bugs matching the following conditions: - Status == In Progress - Assignee == "bugs@FreeBSD.org" - Last Modified Year <= 2017 Do - Set Status to "Open"
As I can see from the code and / or attached patch hash_access() with HASH_DELETE parameter when the key is not found already returns 1 - that's the value of ABNORMAL macro: /* Return values */ #define SUCCESS (0) #define ERROR (-1) #define ABNORMAL (1) so the patch is actually no-op.