Bug 2164207 - Update of python3-ptyprocess fails because file in new version conflicts with file from old version
Summary: Update of python3-ptyprocess fails because file in new version conflicts with...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-ptyprocess
Version: rawhide
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2164693 2164697 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-24 18:49 UTC by Adam Williamson
Modified: 2023-02-10 00:14 UTC (History)
17 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-01-26 16:43:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Adam Williamson 2023-01-24 18:49:14 UTC
nirik and I have observed an odd problem in Rawhide after the mass rebuild, and it's also breaking openQA tests.

Updating from python3-ptyprocess-0.7.0-1.fc38 to python3-ptyprocess-0.7.0-2.fc38 fails, allegedly because a file in the new version conflicts with a file from the old version:

Error: Transaction test error:
  file /usr/lib/python3.11/site-packages/ptyprocess-0.7.0-py3.11.egg-info from install of python3-ptyprocess-0.7.0-2.fc38.noarch conflicts with file from package python3-ptyprocess-0.7.0-1.fc38.noarch

This doesn't seem to make any sense. dnf explicitly says it's doing an upgrade. There doesn't appear to be anything on the system that would cause dnf to try and keep the old version around. But the transaction fails.

There's nothing unusual about the package spec - it just uses the standard Python packaging macros:

https://src.fedoraproject.org/rpms/python-ptyprocess/blob/rawhide/f/python-ptyprocess.spec

compare it with e.g. python-pexpect, which has a very similar spec:

https://src.fedoraproject.org/rpms/python-pexpect/blob/rawhide/f/python-pexpect.spec

and which updates just fine. Here's the full log of an attempt to update python3-ptyprocess:

===

2023-01-24T10:09:45-0800 INFO --- logging initialized ---
2023-01-24T10:09:45-0800 DDEBUG timer: config: 1 ms
2023-01-24T10:09:45-0800 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
2023-01-24T10:09:45-0800 DEBUG DNF version: 4.14.0
2023-01-24T10:09:45-0800 DDEBUG Command: dnf update https://kojipkgs.fedoraproject.org//packages/python-ptyprocess/0.7.0/2.fc38/noarch/python3-ptyprocess-0.7.0-2.fc38.noarch.rpm 
2023-01-24T10:09:45-0800 DDEBUG Installroot: /
2023-01-24T10:09:45-0800 DDEBUG Releasever: rawhide
2023-01-24T10:09:45-0800 DEBUG cachedir: /var/cache/dnf
2023-01-24T10:09:45-0800 DDEBUG Base command: update
2023-01-24T10:09:45-0800 DDEBUG Extra commands: ['update', 'https://kojipkgs.fedoraproject.org//packages/python-ptyprocess/0.7.0/2.fc38/noarch/python3-ptyprocess-0.7.0-2.fc38.noarch.rpm']
2023-01-24T10:09:45-0800 DEBUG User-Agent: constructed: 'libdnf (Fedora Linux 38; generic; Linux.x86_64)'
2023-01-24T10:09:46-0800 DEBUG reviving: 'fedora' can be revived - metalink checksums match.
2023-01-24T10:09:46-0800 DEBUG fedora: using metadata from Sun Jan 22 23:39:20 2023.
2023-01-24T10:09:46-0800 DDEBUG timer: sack setup: 1516 ms
2023-01-24T10:09:46-0800 DEBUG Completion plugin: Generating completion cache...
2023-01-24T10:09:47-0800 DEBUG --> Starting dependency resolution
2023-01-24T10:09:47-0800 DEBUG ---> Package python3-ptyprocess.noarch 0.7.0-1.fc38 will be upgraded
2023-01-24T10:09:47-0800 DEBUG ---> Package python3-ptyprocess.noarch 0.7.0-2.fc38 will be an upgrade
2023-01-24T10:09:47-0800 DEBUG --> Finished dependency resolution
2023-01-24T10:09:47-0800 DDEBUG timer: depsolve: 32 ms
2023-01-24T10:09:47-0800 INFO Dependencies resolved.
2023-01-24T10:09:47-0800 INFO =============================================================================================================================================================================================
 Package                                            Architecture                           Version                                        Repository                                    Size
=============================================================================================================================================================================================
Upgrading:
 python3-ptyprocess                                 noarch                                 0.7.0-2.fc38                                   @commandline                                  35 k

Transaction Summary
=============================================================================================================================================================================================
Upgrade  1 Package

2023-01-24T10:09:47-0800 INFO Total size: 35 k
2023-01-24T10:09:47-0800 INFO Downloading Packages:
2023-01-24T10:09:47-0800 INFO Running transaction check
2023-01-24T10:09:47-0800 INFO Transaction check succeeded.
2023-01-24T10:09:47-0800 INFO Running transaction test
2023-01-24T10:09:47-0800 DDEBUG Cleaning up.
2023-01-24T10:09:47-0800 SUBDEBUG 
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/dnf/cli/main.py", line 130, in cli_run
    ret = resolving(cli, base)
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/dnf/cli/main.py", line 176, in resolving
    base.do_transaction(display=displays)
  File "/usr/lib/python3.11/site-packages/dnf/cli/cli.py", line 246, in do_transaction
    tid = super(BaseCli, self).do_transaction(display)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/dnf/base.py", line 1009, in do_transaction
    raise dnf.exceptions.Error(errstring)
dnf.exceptions.Error: Transaction test error:
  file /usr/lib/python3.11/site-packages/ptyprocess-0.7.0-py3.11.egg-info from install of python3-ptyprocess-0.7.0-2.fc38.noarch conflicts with file from package python3-ptyprocess-0.7.0-1.fc38.noarch

2023-01-24T10:09:47-0800 CRITICAL Error: Transaction test error:
  file /usr/lib/python3.11/site-packages/ptyprocess-0.7.0-py3.11.egg-info from install of python3-ptyprocess-0.7.0-2.fc38.noarch conflicts with file from package python3-ptyprocess-0.7.0-1.fc38.noarch

===

Now here's updating python3-pexpect:

===

2023-01-24T10:10:54-0800 INFO --- logging initialized ---
2023-01-24T10:10:54-0800 DDEBUG timer: config: 1 ms
2023-01-24T10:10:54-0800 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
2023-01-24T10:10:54-0800 DEBUG DNF version: 4.14.0
2023-01-24T10:10:54-0800 DDEBUG Command: dnf --verbose update https://kojipkgs.fedoraproject.org//packages/python-pexpect/4.8.0/14.fc38/noarch/python3-pexpect-4.8.0-14.fc38.noarch.rpm 
2023-01-24T10:10:54-0800 DDEBUG Installroot: /
2023-01-24T10:10:54-0800 DDEBUG Releasever: rawhide
2023-01-24T10:10:54-0800 DEBUG cachedir: /var/cache/dnf
2023-01-24T10:10:54-0800 DDEBUG Base command: update
2023-01-24T10:10:54-0800 DDEBUG Extra commands: ['--verbose', 'update', 'https://kojipkgs.fedoraproject.org//packages/python-pexpect/4.8.0/14.fc38/noarch/python3-pexpect-4.8.0-14.fc38.noarch.rpm']
2023-01-24T10:10:54-0800 DEBUG User-Agent: constructed: 'libdnf (Fedora Linux 38; generic; Linux.x86_64)'
2023-01-24T10:10:54-0800 DEBUG reviving: 'fedora' can be revived - metalink checksums match.
2023-01-24T10:10:55-0800 DEBUG fedora: using metadata from Sun Jan 22 23:39:20 2023.
2023-01-24T10:10:55-0800 DDEBUG timer: sack setup: 434 ms
2023-01-24T10:10:55-0800 DEBUG --> Starting dependency resolution
2023-01-24T10:10:55-0800 DEBUG ---> Package python3-pexpect.noarch 4.8.0-13.fc37 will be upgraded
2023-01-24T10:10:55-0800 DEBUG ---> Package python3-pexpect.noarch 4.8.0-14.fc38 will be an upgrade
2023-01-24T10:10:55-0800 DEBUG --> Finished dependency resolution
2023-01-24T10:10:55-0800 DDEBUG timer: depsolve: 35 ms
2023-01-24T10:10:55-0800 INFO Dependencies resolved.
2023-01-24T10:10:55-0800 INFO =============================================================================================================================================================================================
 Package                                          Architecture                            Version                                        Repository                                     Size
=============================================================================================================================================================================================
Upgrading:
 python3-pexpect                                  noarch                                  4.8.0-14.fc38                                  @commandline                                  155 k

Transaction Summary
=============================================================================================================================================================================================
Upgrade  1 Package

2023-01-24T10:10:55-0800 INFO Total size: 155 k
2023-01-24T10:10:55-0800 INFO Downloading Packages:
2023-01-24T10:10:55-0800 INFO Running transaction check
2023-01-24T10:10:55-0800 INFO Transaction check succeeded.
2023-01-24T10:10:55-0800 INFO Running transaction test
2023-01-24T10:10:55-0800 INFO Transaction test succeeded.
2023-01-24T10:10:55-0800 DDEBUG timer: transaction test: 13 ms
2023-01-24T10:10:55-0800 INFO Running transaction
2023-01-24T10:10:55-0800 DDEBUG RPM transaction start.
2023-01-24T10:10:55-0800 DDEBUG RPM transaction over.
2023-01-24T10:10:55-0800 DDEBUG timer: verify transaction: 36 ms
2023-01-24T10:10:55-0800 DDEBUG timer: transaction: 166 ms
2023-01-24T10:10:55-0800 DEBUG Completion plugin: Generating completion cache...
2023-01-24T10:10:56-0800 DEBUG Upgraded: python3-pexpect-4.8.0-14.fc38.noarch
2023-01-24T10:10:56-0800 INFO Complete!
2023-01-24T10:10:56-0800 DDEBUG Cleaning up.

===

As you can see, everything looks the same, except...pexpect works and ptyprocess doesn't. I cannot see any reason for this at all. The only package that requires ptyprocess is pexpect, and its requirements are:

python(abi) = 3.11
python3-ptyprocess
python3.11dist(ptyprocess) >= 0.5
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsZstd) <= 5.4.18-1

both -13 (the pre-mass-rebuild version) and -14 (the post-mass-rebuild version) have the same deps, and all those deps should be satisfied by either version of python3-ptyprocess. So I can't see any reason why dnf wants to keep the older version around, nor does it log any reason why it would.

If I do `rpm -e --nodeps python3-ptyprocess` then `dnf install` the newer version, afterwards, `dnf check --all` reports no dependency issues.

This is trivial to reproduce in any Rawhide environment with python3-ptyprocess-0.7.0-1.fc38 installed (VM, mock chroot, etc etc) - just do `dnf update https://kojipkgs.fedoraproject.org//packages/python-ptyprocess/0.7.0/2.fc38/noarch/python3-ptyprocess-0.7.0-2.fc38.noarch.rpm` and watch it fail.

Comment 1 Adam Williamson 2023-01-24 23:13:07 UTC
Note, upgrading from python3-ptyprocess-0.6.0-17.fc37.noarch (the current stable version in F37) to python3-ptyprocess-0.7.0-2.fc38 works fine. It only seems to be upgrading from python3-ptyprocess-0.7.0-1.fc38 to python3-ptyprocess-0.7.0-2.fc38 that's problematic.

Comment 2 Kevin Fenzi 2023-01-25 00:39:12 UTC
I think this might be the old 'replace a directory with a file and rpm can't deal with it'. ;(

Comment 3 Adam Williamson 2023-01-25 06:05:42 UTC
Well, possibly, but -2 is just from the mass rebuild; it has no changes from -1 beyond the NVR bump. And also, as per above, the problem doesn't happen when updating from the older 0.6.0-17.fc37 build in F37...

Comment 4 Panu Matilainen 2023-01-25 06:26:09 UTC
Yes, it's the rpm directory replacement problem.

What is baffling here is that why does a simple rebuild cause the egg-info to go from a directory to a single file? The single file egg-info is what the deprecated Python distutils produced, the setuptools replacement creates the newer directory variant. So the change in 1 -> 2 is going in the wrong direction due to some external change as the spec itself did not change except for bump release.

There's a lot of water under the bridge between these two builds, but it does explain the difference:
https://kojipkgs.fedoraproject.org//packages/python-ptyprocess/0.7.0/1.fc38/data/logs/noarch/root.log and
https://kojipkgs.fedoraproject.org//packages/python-ptyprocess/0.7.0/2.fc38/data/logs/noarch/root.log

In 1.fc38 python3-setuptools gets pulled in, in 2.fc38 it doesn't. And so the egg-info format goes backwards.

Reassining to python-ptyprocess because there's absolutely nothing *dnf* can do about this, but python-ptyprocess can be fixed by adding "BuildRequires: python3-setuptools". Not having it will likely cause a build failure with Python 3.12 where distutils has been dropped. But something external had that dependency and now doesn't, so there's a chance there are other packages affected by the same thing. Miro, any ideas?

Comment 5 Adam Williamson 2023-01-25 09:30:53 UTC
Ah, thanks for catching that - interesting. It's something in the dep chain of either python3-pytest or python3-devel that previously required setuptools but no longer does; I'm not sure what, yet.

I've sent a build - https://koji.fedoraproject.org/koji/taskinfo?taskID=96654321 - that should fix this. Instead of adding a dep on setuptools, which upstream doesn't really want to use, I switched to using the more modern pyproject macros, that for this project wind up building it with flit (its preferred build system), and producing a dist-info dir instead of an egg-info file or dir.

Comment 6 Miro Hrončok 2023-01-25 10:46:58 UTC
Packages that are buildable with both distutils and setuptools all have a tendency to this problem. See also https://fedoraproject.org/wiki/Changes/Reduce_dependencies_on_python3-setuptools

The mitigations are:

 [CHAOTIC NEUTRAL] Add BuildRequires for python3-setuptools and hope for the directory to happen.

or:

 [TRUE NEUTRAL] Add BuildRequires for python3-setuptools and put a trailing slash to the .egg-info directory in %files to make the package FTBFS if it is a regular file to assert this never happens again.

or:

 [LAWFUL GOOD] (as Adam did, thank you) Build with modern pyproject macros (and hence have .dist-info directory and no .egg-info -- .dist-info can never be a file).

or:

 [CHAOTIC EVIL] Add a test in %check that assets .egg-info is a file. This breaks with Python 3.12.


Note that with the distutils removal from Python 3.12 we will finally get rid of this problem.





---------------


As far as why this happened:

> It's something in the dep chain of either python3-pytest or python3-devel that previously required setuptools but no longer does; I'm not sure what, yet.

It is python3-py. See

$ repoquery -q --repo=rawhide --requires python3-pytest
(python3.11dist(pluggy) < 2~~ with python3.11dist(pluggy) >= 0.12)
/usr/bin/python3
python(abi) = 3.11
python3.11dist(attrs) >= 19.2
python3.11dist(iniconfig)
python3.11dist(packaging)

Vs

$ repoquery -q --repo=fedora --releasever=37 --requires python3-pytest
(python3.11dist(pluggy) < 2~~ with python3.11dist(pluggy) >= 0.12)
/usr/bin/python3
python(abi) = 3.11
python3.11dist(attrs) >= 19.2
python3.11dist(iniconfig)
python3.11dist(packaging)
python3.11dist(py) >= 1.8.2    <---------  HERE
python3.11dist(tomli) >= 1


$ repoquery -q --repo=fedora --releasever=37 --requires python3-py
python(abi) = 3.11
python3-setuptools    <---------  HERE (possibly redundant)

Comment 7 Miro Hrončok 2023-01-25 10:49:46 UTC
I have one remark to https://src.fedoraproject.org/rpms/python-ptyprocess/c/4e815433c5bad754f66cb97da95c27a34f4c7ea4?branch=rawhide

The Python packaging guidelines require packages to have:

  BuildRequires:  python3-devel

They don't even mention:

  BuildRequires:  pyproject-rpm-macros


Technically, both options work (and both options will produce the same set of BuildRequires at the end) but BuildRequiring the macros instead of python3-devel is a bit non-standard.

Comment 8 Adam Williamson 2023-01-25 17:52:54 UTC
Oh, yeah, you're right. I cargo-culted that over from my fedfind spec, which I think I based on an earlier draft of the guidelines or something. I'll adjust it.

Comment 9 Marek Blaha 2023-01-26 07:27:12 UTC
*** Bug 2164693 has been marked as a duplicate of this bug. ***

Comment 10 Adam Williamson 2023-01-26 16:43:26 UTC
I verified the -3 build does fix this. Thanks again to Panu and Miro.

Comment 11 Orion Poplawski 2023-02-10 00:14:02 UTC
*** Bug 2164697 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.