[PATCH] elf: ldconfig should skip temporary files created by package managers
Guillem Jover
guillem@debian.org
Fri Oct 20 21:33:36 GMT 2023
Hi!
[ Hope the reply works, had to construct it from the web archive. ]
On Fri Oct 20 12:29:50 GMT 2023 Florian Weimer wrote:
> diff --git a/elf/ldconfig.c b/elf/ldconfig.c
> index d26eef1fb4..02387a169c 100644
> --- a/elf/ldconfig.c
> +++ b/elf/ldconfig.c
> @@ -661,6 +661,31 @@ struct dlib_entry
> struct dlib_entry *next;
> };
>
> +/* Skip some temporary DSO files. These files may be partially written
> + and lead to ldconfig crashes when examined. */
> +static bool
> +skip_dso_based_on_name (const char *name, size_t len)
> +{
> + /* Skip temporary files created by the prelink program. Files with
> + names like these are never really DSOs we want to look at. */
> + if (len >= sizeof (".#prelink#") - 1)
> + {
> + if (strcmp (name + len - sizeof (".#prelink#") + 1,
> + ".#prelink#") == 0)
> + return true;
> + if (len >= sizeof (".#prelink#.XXXXXX") - 1
> + && memcmp (name + len - sizeof (".#prelink#.XXXXXX")
> + + 1, ".#prelink#.", sizeof (".#prelink#.") - 1) == 0)
> + return true;
> + }
> + /* Skip temporary files created by RPM. */
> + if (memchr (name, len, ';') != NULL)
> + return true;
> + /* Skip temporary files created by dpkg. */
> + if (len > 4 && memcmp (name + len - 4, ".tmp", 4) == 0)
> + return true;
If this refers to files dpkg creates during an unpack, then for
regular files, it might end up creating ones ending with «.dpkg-new»
and «.dpkg-tmp» (for conffiles there are other extensions used, but
those would not seem relevant here).
(And, hmm, I should probably try to document that somewhere in the
dpkg manual pages or docs.)
> + return false;
> +}
>
> static void
> search_dir (const struct dir_entry *entry)
Thanks,
Guillem
More information about the Libc-alpha
mailing list