This indeed looks like a dupe of 
https://bugzilla.redhat.com/show_bug.cgi?id=1936422 which #1684 was attempting 
to fix. The actual, real transaction (assuming that a `%pretrans` scriptlet 
removing the old symlink is present) does the right thing, this is just about 
the *test* transaction (which DNF/YUM perform) where it fails.

A minimal package reproducing the issue:
```
%bcond_with new

Name: symlink
%if %{with new}
Version: 2
%else
Version: 1
%endif
Release: 1%{?dist}
Summary: Symlink conflict test
License: GPL

%description
%{summary}.

%if %{with new}
%pretrans -p <lua>
path = "/opt/symlink/bar"
st = posix.stat(path)
if st and st.type == "link" then
  os.remove(path)
end
%endif

%prep
%build
%install

mkdir -p %{buildroot}/opt/symlink/foo
echo hello > %{buildroot}/opt/symlink/foo/blah

%if %{with new}
mkdir -p %{buildroot}/opt/symlink/bar
echo new > %{buildroot}/opt/symlink/bar/blah
%else
ln -s foo %{buildroot}/opt/symlink/bar
%endif


%files
/opt/symlink
```

Usage:
```
$ rpmbuild -bb /path/to/symlink.spec # builds symlink-1-1 package
$ rpmbuild -bb --with new /path/to/symlink.spec # builds symlink-2-1 package
$ rpm -Uhv /path/to/symlink-1-1.rpm
$ rpm -Uhv --test /path/to/symlink-2-1.rpm # this should fail
$ rpm -Uhv /path/to/symlink-2-1.rpm # this should work

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1458#issuecomment-1798570225
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/1458/1798570...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to