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

Fix --keep-foreign when the target is missing completely #109

Merged
merged 2 commits into from
May 15, 2023

Conversation

jamacku
Copy link
Member

@jamacku jamacku commented May 15, 2023

Resolves: #2203820

isLink returns non-zero value when a file is a symlink. However,
the old code also returned -1 when lsat failed.

(cherry picked from commit c55ba54)
Normally alternatives will only refuse to create a link to /etc/alternatives/*
if the file already exists and is not a symlink. But alternatives never
checked if existing symlink goes to /etc/alternatives/.

This is a weird behavior, but we did not want to change the default
behavior so we added --keep-foreign option that is more strict and
checks that the target if the symlink is in /etc/alternatives/.

But we missed the corner-case where there is no file at all and
incorrectly reported on error.

Fixes fedora-sysv#102

(cherry picked from commit bd9b6cc)
@jamacku jamacku added the RHEL8 label May 15, 2023
@jamacku jamacku merged commit 9d90121 into fedora-sysv:rhel8-branch May 15, 2023
3 checks passed
@jamacku jamacku deleted the fix-keep-foreign branch May 15, 2023 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants