Skip to content

[libraries][regression] ld_so_cache directory listing not further collected #4148

@pmoravec

Description

@pmoravec

https://github.com/sosreport/sos/blob/main/sos/report/plugins/libraries.py#L47-L50 does not collect any directory listing.

Originally, it called "ls -lanH %s" % " ".join(dirs), which worked well - but add_dir_listing method treats the f"{' '.join(dirs)}" as a string and it attempts to verify existence of the whole string as a filepath (https://github.com/sosreport/sos/blob/main/sos/report/plugins/__init__.py#L2094) before collecting anything, which returns in no-op.

Trivial patch would be:

self.add_dir_listing(
                list(dirs),
                suggest_filename='ld_so_cache'
)

to collect dir.listing for each and every path - separately, causing there will be files sos_commands/libraries/ld_so_cache, sos_commands/libraries/ld_so_cache.1, sos_commands/libraries/ld_so_cache.2,.. generated. Not ideal either. Removing suggest_name is an option, to have generated files like sos_commands/libraries/ls_-alZ_.lib64 or sos_commands/libraries/ls_-alZ_.usr.lib64.pipewire-0.3.jack.

Yet better approach would be adding an option list_all to add_dir_listing to suppress separating the list of paths into individual calls of tree/ls commands. Or, alternatively, call ls -alZ directly from the libraries plugin.

The ld_so_cache is a bit traditional / old functionality where I am unsure if we should stick to the collection precisely, or if it is obsolete request. So I dont know what are the preferences. Maybe @rmetrich as the original author can suggest..?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions