[PATCH v2 2/2] ldconfig: Ignore all GDB extension files

Andreas K. Huettel dilfridge@gentoo.org
Thu Jul 4 14:35:29 GMT 2024


Am Donnerstag, 4. Juli 2024, 15:00:07 CEST schrieb Adhemerval Zanella Netto:
> 
> On 06/05/24 14:16, Adam Sampson wrote:
> > ldconfig already ignores files with the -gdb.py suffix, but GDB also
> > looks for -gdb.gdb and -gdb.scm files. These aren't as widely used, but
> > libguile at least comes with a -gdb.scm file.
> > 
> > Rename is_gdb_python_file to is_gdb_extension_file, and make it
> > recognise all three types of GDB extension.
> > 
> > Signed-off-by: Adam Sampson <ats@offog.org>
> 
> 
> LGTM, thanks.  Andreas will need to ack this for 2.40.
> 

OK, straightforward enough :)

> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> 
> > ---
> >  elf/readlib.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/elf/readlib.c b/elf/readlib.c
> > index 32e8b8eb22..f3129c4557 100644
> > --- a/elf/readlib.c
> > +++ b/elf/readlib.c
> > @@ -44,12 +44,14 @@ struct known_names
> >    int flag;
> >  };
> >  
> > -/* Check if string corresponds to a GDB Python file.  */
> > +/* Check if string corresponds to a GDB extension file.  */
> >  static bool
> > -is_gdb_python_file (const char *name)
> > +is_gdb_extension_file (const char *name)
> >  {
> >    size_t len = strlen (name);
> > -  return endswithn (name, len, "-gdb.py");
> > +  return (endswithn (name, len, "-gdb.gdb")
> > +	  || endswithn (name, len, "-gdb.py")
> > +	  || endswithn (name, len, "-gdb.scm"));
> >  }
> >  
> >  /* Returns 0 if everything is ok, != 0 in case of error.  */
> > @@ -146,7 +148,7 @@ process_file (const char *real_file_name, const char *file_name,
> >        size_t len = MIN (statbuf.st_size, 512);
> >        if (memmem (file_contents, len, "GROUP", 5) == NULL
> >  	  && memmem (file_contents, len, "GNU ld script", 13) == NULL
> > -	  && !is_gdb_python_file (file_name))
> > +	  && !is_gdb_extension_file (file_name))
> >  	error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
> >  	       file_name);
> >        ret = 1;
> 


-- 
Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer
(council, toolchain, base-system, perl, libreoffice)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 981 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20240704/837721cc/attachment.sig>


More information about the Libc-alpha mailing list