Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dbm.iter throws Not_found on empty database #2412

Closed
vicuna opened this issue Apr 3, 2000 · 2 comments
Closed

Dbm.iter throws Not_found on empty database #2412

vicuna opened this issue Apr 3, 2000 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Apr 3, 2000

Original bug ID: 76
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: David Clarke
Version: 2.99
OS: Redhat Linix 6.1
Submission from: 203.28.51.70 (203.28.51.70)

Calling Dbm.iter on a database which has no entries results in
a Not_found exception being thrown. This is contrary to the specification.

It throws the exception in the call to "firstkey", as specified.
The following minor change should fix the problem (see the last line)

From dbm.ml:

(* Usual iterator )
let iter f t =
let rec walk k =
f k (find t k);
match try Some(nextkey t) with Not_found -> None
with
None -> ()
| Some k -> walk k
in
(
walk (firstkey t) -- current line *)
try walk (firstkey t) with Not_found -> ()

Thanks
Dave

@vicuna
Copy link
Author

vicuna commented Apr 3, 2000

Comment author: administrator

Thanks for your report.

It is now fixed in the CVS version.
The Db library has been corrected identically.

@vicuna
Copy link
Author

vicuna commented Apr 3, 2000

Comment author: administrator

Fixed in 3.00.

@vicuna vicuna closed this as completed Apr 3, 2000
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant