systemd / package-notes

Tools to add packaging metadata to ELF files
16 stars 10 forks source link

Add tools and Debian packaging for parsing dlopen ELF notes #33

Closed bluca closed 6 months ago

bluca commented 6 months ago

Spec and implementation at https://github.com/systemd/systemd/pull/32234

keszybz commented 6 months ago

I pushed another commit to rework the output to have more postprocessing.

bluca commented 6 months ago

I pushed another commit to rework the output to have more postprocessing.

Merged into the first commit with Co-authored-by - also added CI, and added back a way to print a "soname priority" list, that I need for the Debian tool, behind a new option

bluca commented 6 months ago

I have no idea why it errors out in the CI, the string seems fine... also works locally, any idea?

behrmann commented 6 months ago

The bit

[{"feature":"fido2","description":"Support fido2 for encryption and authentication.","priority":"required","soname":["libfido2.so.1"]}]

in the output makes me think that the else path here

            try:
                if not isinstance(note_desc, str):
                    text = note_desc.decode('utf-8').rstrip('\0')
                else:
                    text = note_desc
                    print(text)
            except UnicodeDecodeError as e:
                raise ValueError(f'{filename}: Invalid UTF-8 in .note.dlopen n_desc') from e

is taken, but when I copy the above JSON into Emacs, it has a trailing null byte, which gives me the same error

json.decoder.JSONDecodeError: Extra data: line 1 column 136 (char 135)

Yes, unfortunately strings in Python can have null bytes, so stripping that might be what's needed.

bluca commented 6 months ago

Indeed stripping that side of the if fixes the issue, thanks