Skip to content

Panic in multiple situations #3

Description

@jackyzjk

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:

  • first
thread 'main' panicked at 'unknown flag', /home/jicky/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-be2141875385cea5/nut-0.1.1/src/consts/mod.rs:55:18
stack backtrace:
   0:   0x4c1f14 - <unknown>
   1:   0x466c8c - <unknown>
   .....
  • second
thread 'main' panicked at 'range start index 36864 out of range for slice of length 32768', /home/jicky/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-be2141875385cea5/nut-0.1.1/src/db/db.rs:731:59
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions