Skip to content

Some small fixes and improvements, update dependencies#69

Open
rustybee42 wants to merge 3 commits intomainfrom
rb/db-init-error
Open

Some small fixes and improvements, update dependencies#69
rustybee42 wants to merge 3 commits intomainfrom
rb/db-init-error

Conversation

@rustybee42
Copy link
Copy Markdown
Collaborator

@rustybee42 rustybee42 commented Apr 21, 2026

See commits.

Closes #67, #70

@rustybee42 rustybee42 self-assigned this Apr 21, 2026
@rustybee42 rustybee42 requested a review from a team as a code owner April 21, 2026 07:41
Comment thread mgmtd/src/main.rs
.ok_or_else(|| anyhow!("File does not have a parent folder"))?,
)?;
std::fs::File::create_new(db_file)?;
conn.backup(rusqlite::MAIN_DB, db_file, None)?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: if conn.backup fails we leave an orphaned empty file that would require the user to manually cleanup before they could run --init again. It would be nice to cleanup on error.

That said I'm not really worried about it, most likely an error from conn.backup() probably indicates I/O or file system errors (e.g., disk full), which are fairly unlikely if we were just able to create the file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's right. Not a big deal, but added it anyway as I couldn't merge the PR without resolving the security advisory.

This gives a more detailed os error on failure compared to the generic
sqlite one and should point the user to the cause of the failure (e.g.
"permission denied").

The used function also fails if the file exists, so the explicit check
can be removed.
@rustybee42
Copy link
Copy Markdown
Collaborator Author

I now also updated all the dependencies to get rid of the security advisory and also improved/fixed some of the config descriptions.

@rustybee42 rustybee42 changed the title fix: Improve db file creation error by explicitly touching the file Some small fixes and improvements, update dependencies Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poor error message when running as non-root

2 participants