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

Failure to correctly parse ldconfig output #5540

Closed
RosenGeorgiev opened this issue Feb 9, 2021 · 20 comments · Fixed by #5547
Closed

Failure to correctly parse ldconfig output #5540

RosenGeorgiev opened this issue Feb 9, 2021 · 20 comments · Fixed by #5547
Assignees
Labels

Comments

@RosenGeorgiev
Copy link

Description of the issue

Failure to correctly parse ldconfig output. Started happening after latest Arch upgrade. I guess the ldconfig people changed their output a little bit.

Context information (for bug reports)

  • Output of pyinstaller --version: 4.2
  • Version of Python: 3.9
  • Platform: Arch

Stacktrace / full error message

Traceback (most recent call last):
  File "/somewhere_on_my_system/venv/bin/pyinstaller", line 8, in <module>
    sys.exit(run())
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 725, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 672, in build
    exec(code, spec_namespace)
  File "/somewhere_on_my_system/web_ui.spec", line 11, in <module>
    a = Analysis(
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 242, in __init__
    self.__postinit__()
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/building/datastruct.py", line 160, in __postinit__
    self.assemble()
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 438, in assemble
    ctypes_binaries = scan_code_for_ctypes(co)
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/depend/utils.py", line 145, in scan_code_for_ctypes
    binaries = _resolveCtypesImports(binaries)
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/depend/utils.py", line 319, in _resolveCtypesImports
    load_ldconfig_cache()
  File "/somewhere_on_my_system/venv/lib/python3.9/site-packages/PyInstaller/depend/utils.py", line 402, in load_ldconfig_cache
    path = m.groups()[-1]
AttributeError: 'NoneType' object has no attribute 'groups'

It fails on the last line of this:

	ld-linux.so.2 (ELF) => /usr/lib32/ld-linux.so.2
	ld-linux.so.2 (ELF) => /usr/lib/ld-linux.so.2
	ld-linux-x86-64.so.2 (libc6,x86-64) => /usr/lib/ld-linux-x86-64.so.2
Cache generated by: ldconfig (GNU libc) release release version 2.33

In depend/utils.py on line 402 no match check is being performed and the exception above is being thrown:

  399     for line in text:                                                                               
  400         # :fixme: this assumes libary names do not contain whitespace                               
  401         m = pattern.match(line)                                                                                                    
  402         path = m.groups()[-1]   

@rokm rokm added the bug label Feb 9, 2021
@bwoodsend
Copy link
Member

Yes, I guess it just needs a:

if m is None:
    continue

That would however have the effect of silently ignoring lines in unrecognised syntax which could be a very subtle bug in future.

@rokm
Copy link
Member

rokm commented Feb 9, 2021

Indeed. We could also print a warning for non-matched lines - but only for those that do not start with "Cache generated by: ", to avoid spam on known "problematic" lines.

This change in output seems to come from introduction of an extension mechanism to ld.so.cache, so we'll probably need to expand the ignore list in the future. But this way, we can explicitly ignore the lines we know are harmless, and still catch new ones that could introduce bugs elsewhere...

@bwoodsend bwoodsend self-assigned this Feb 10, 2021
bwoodsend added a commit to bwoodsend/pyinstaller that referenced this issue Feb 10, 2021
).

ldconfig has started adding additional lines of output such as:

    Cache generated by: ldconfig (GNU libc) release release version 2.33

which caused regex parse errors. This particular line is now whitelisted
as skipable. And any future unrecognised patterns will now issue
warnings.
bwoodsend added a commit to bwoodsend/pyinstaller that referenced this issue Feb 10, 2021
).

ldconfig has started adding additional lines of output such as:

    Cache generated by: ldconfig (GNU libc) release release version 2.33

which caused regex parse errors. This particular line is now whitelisted
as skipable. And any future unrecognised patterns will now issue
warnings.
@bwoodsend
Copy link
Member

Mind testing my patch?

pip install github.com/bwoodsend/pyinstaller/archive/5540.zip

bwoodsend added a commit to bwoodsend/pyinstaller that referenced this issue Feb 10, 2021
). [skip-ci]

ldconfig has started adding additional lines of output such as:

    Cache generated by: ldconfig (GNU libc) release release version 2.33

which caused regex parse errors. This particular line is now whitelisted
as skipable. And any future unrecognised patterns will now issue
warnings.
@RosenGeorgiev
Copy link
Author

I confirm that it works now.

@ParaSpl01t
Copy link

Mind testing my patch?

pip install github.com/bwoodsend/pyinstaller/archive/5540.zip

I am here from #5552 and can confirm that your patch works but is giving me a 80mb file using -F flag. I'm sure this was around 8mb previously.

@rokm
Copy link
Member

rokm commented Feb 12, 2021

I am here from #5552 and can confirm that your patch works but is giving me a 80mb file using -F flag. I'm sure this was around 8mb previously.

I doubt a onefile (-F) build of a project using pywebview was previously just 8 MB, as it would need to bundle chromium (or PyQt5/PySide2 QtWebEngine), regardless of this issue and this patch. So either you are comparing two projects with different imports, or two different builds (onefile vs onedir).

Legorooj pushed a commit that referenced this issue Feb 13, 2021
…-ci] (#5547)

ldconfig has started adding additional lines of output such as:

    Cache generated by: ldconfig (GNU libc) release release version 2.33

which caused regex parse errors. This particular line is now whitelisted
as skipable. And any future unrecognised patterns will now issue
warnings.
@LefterisJP
Copy link

Just run into this in my Arch. Really glad to see it's already handled. Thank you guys.

@frostworx
Copy link

What @LefterisJP said.
Thanks a lot for the patch!
Maybe a minor version bump would be a good idea, to automatically pull in the patch for package maintainers.

@bwoodsend
Copy link
Member

Maybe a minor version bump would be a good idea, to automatically pull in the patch for package maintainers.

I'd be for this. This issue seems to be collecting a fair bit of traffic. @htgoebel Could you do this?

@simaoafonso-pwt
Copy link

Friendly ping to request a minor version bump.

@Legorooj
Copy link
Member

Legorooj commented Mar 6, 2021

Hopefully we'll be able to do a version bump soon, however please note that at the moment only Hartmut has the ability to do releases.

@blefev
Copy link

blefev commented Mar 24, 2021

Just run into this in my Arch. Really glad to see it's already handled. Thank you guys.

Same here and the fix worked fine for me!

@Kastakin
Copy link

I just stumbled upon this issue while trying to figure out what was going wrong in my system.

I don't know if it can help for clarity but the issue came out of blue on my Arch-linux machine only. For our project we are using PyInstaller via fbs to package the PyQt app we are working on. Due to the limitations fbs imposes we are tied to PyInstaller version 3.4, the patch proposed by @bwoodsend works like a charm but I had to "hack my way in" by changing the version number to be able to use with my other packages.

Is this something that was originated by an Arch update? Is there any way we can help to make this fix "retroactive"?

@rokm
Copy link
Member

rokm commented May 30, 2021

This change in behavior is stemming from this commit to glibc, which was first released with glibc 2.33. So the "fix" is either to use latest PyInstaller, patch older PyInstaller versions, or downgrade glibc to earlier release (or use distribution that uses older version).

gozdal pushed a commit to StarfishStorage/pyinstaller that referenced this issue Jun 10, 2021
). [skip-ci] (pyinstaller#5547)

ldconfig has started adding additional lines of output such as:

    Cache generated by: ldconfig (GNU libc) release release version 2.33

which caused regex parse errors. This particular line is now whitelisted
as skipable. And any future unrecognised patterns will now issue
warnings.
mattiasa pushed a commit to iconik-io/pyinstaller that referenced this issue Jun 16, 2021
). [skip-ci] (pyinstaller#5547)

ldconfig has started adding additional lines of output such as:

    Cache generated by: ldconfig (GNU libc) release release version 2.33

which caused regex parse errors. This particular line is now whitelisted
as skipable. And any future unrecognised patterns will now issue
warnings.
@bicarlsen
Copy link

I had a similar issue as @Kastakin while using fbs and can confirm @bwoodsend's 5540 patch fixes the issue.

LiXi-storage added a commit to LiXi-storage/barreleye that referenced this issue Jun 30, 2021
Hit following errors when build on RHEL8:

pyinstaller/pyinstaller#5540
Signed-off-by: Li Xi <pkuelelixi@163.com>
@bwoodsend bwoodsend mentioned this issue Jul 10, 2021
Closed
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Sep 20, 2021
https://build.opensuse.org/request/show/920039
by user mcepl + dimstar_suse
- Update to 4.5.1: large number of changes, see packaged CHANGES.rst for
  the complete list.
- Remove glibc233.patch (included upstream)
- Automagically skip matplotlib tests because matplotlib dropped python36
- Add glibc233.patch to fix recent test failure (gh#pyinstaller/pyinstaller#5540)
- Disable functional tests as it takes ages and basic checks
  are okay with unittests
- Use xdist for test execution as otherwise it takes ages
- Requires python-devel, as `pyinstaller` cannot be used without it
- Temporary disabled of tests test_egg* and test_nspkg1*
- Update to version 3.6
  * See changelog at https://github.com/pyinstaller/pyinstaller/blob/v3.6/doc/CHANGES.rst
- Add %bcond_with python2
- Format with spec-cleaner, fix license
- Delete upstream bootloaders from the source distributio
@Leontking
Copy link

uhhh btw that link no more works anyone got a other link?

@simaoafonso-pwt
Copy link

simaoafonso-pwt commented Mar 10, 2022

uhhh btw that link no more works anyone got a other link?

The fix was already released, just install a newer PyInstaller version.

@Kastakin
Copy link

uhhh btw that link no more works anyone got a other link?

If you are using fbs in its GPL licensed version and you are stuck with version 3.4 of Pyinstaller I would suggest you to look at PPG as an alternative

@emmanuel-fokamegne
Copy link

emmanuel-fokamegne commented May 2, 2022

The fix is not working for me . And i use pyinstaller 5.0.1

@bwoodsend
Copy link
Member

What does ldconfig -p print on your machine?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.