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

python-2.7.14: Fix #27177 and #25750 #39555

Closed
wants to merge 1 commit into from

Conversation

timokau
Copy link
Member

@timokau timokau commented Apr 26, 2018

Motivation for this change

I originally wanted to include this in the sage PR, but since a world-rebuilding python PR (#39517 by @dtzWill) was just merged into staging maybe its better to only rebuild all python2.7 packages on linux once.

Python Issue 27177: Regex match.group doesn't support index, only standard integers. This was fixed, but not backported to 2.7. sage needs that because it uses its own integers by default. I tried to monkey-patch around this, but apparently you can't monkey-patch re.

Python Issue 25750 leads to occasional crashes, especially on python 2.7. There is an upstream PR in the making.

As requested previously, there is now a branch with the sage package. This is not yet PR-ready though, contains unneeded patches, duplication, TODOs etc. I will rewrite history on that branch.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@@ -60,6 +60,24 @@ let

./properly-detect-curses.patch

# Fix python bug #27177 (https://bugs.python.org/issue27177)
# The issue is that `match.group` only recognizes python integers
# instead of everything taht has `__index__`.
Copy link
Member

Choose a reason for hiding this comment

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

nit: "taht" -> "that"

# Fix python bug #27177 (https://bugs.python.org/issue27177)
# The issue is that `match.group` only recognizes python integers
# instead of everything taht has `__index__`.
# This bug was fixed upstream, but not backported to 2.7
Copy link
Member

Choose a reason for hiding this comment

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

Do any of the other python versions (3.4, 3.5, ..) in-tree need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, everything <= 3.6 should have this issue. I only applied the patch for 2.7 because I only need it for 2.7 (for sage) and I wanted to minimize rebuilds. Since no 3.4/3.5 software seems to need it, I don't think its strictly necessary. Should I add it to 3.4 and 3.5 anyways?


# "`type_getattro()` calls `tp_descr_get(self, obj, type)` without actually owning a reference to "self".
# In very rare cases, this can cause a segmentation fault if "self" is deleted by the descriptor."
# https://github.com/python/cpython/pull/6118
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, reading that PR suggests this should be applied to all python versions (although it does say backporting to 2.7 is the most important since it's most problematic there).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats true, I also only applied this to 2.7 to minimize rebuilds. But since this is a crashing bug, here it might really be a good idea to add it to all versions. Especially since the other PR triggers rebuilds across all versions anyways -- but that only matters if this gets merged before those builds run (which is a bit optimistic).

Copy link
Member

Choose a reason for hiding this comment

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

Minimizing mass rebuilds isn't really needed, I believe. On staging we have a large rebuild almost every week, and python2 by itself is probably the worst part.

@dtzWill
Copy link
Member

dtzWill commented Apr 26, 2018

I'm not sure, sorry. Hopefully our python maintainer or someone else can lend us some insight or make the judgement call.

@FRidh FRidh self-assigned this Apr 26, 2018
@FRidh
Copy link
Member

FRidh commented Apr 26, 2018

I'm on holidays now and won't be able to review until Monday earliest.

@timokau
Copy link
Member Author

timokau commented Apr 26, 2018

Okay, there is absolutely no hurry. I just wanted to avoid a double rebuild, but rebuilds probably aren't that rare anyways.

Thanks for taking the time out of your holidays to let me know.

@timokau timokau mentioned this pull request May 4, 2018
8 tasks
@timokau
Copy link
Member Author

timokau commented May 6, 2018

@FRidh could you have a look at this? Or do you prefer it to be included in #39981?

Merging this separately would make it easier to review and test #39981.

@FRidh
Copy link
Member

FRidh commented May 6, 2018

Sorry for the wait. This looks good to me. It's a pity the OP of the first one did not push that one further.

@vcunat can you take this into account in the 2.7.15 bump. I've been without broadband for some days now and it looks like it will be for a bit longer.

@vcunat
Copy link
Member

vcunat commented May 6, 2018

This apparently doesn't conflict with #40005 in any way (except trivial conflict in our patch list). Neither issue from this PR seems to have a fix upstreamed to 2.7 yet.

With 2.7.15, I'm not sure about the risks, but perhaps it's safe enough to just merge to staging directly.

@timokau
Copy link
Member Author

timokau commented May 6, 2018

It's a pity the OP of the first one did not push that one further.

Yeah the "well technically not a bug" answer is not very helpful. python2 apparently really is on the last days of life support.

This apparently doesn't conflict with #40005 in any way (except trivial conflict in our patch list).

I guess @FRidh only meant to merge both PRs into staging at the same time.

@vcunat
Copy link
Member

vcunat commented May 7, 2018

Yes, I think so. The real problem in staging ATM is that it already contains several thousand build regressions for weeks, so someone will have to resolve them...

@jdemeyer
Copy link

jdemeyer commented May 9, 2018

It's a pity the OP of the first one did not push that one further.

It was rejected pretty explicitly. No point in fighting a lost battle.

@jdemeyer
Copy link

jdemeyer commented May 9, 2018

For the record: we have been using both patches for quite some time in SageMath without any problems. The first one just adds some functionality which didn't exist before and the second one fixes an obvious bug but doesn't change any functionality.

27177 was merged but not backported to 2.7.
There is currently an open PR for 25750.
@timokau
Copy link
Member Author

timokau commented May 28, 2018

Looks like #40005 is in master now (and can be closed). I have rebased. Can we merge this?

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python

Partial log (click to expand)

shrinking /nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15/lib/python2.7/lib-dynload/_locale.so
gzipping man pages under /nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15/share/man/
strip is /nix/store/92d2ifxcni4n3zx9s8wnkcjlvnx5ajlc-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15/lib  /nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15/bin
patching script interpreter paths in /nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15
/nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15/lib/python2.7/config/makesetup: interpreter directive changed from " /bin/sh" to "/nix/store/m47apl3hq3i52fzy2cz24378p0xn4lyx-bash-4.4-p19/bin/sh"
/nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15/lib/python2.7/config/install-sh: interpreter directive changed from "/bin/sh" to "/nix/store/m47apl3hq3i52fzy2cz24378p0xn4lyx-bash-4.4-p19/bin/sh"
/nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15/lib/python2.7/ctypes/macholib/fetch_macholib: interpreter directive changed from "/bin/sh" to "/nix/store/m47apl3hq3i52fzy2cz24378p0xn4lyx-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/k87hjw6klpxg957mllvh7zvr14hw2v1w-python-2.7.15...
wrong ELF type

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python

Partial log (click to expand)

gzipping man pages under /nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15/share/man/
strip is /nix/store/8yfik687kfccisxnad42j19lfb7ij9b4-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15/lib  /nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15/bin
patching script interpreter paths in /nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15
/nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15/lib/python2.7/config/install-sh: interpreter directive changed from "/bin/sh" to "/nix/store/vnb8q2h7951gd551nm2vq2g6n8296g5b-bash-4.4-p19/bin/sh"
/nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15/lib/python2.7/config/makesetup: interpreter directive changed from " /bin/sh" to "/nix/store/vnb8q2h7951gd551nm2vq2g6n8296g5b-bash-4.4-p19/bin/sh"
/nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15/lib/python2.7/ctypes/macholib/fetch_macholib: interpreter directive changed from "/bin/sh" to "/nix/store/vnb8q2h7951gd551nm2vq2g6n8296g5b-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15...
wrong ELF type
/nix/store/3zc1jxxz3xg93bvsp0gapm9pib9s054l-python-2.7.15

@FRidh
Copy link
Member

FRidh commented May 28, 2018

@timokau I've added it to #41177.

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: python

Partial log (click to expand)

cannot build derivation '/nix/store/x6mzbx1ay2lzi5yjpbn3ymw862711g6f-re_match_index.patch.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/66hngykd2k9pk0wkwvnhm97ys524v1gc-type_getattro.patch.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/66yg6w5crh04v6s2g3859bzwiccsvbba-flex-2.6.4.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/gmrwvzv1bw7012f6zrycvd58gmxradzh-python-2.7.15.drv': 16 dependencies couldn't be built
cannot build derivation '/nix/store/6j60v5b8cs7g33bsa1s72qhkahdxybdj-bootstrap_cmds-dev-tools-7.0.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/jd9xb7lwas4xkyws8m13ynn9lz821rqg-xnu-osx-10.11.6.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/n5c1sm0a3lg9sr9zmg6djl93xbndlpcy-IOKit-osx-10.11.6.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/f70a8fnffw2gkypa089rihw85ni5al55-configd-osx-10.8.5.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/a4frgav02bkqngk23psf4kk0drff6a7i-python-2.7.15.drv': 17 dependencies couldn't be built
�[31;1merror:�[0m build of '/nix/store/a4frgav02bkqngk23psf4kk0drff6a7i-python-2.7.15.drv' failed

@timokau
Copy link
Member Author

timokau commented May 28, 2018

Thanks! (ofBorg failure is a timeout)

@timokau timokau closed this May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants