Asserts when encountering invalid files
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
Research direction
The reported entry point is /usr/bin/dlopen-notes, especially read_dlopen_notes and the argument loop around line 142. Start by tracing how filenames are opened and how invalid, missing, and directory inputs reach ELFFile. Add coverage for those inputs and verify the command avoids assertions as requested.
Written by the indexing model from the issue text.
Description
Version: 0.11-1
systemd: 256.9-1
kernel: 6.12.4-arch1-1
While writing a script to find all dl-opened libraries on a system, I ran into this assert when encountering .py files:
Traceback (most recent call last):
File "/usr/bin/dlopen-notes", line 142, in <module>
notes = [read_dlopen_notes(filename) for filename in args.filenames]
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/dlopen-notes", line 24, in wrap
return list(f(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/dlopen-notes", line 29, in read_dlopen_notes
elffile = ELFFile(open(filename, 'rb'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/elftools/elf/elffile.py", line 84, in __init__
self._identify_file()
File "/usr/lib/python3.12/site-packages/elftools/elf/elffile.py", line 570, in _identify_file
elf_assert(magic == b'\x7fELF', 'Magic number does not match')
File "/usr/lib/python3.12/site-packages/elftools/common/utils.py", line 80, in elf_assert
_assert_with_exception(cond, msg, ELFError)
File "/usr/lib/python3.12/site-packages/elftools/common/utils.py", line 143, in _assert_with_exception
raise exception_type(msg)
elftools.common.exceptions.ELFError: Magic number does not match
Ideally, invalid & non-existent files (& directories) wouldn't cause asserts like this.
- Dominant language
- Python
- Stars
- 28
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from systemd/package-notes
-
Consider adding PURL Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
systemd/package-notes#51 · 6 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
systemd/package-notes#40 · 5 comments ·
All issues in systemd/package-notes
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stephrobert/dsoxlab#238 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sublimehq/package_control#1780 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nwg-piotr/nwg-displays#145 ·