Skip to content

Various repository fixes #146

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alexlarsson
Copy link

These were broken out from: #144

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Looks sane to me as is, just nits

format!("{}{}", prefix, rand_string)
}

pub fn replace_symlinkat(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think unit tests for this would be pretty easy to add too

let category_fd = self.openat(category, OFlags::RDONLY | OFlags::DIRECTORY)?;
let category_fd = match filter_errno(
self.openat(category, OFlags::RDONLY | OFlags::DIRECTORY),
Errno::NOENT,
Copy link
Collaborator

Choose a reason for hiding this comment

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

BTW I maintain https://docs.rs/cap-std-ext/latest/cap_std_ext/dirext/trait.CapStdExtDirExt.html#tymethod.open_dir_optional

We had some previous debates about using cap-std here. I (obviously) like it a lot.

filter_errno makes sense as is but it'd probably be good to have a higher level openat_optional wrapper per above.

Copy link
Collaborator

@allisonkarlitskaya allisonkarlitskaya left a comment

Choose a reason for hiding this comment

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

Just minor changes from me too

Errno::NOENT,
)
.context("Opening {category} dir in repository")?
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is begging for a

let Some(category_fd) = ...? else {
    return;
}

}
}

Err(Errno::EXIST)
Copy link
Collaborator

Choose a reason for hiding this comment

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

That could probably use some context...

@alexlarsson
Copy link
Author

What happened with the commit description?

@allisonkarlitskaya
Copy link
Collaborator

Uh. There's very clearly some rebase fail here, sorry :(

alexlarsson and others added 3 commits June 19, 2025 11:02
For example, if there has been no streams created, we don't want to
fail with some random ENOENT.

Signed-off-by: Alexander Larsson <[email protected]>
Naming a new version of an image the same as the old version is pretty
standard, and this is currently giving EEXIST errors. We fix this by
doing an atomic symlink + rename operation to replace the symlink if it
doesn't already have the expected value.

Drop our existing Repository::ensure_symlink() function and use the new
function for that as well.

Co-authored-by: Alexander Larsson <[email protected]>
Signed-off-by: Alexander Larsson <[email protected]>
Signed-off-by: Allison Karlitskaya <[email protected]>
This adds error context when opening images and streams. Without
this it is kinda hard to figure out what ENOENT really means.

Signed-off-by: Alexander Larsson <[email protected]>
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.

3 participants