Subject: Re: bug#63590: 29.0.90; can't load sqlite extension

From: Eli Zaretskii <[email-masked]>
Date: Sat, 20 May 2023 15:35:17 +0300

> Date: Sat, 20 May 2023 12:39:37 +0200
> From: Lennart Vogelsang <[email-masked]>
> Cc: [email-masked]
> 
> Ahh, I just wanted to answer you, I just noticed that about the tests 
> too. Thank you! Your patch works for me,

Thanks for testing, I will install the changes soon.

> just one small thing: sqlite extension loading can also fail because of 
> other reasons (e.g. if the shared library
> does not exist). Currently your patch would leave sqlite extension 
> loading enabled in that case, I think?

Right, fixed.

> I would also argue that it would make sense to actually report the error 
> of the extension loading (when  the dynamic library file does not exist, 
> or the extension is invalid). Maybe something like this:

I don't want to change the API in such a drastic way, especially as we
are close to releasing Emacs 29.1.  It is easy for the caller to test
whether the file exists or not, and it isn't clear to me that every
caller would like the primitive to signal an error.  The return value
is enough to know whether the extension can be used or not, so every
caller can do what they need, and no important information is lost.

> That way, the test also correctly fails as we signal the error from the 
> extension loading.

I've modified the test to check the existence of the file instead.
Doing that is actually better, since on many systems the extensions
will not be installed, or installed not in the directories whose names
are used by the test, and it is important to make sure the return
value of sqlite-load-extension corresponds to whether the file is in
that place or not.

> Just out of curiosity, as there are a handful of useful 
> sqlite extensions out there, could there be a way to make the allow list 
> a bit more lenient?

I had the same thoughts, so I added some of them, which I thought
could be useful for Emacs.

> Maybe as a build configure feature allowing us to specify other
> extensions that are allowed to be loaded.

That is less desirable, since in many cases the person who builds
Emacs is some downstream distro maintainer, who doesn't know which
extensions will be useful for the end-users.