Bug 1644923 - Potentially un-needed sleep statement
Summary: Potentially un-needed sleep statement
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: python-rpm-macros
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-31 22:17 UTC by William Brown
Modified: 2019-11-27 19:59 UTC (History)
7 users (show)

Fixed In Version: python-rpm-macros-3-39.fc30
Clone Of:
Environment:
Last Closed: 2019-11-27 19:59:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description William Brown 2018-10-31 22:17:25 UTC
Description of problem:
In the py3_build macro there is a "sleep 1" statement on EL7 and fedora. This was added in the following commit:

https://src.fedoraproject.org/cgit/rpms/python-rpm-macros.git/commit/macros.python3?id=af37c2283549ca22bad8ad6abf569eab15eed5b8

After contacting the author of the commit, they have indicated this was to resolve a race condition between py2 and py3 builds. However, they note that there is no related issue because it was before pagure.

Other distros (openSUSE) don't have an equivalent sleep statement. So perhaps the issue is now no longer present. 

It would be great if the sleep statement could be removed and build results checked to see if this affects anything.

Thanks, 

Version-Release number of selected component (if applicable):
python3-rpm-macros-3-37.fc29.noarch
python3-rpm-macros on el7

Comment 1 Petr Viktorin (pviktori) 2018-11-01 09:34:16 UTC
As far as I can recall, there's a race condition involving file timestamps when the py2 and py3 builds are done in the same second. In the install step, files with the same timestamp aren't overwritten, so if the py2 and py3 versions produce the same file (commonly, a command for /usr/bin), and %py2_install;%py3_install is run to install them, the package can, in rare cases, end up with the py2 version not being overwritten by the py3 one.

Here's some discussion on it from Debian land: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548392

> It would be great if the sleep statement could be removed and build results checked to see if this affects anything.

It's a race condition, so it's tricky to check :(
Also the resulting bug is hard to debug, and likely to hit packagers who aren't Python experts. I'd be careful.

Maybe we can remove the sleep for python3 but, to be safe, add it to the beginning of py2_build macros? Those are going away.

Let's not touch EL.

Comment 2 William Brown 2018-11-01 09:42:07 UTC
I think that adding this to the py2_build seems reasonable, but doesn't that rely on the rpm spec listing:

py3_build
py2_build

In that order? If the spec had

py2_build
py3_build

This would just occur again.

So I think it may need to remain then if this is a problem ... 

Thanks for your great explanation about the problem, I really appreciate it.

Comment 3 Petr Viktorin (pviktori) 2018-11-01 09:57:38 UTC
Ah, sorry, I wasn't clear there.
The py2 macros currently also have the sleep at the end. I meant to suggest adding *another* one to the beginning for py2, and removing the one for py3. That way the workaround still works in both orders.
And py2-only builds would be slower -- but those are just 19% of Python packages (with that number going down), and they generally aren't rebuilt very often.

Comment 4 William Brown 2018-11-01 09:59:11 UTC
That sounds like a really good solution, thanks for clearing that up. I'll leave it up to you how you want to handle this bug (close and open issue to pagure, close when py2 macros are changed etc).

Comment 5 Petr Viktorin (pviktori) 2018-11-01 10:30:28 UTC
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/14

Comment 6 Miro Hrončok 2018-11-01 11:01:48 UTC
Petr, nice solution, merged and built in rawhide.

This is an improvement, not a bugfix per se, so I feel no urge to push it to F29 after it has been already released (potentially disturbing packages that built but no longer builds, if we introduce a bug in the code (however unlikely)).

Hence closing as RAWHIDE.

If you really want this in F29, please reopen.

Comment 7 Timothy Redaelli 2018-11-21 22:38:58 UTC
Hi,
this changes slightly the behavior.

Before this patch you could do something like:

LDFLAGS="custom_ldflags" %py2_build
LDFLAGS="custom_ldflags" %py3_build

After this patch you cannot do it (for python2) anymore since LDFLAGS is only passed to sleep instead of "python2 setup.py".

If you think the regression can be a problem, I suggest to revert this.

Comment 8 William Brown 2018-11-21 23:54:03 UTC
Out of curiosity, can you provide an example of where this is currently used in a specfile? This sounds really specific as a solution to a problem, so I think perhaps a localised work around for the situation is better than reverting this change.

Comment 9 Miro Hrončok 2018-11-22 00:14:10 UTC
As an immediate workaround, export the variables:

    export LDFLAGS="custom_ldflags"
    %py2_build
    %py3_build

Comment 10 Miro Hrončok 2018-11-22 00:33:17 UTC
As a workaround on our side, we should be able tu use:

CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" %{__python2} $(sleep 1) %{py_setup} %{?py_setup_args} bdist_wheel %{?*}

Comment 11 Ben Cotton 2019-10-31 20:28:32 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Ben Cotton 2019-11-27 19:59:23 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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