I think Björn Persson’s concerns are reasonable. Hopefully they can be
easily addressed, since I would be happy to see this change implemented.
At least six packages I maintain or regularly contribute to could be
simplified.
I spot-checked a libtool .la file to see what typical contents looked
like. I’ve pasted the entire file for libfakekey inline at the bottom of
this message as an example.
The following page has some additional information about the format:
https://autotools.io/libtool/lafiles.html
I’m not aware of a formal specification for this format—and I haven’t
tested this suggestions against a corpus of packages—but I suspect that
“files ending in .la that contain a line matching /^dlname=/” would be a
very successful heuristic.
While it’s not always the best tool for automation, libmagic/file(1) was
also able to confirm the type:
$ file libfakekey.la
libfakekey.la: libtool library file, ASCII text
----- Sample libtool library file begins here -----
# libfakekey.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.6
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libfakekey.so.0'
# Names of this library.
library_names='libfakekey.so.0.0.1 libfakekey.so.0 libfakekey.so'
# The name of the static archive.
old_library=''
# Linker flags that cannot go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' -lX11 -lXtst'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libfakekey.
current=0
age=0
revision=1
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/lib64'
----- Sample libtool library file ends here -----
On 11/1/21 13:50, Björn Persson wrote:
>> Pull request implementing `%__brp_remove_la_files` in the upstream rpm
>> repository:
https://github.com/rpm-software-management/rpm/pull/1674
>
> This looks like it risks deleting more files than intended. If some
> package uses country codes or domain names in filenames, then this
> change could silently delete files specific to Laos.
>
> Language codes occur as filename suffixes. Apache can use them to serve
> web pages in the client's preferred language. This change risks deleting
> files written in latin.
>
> If there is a more reliable way to recognize a Libtool archive by
> inspecting the file's content, then I think the script should do that
> to verify that files with a ".la" suffix really are Libtool archives
> before deleting them.
>
> Björn Persson
>
>
> _______________________________________________
> devel mailing list -- devel(a)lists.fedoraproject.org
> To unsubscribe send an email to devel-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
> Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure
>