[PATCH v5] usertools: rewrite pmdinfo
Robin Jarry
rjarry at redhat.com
Mon Sep 26 14:52:44 CEST 2022
Robin Jarry, Sep 22, 2022 at 13:58:
> +# ----------------------------------------------------------------------------
> +def ld_so_path() -> Iterator[str]:
> + """
> + Return the list of directories where dynamic libraries are loaded based
> + on the contents of /etc/ld.so.conf/*.conf.
> + """
> + for conf in glob.iglob("/etc/ld.so.conf/*.conf"):
I just noticed that this folder path is invalid. I did not encounter any
errors since I did not test with librte_*.so libs installed in /usr/*.
> + try:
> + with open(conf, "r", encoding="utf-8") as f:
> + for line in f:
> + line = line.strip()
> + if os.path.isdir(line):
> + yield line
> + except OSError:
> + pass
> +
> +
> +LD_SO_CONF_PATH = ld_so_path()
Also, this is stupid. The iterator will be exhausted after iterating
once over it and the SO path folders will be empty on subsequent
lookups. I'll submit a v6 with a fix for these two bugs.
More information about the dev
mailing list