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

Ignore result of EvalSymlinks on ENOENT #23167

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

mheon
Copy link
Member

@mheon mheon commented Jul 2, 2024

When the path does not exist, filepath.EvalSymlinks returns an empty string - so we can't just ignore ENOENT, we have to discard the result if an ENOENT is returned.

Should fix Jira issue RHEL-37948

Does this PR introduce a user-facing change?

Fixed a bug where Podman could throw errors about a database configuration mismatch if certain paths did not yet exist on the host.

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 2, 2024
@mheon
Copy link
Member Author

mheon commented Jul 2, 2024

Marking no new tests, we don't test this logic in CI. We probably should, but dealing with on-restart logic like this is hard in CI.

@mheon mheon added the No New Tests Allow PR to proceed without adding regression tests label Jul 2, 2024
} else {
// This is ENOENT.
// We can at least clean the path.
dbValue = filepath.Clean(dbValue)
Copy link
Member

Choose a reason for hiding this comment

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

in what cases would the dbValue path be usable if it doesn't exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

The one we're seeing (and probably the only one that makes sense) is volume path. It's a subdirectory of the c/storage root path that is only created the first time the user creates a named or anonymous volume, so it's possible (admittedly difficult, but certainly possible) to use Podman for months without the volume path being created.

@mheon mheon force-pushed the fix_rhel_37948 branch from 14bbe0a to 2d35a52 Compare July 3, 2024 12:13
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@mheon mheon force-pushed the fix_rhel_37948 branch 2 times, most recently from c7fc5da to 52b8dec Compare July 3, 2024 13:23
Copy link

Cockpit tests failed for commit c7fc5dae487e3d88ebb69d6b718b36e5b24aa12e. @martinpitt, @jelly, @mvollmer please check.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

Given it is basically duplicated code 4 times could you merge this into a helper function?

I am also very confused about how this is supposed to work, overall this whole logic seem to very brittle? Should we re-evaluate whenever checking this is even worth it compared to the bugs caused by this? (Of course not as part of this PR)

@mheon
Copy link
Member Author

mheon commented Jul 5, 2024

Helper function does seem sensible, but we'd have to accept the error message as an argument I think...

On whether this is worth it: In actual usage, it seems quite robust (I can recall only one bug where this code hasn't been properly matching paths, resulting in the addition of the EvalSymlinks that caused this problem). It's probably not completely robust against very strange paths, but I don't think we have folks running Podman in strange root directories like that.

When the path does not exist, filepath.EvalSymlinks returns an
empty string - so we can't just ignore ENOENT, we have to discard
the result if an ENOENT is returned.

Should fix Jira issue RHEL-37948

Signed-off-by: Matt Heon <[email protected]>
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM, I don't really like this check path special case dance there but oh well I don't see a way around it

@rhatdan
Copy link
Member

rhatdan commented Jul 11, 2024

@giuseppe PTAL

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 11, 2024
Copy link
Contributor

openshift-ci bot commented Jul 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 04bd415 into containers:main Jul 11, 2024
90 checks passed
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Oct 10, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. No New Tests Allow PR to proceed without adding regression tests release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants