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

[BUG] Infinite recursion when extracting harchives with link pointing to itself #208

Open
theclue opened this issue Jun 5, 2020 · 4 comments

Comments

@theclue
Copy link

theclue commented Jun 5, 2020

Working on the recipe games-emulation/atari++ I've crushed into this fatal. It seems related to upacking the source files

~/github/haikuports/games-emulation/atari++> hp "atari++" -S
Checking if any dependency-infos need to be updated ...
        updating dependency infos of atari++-1.83
Looking for stale dependency-infos ...
        removing atari++-1.81.DependencyInfo
----------------------------------------------------------------------
games-emulation::atari++-1.83
        /boot/home/github/haikuports/games-emulation/atari++/atari++-1.83.recipe
----------------------------------------------------------------------
Skipping download of source for atari++_1.83.tar.gz
Skipping checksum validation of atari++_1.83.tar.gz
Cleaning source dir for atari++_1.83.tar.gz
Unpacking source of atari++_1.83.tar.gz
Fatal Python error: Cannot recover from stack overflow.

Current thread 0x00000232765960a0 (most recent call first):
  File "/packages/python3-3.7.7-2/.self/lib/python3.7/tarfile.py", line 2202 in makelink
  File "/packages/python3-3.7.7-2/.self/lib/python3.7/tarfile.py", line 2120 in _extract_member
  File "/packages/python3-3.7.7-2/.self/lib/python3.7/tarfile.py", line 2213 in makelink
  File "/packages/python3-3.7.7-2/.self/lib/python3.7/tarfile.py", line 2120 in _extract_member
  File "/packages/python3-3.7.7-2/.self/lib/python3.7/tarfile.py", line 2213 in makelink
  File "/packages/python3-3.7.7-2/.self/lib/python3.7/tarfile.py", line 2120 in _extract_member
...

Fact that this happens even with 1.81, which is on Haikuports Master already, suggests me this issue is not related to the recipe itself

@mmlr
Copy link
Member

mmlr commented Jun 5, 2020

This is probably under python 3.7. There has been an issue with one recipe using scons that would also run into a stack overflow. I don't think it's an issue in HaikuPorter. Although if it does use recursion for extracting directories, it would lend itself to such problems and that would indeed be a problem (I haven't checked if it does).

Can you try with python38 instead and see if it reproduces there?

@theclue
Copy link
Author

theclue commented Jun 5, 2020

Using python3.8 I have not that fatal log anymore, but I still have this error

maximum recursion depth exceeded in comparison

@mmlr
Copy link
Member

mmlr commented Jun 5, 2020

The tar file in question contains an entry for winmain.cpp but later on also includes a link with the same name pointing to a file with that same name again, making it circular. It looks like this isn't detected and it therefore gets into an endless loop and eventual stack overflow/max recursion depth. As the stack trace earlier indicates this to happen in tarfile.py itself, this might be a problem in the tar implementation there, possibly triggered by our use of a filter. It does not reproduce with python3 -m tarfile -l atari++_1.83.tar or with -e or -t, so it can't be a general problem, making it more likely to be either caused or at least triggered by our use of a filter.

@mmlr
Copy link
Member

mmlr commented Jun 5, 2020

It is triggered by the translation of hardlinks to symlinks with the MyTarInfo here:

class MyTarInfo(tarfile.TarInfo):

It looks like there are no further checks after us returning the modified info so that it can recurse here.

@pulkomandy pulkomandy changed the title [BUG] Fatal error while building recipe atari++ on x64 [BUG] Infinite recursion when extracting harchives with link pointing to itself Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants