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 #104

Merged
merged 2 commits into from
Apr 13, 2023

Conversation

lnykryn
Copy link
Member

@lnykryn lnykryn commented Apr 9, 2023

No description provided.

alternatives.c Outdated Show resolved Hide resolved
lnykryn added 2 commits April 13, 2023 12:50
isLink returns non-zero value when a file is a symlink. However,
the old code also returned -1 when lsat failed.
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
Copy link
Member

@jamacku jamacku left a comment

Choose a reason for hiding this comment

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

LGTM, Thank you for the fix.

@jamacku jamacku merged commit bd9b6cc into fedora-sysv:main Apr 13, 2023
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.

Weird behavior when --add-slave and --keep-foreign used together for active alternative
2 participants