Reeywhaar / nut

Port of Bolt DB in Rust
MIT License
44 stars 7 forks source link

Panic in multiple situations #3

Open jackyzjk opened 11 months ago

jackyzjk commented 11 months ago

I have use nut to open three different boltdb config files which generate by Go language, I only read data with transaction, the code like this:

fn main() -> Result<(), Box<dyn std::error::Error>> {
        let db = DBBuilder::new("config.db").read_only(true).build()?;
        let tx = db.begin_tx()?;
        let b = tx.bucket(b"name")?;
        let Some(value) = b.get(b"key") else {return Err(Box::new(Error::new(ErrorKind::Other, "can't get key from bucket"))); };
        println!("{:?}", value);
        Ok(())
}

but there were several panic when I read different database file as follows:

Of course, I have also succeeded when I read the third database file.

Reeywhaar commented 11 months ago

It seems that in both cases db file is either corrupted or I missed something when porting. Did you try to open them with bolt db? Which version?

Reeywhaar commented 7 months ago

Second case should be fixed with new version. See #4