[PATCH] gnu: octave: Fix CA certificate use.

  • Done
  • quality assurance status badge
Details
3 participants
  • Kei Kebreau
  • Ludovic Courtès
  • Marius Bakke
Owner
unassigned
Submitted by
Kei Kebreau
Severity
normal
K
K
Kei Kebreau wrote on 26 Aug 2018 02:42
(address . guix-patches@gnu.org)(name . Kei Kebreau)(address . kkebreau@posteo.net)
20180826004231.19350-1-kkebreau@posteo.net
* gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
Octave with the path to system CA certificates.
---
gnu/packages/maths.scm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

Toggle diff (21 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 3d571e8cc..b0caff0f5 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -1417,7 +1417,13 @@ can solve two kinds of problems:
(string-append "Vmakeinfo_program = \""
(assoc-ref inputs "texinfo")
"/bin/makeinfo\"")))
- #t)))))
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (wrap-program (string-append out "/bin/octave")
+ '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
+ #t))))))
(home-page "https://www.gnu.org/software/octave/")
(synopsis "High-level language for numerical computation")
(description "GNU Octave is a high-level interpreted language that is
--
2.18.0
L
L
Ludovic Courtès wrote on 13 Sep 2018 10:43
(name . Kei Kebreau)(address . kkebreau@posteo.net)(address . 32530@debbugs.gnu.org)
87tvmtpz2r.fsf@gnu.org
Hi,

Kei Kebreau <kkebreau@posteo.net> skribis:

Toggle quote (3 lines)
> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
> Octave with the path to system CA certificates.

[...]

Toggle quote (6 lines)
> + (add-after 'install 'wrap-program
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out")))
> + (wrap-program (string-append out "/bin/octave")
> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))

Users might want to ignore /etc/ssl/certs altogether and instead only
use their own set of certificates, so I’m rather reluctant to such a
change.

Now, I agree that there’s a usability problem: we don’t want every
Octave user to stumble upon a certificate error message. I can think of
several solutions:

1. We could add CURLOPT_CAPATH to the ‘native-search-paths’ of ‘curl’,
assuming that variable is honored by libcurl itself. It won’t
solve this immediate issue, but it sounds like “the right way.”

2. On GuixSD, we could define CURLOPT_CAPATH=/etc/ssl/certs in
/etc/profile, like we already do for other variables.

3. We could document this variable under “X.509 Certificates” in the
manual.

#1 would have to go to ‘core-updates’. WDYT?

Thanks,
Ludo’.
K
K
Kei Kebreau wrote on 14 Sep 2018 01:44
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 32530@debbugs.gnu.org)
87h8it7yk3.fsf@posteo.net
ludo@gnu.org (Ludovic Courtès) writes:

Toggle quote (38 lines)
> Hi,
>
> Kei Kebreau <kkebreau@posteo.net> skribis:
>
>> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
>> Octave with the path to system CA certificates.
>
> [...]
>
>> + (add-after 'install 'wrap-program
>> + (lambda* (#:key outputs #:allow-other-keys)
>> + (let ((out (assoc-ref outputs "out")))
>> + (wrap-program (string-append out "/bin/octave")
>> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
>
> Users might want to ignore /etc/ssl/certs altogether and instead only
> use their own set of certificates, so I’m rather reluctant to such a
> change.
>
> Now, I agree that there’s a usability problem: we don’t want every
> Octave user to stumble upon a certificate error message. I can think of
> several solutions:
>
> 1. We could add CURLOPT_CAPATH to the ‘native-search-paths’ of ‘curl’,
> assuming that variable is honored by libcurl itself. It won’t
> solve this immediate issue, but it sounds like “the right way.”
>
> 2. On GuixSD, we could define CURLOPT_CAPATH=/etc/ssl/certs in
> /etc/profile, like we already do for other variables.
>
> 3. We could document this variable under “X.509 Certificates” in the
> manual.
>
> #1 would have to go to ‘core-updates’. WDYT?
>
> Thanks,
> Ludo’.

I don't mind putting #1 on 'core-updates' assuming it works. I will test
it locally first. Also, thanks for looking at this!
K
K
Kei Kebreau wrote on 15 Sep 2018 03:54
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 32530@debbugs.gnu.org)
87va77zfs4.fsf@posteo.net
Kei Kebreau <kkebreau@posteo.net> writes:

Toggle quote (44 lines)
> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Hi,
>>
>> Kei Kebreau <kkebreau@posteo.net> skribis:
>>
>>> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program'
>>> phase to wrap
>>> Octave with the path to system CA certificates.
>>
>> [...]
>>
>>> + (add-after 'install 'wrap-program
>>> + (lambda* (#:key outputs #:allow-other-keys)
>>> + (let ((out (assoc-ref outputs "out")))
>>> + (wrap-program (string-append out "/bin/octave")
>>> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
>>
>> Users might want to ignore /etc/ssl/certs altogether and instead only
>> use their own set of certificates, so I’m rather reluctant to such a
>> change.
>>
>> Now, I agree that there’s a usability problem: we don’t want every
>> Octave user to stumble upon a certificate error message. I can think of
>> several solutions:
>>
>> 1. We could add CURLOPT_CAPATH to the ‘native-search-paths’ of ‘curl’,
>> assuming that variable is honored by libcurl itself. It won’t
>> solve this immediate issue, but it sounds like “the right way.”
>>
>> 2. On GuixSD, we could define CURLOPT_CAPATH=/etc/ssl/certs in
>> /etc/profile, like we already do for other variables.
>>
>> 3. We could document this variable under “X.509 Certificates” in the
>> manual.
>>
>> #1 would have to go to ‘core-updates’. WDYT?
>>
>> Thanks,
>> Ludo’.
>
> I don't mind putting #1 on 'core-updates' assuming it works. I will test
> it locally first. Also, thanks for looking at this!

It looks like solution #1 does not work as expected. In this case,
perhaps #3 would be preferable because the user can more easily control
the environment variable?
M
M
Marius Bakke wrote on 15 Sep 2018 10:37
(name . Kei Kebreau)(address . kkebreau@posteo.net)
87o9czqhpo.fsf@fastmail.com
Kei Kebreau <kkebreau@posteo.net> writes:

Toggle quote (23 lines)
> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
> Octave with the path to system CA certificates.
> ---
> gnu/packages/maths.scm | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
> index 3d571e8cc..b0caff0f5 100644
> --- a/gnu/packages/maths.scm
> +++ b/gnu/packages/maths.scm
> @@ -1417,7 +1417,13 @@ can solve two kinds of problems:
> (string-append "Vmakeinfo_program = \""
> (assoc-ref inputs "texinfo")
> "/bin/makeinfo\"")))
> - #t)))))
> + #t))
> + (add-after 'install 'wrap-program
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out")))
> + (wrap-program (string-append out "/bin/octave")
> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
> + #t))))))

Instead of wrapping you can add a native-search-path for CURLOPT_CAPATH
(as with CURL_CA_BUNDLE for `curl`). That way installing certificates
to the profile should be sufficient.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlucxNMACgkQoqBt8qM6
VPrkUQf/UeKImV8MyO52Lg9LTMhUMrPfwWSDTnydM6/5JwappyM5DB2S3kgS+IWE
Dqm2//4J6uGYEF9VIGy3NMKJ9EubddUG3+0AaXiQppNyjaTyFPqGIV1tl1HpyhmO
0HyA/DEqMFS+w3eznwIMTWicKId8spodT/CqYWNFUO6Rmt2/+kQTnpuAusFeU4DN
K+bRKV3ZF0GnLOQekesIfVH0zuTHd2jjLbbYhMYkcm73Vuwvk0RkRY4oE3Ue/0mE
Nw6tU28pxAtm/KkJv0oy0PqvhWoDHHrNzkNAV25D75SXCp0b7mojMp+PRxJUraQS
HxdF8AEr8PM7GTPi6YXVeojwRz2Xzw==
=MhkP
-----END PGP SIGNATURE-----

K
K
Kei Kebreau wrote on 15 Sep 2018 20:30
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 32530@debbugs.gnu.org)
87r2huzk8c.fsf@posteo.net
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (29 lines)
> Kei Kebreau <kkebreau@posteo.net> writes:
>
>> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
>> Octave with the path to system CA certificates.
>> ---
>> gnu/packages/maths.scm | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
>> index 3d571e8cc..b0caff0f5 100644
>> --- a/gnu/packages/maths.scm
>> +++ b/gnu/packages/maths.scm
>> @@ -1417,7 +1417,13 @@ can solve two kinds of problems:
>> (string-append "Vmakeinfo_program = \""
>> (assoc-ref inputs "texinfo")
>> "/bin/makeinfo\"")))
>> - #t)))))
>> + #t))
>> + (add-after 'install 'wrap-program
>> + (lambda* (#:key outputs #:allow-other-keys)
>> + (let ((out (assoc-ref outputs "out")))
>> + (wrap-program (string-append out "/bin/octave")
>> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
>> + #t))))))
>
> Instead of wrapping you can add a native-search-path for CURLOPT_CAPATH
> (as with CURL_CA_BUNDLE for `curl`). That way installing certificates
> to the profile should be sufficient.

Ah! Yes, this works when I add curl to the profile. I didn't do this the
first time. I'll upload a patch here soon.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEg7ZwOtzKO2lLzi2m5qXuPBlGeg0FAludT9MACgkQ5qXuPBlG
eg396g/+LbIzc1LpdfYQ2DJb2bxgCGfFdMh8Pwh4HfZbcKkd7crEmr9C4fGv3V4C
SUIoRk1OFQ1O8WYABB/z+NvAuiqWlAKCTAUjrmDvv64zr84uF6dasByE4h/tVzZk
H50AjMqNHyjqBf16sCl7kkAxql14AKgjtKCBQtBDvzsVQV7AR7HJrcI9qO9OgfK1
2ywYmJGTxM0YLiiv3Mdcf6OewwbBfiaN23no1nZ9IldzSoM+mLeQEQV1GUwQc4eY
0fArgMB2lUhASfIbDsE4PR8E7rMfSmH5ST7v5Dvp9cqrRQByGgYVApsMHcIT2iGx
u51lTDTOwWepcbJUcYUO4UKCbNisY/FE5Mdw7kgxpcr70R9MMY+baRgqVGa6MpvG
Y8NNo8hWPpAKJmaJUVlvBS4xKpDx9B/M+exNH/93w4pZkxls0pJSUC+GPtDi8Lgu
Pbi63FTCTxQSxClZdt7aHd/+8fVJ0e2sVNxWZJ8w+HVS5Dv6jAM/j7j5kYZdmYQh
nYE3K9dAU9a1UKwKzvZaAvnoQsUa/8+wMcmEPkLuEKpxBnWbPy9ZIDyxU4R8/vYM
ryn6+aQ/F2HhZu/YSPjtBeQK/nn2kr9OektBkaEA/EeOPTV4qp5fy5tnnytYsyQh
39Zg87leZPiEBfe3B62W2xa/mFqTtQGJGuuY6vPHKAO1F8ZYjEo=
=8Ltm
-----END PGP SIGNATURE-----

K
K
Kei Kebreau wrote on 17 Sep 2018 18:33
(address . 32530@debbugs.gnu.org)
87va74krsy.fsf@posteo.net
Kei Kebreau <kkebreau@posteo.net> writes:

Toggle quote (34 lines)
> Marius Bakke <mbakke@fastmail.com> writes:
>
>> Kei Kebreau <kkebreau@posteo.net> writes:
>>
>>> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
>>> Octave with the path to system CA certificates.
>>> ---
>>> gnu/packages/maths.scm | 8 +++++++-
>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
>>> index 3d571e8cc..b0caff0f5 100644
>>> --- a/gnu/packages/maths.scm
>>> +++ b/gnu/packages/maths.scm
>>> @@ -1417,7 +1417,13 @@ can solve two kinds of problems:
>>> (string-append "Vmakeinfo_program = \""
>>> (assoc-ref inputs "texinfo")
>>> "/bin/makeinfo\"")))
>>> - #t)))))
>>> + #t))
>>> + (add-after 'install 'wrap-program
>>> + (lambda* (#:key outputs #:allow-other-keys)
>>> + (let ((out (assoc-ref outputs "out")))
>>> + (wrap-program (string-append out "/bin/octave")
>>> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
>>> + #t))))))
>>
>> Instead of wrapping you can add a native-search-path for CURLOPT_CAPATH
>> (as with CURL_CA_BUNDLE for `curl`). That way installing certificates
>> to the profile should be sufficient.
>
> Ah! Yes, this works when I add curl to the profile. I didn't do this the
> first time. I'll upload a patch here soon.

Here's the search path patch. With this, I needed both nss-certs and
cURL installed alongside Octave to get certificates working.
From 99614c73d5156ded2e865b7daf0955c9ff4eaaf4 Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kkebreau@posteo.net>
Date: Sun, 16 Sep 2018 22:17:06 -0400
Subject: [PATCH] gnu: curl: Add a search path for CURLOPT_CAPATH.

* gnu/packages/curl.scm (curl)[native-search-paths]: New field.
---
gnu/packages/curl.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
index 6d45dc0cc..8bdba8655 100644
--- a/gnu/packages/curl.scm
+++ b/gnu/packages/curl.scm
@@ -83,7 +83,10 @@
(variable "CURL_CA_BUNDLE")
(file-type 'regular)
(separator #f) ;single entry
- (files '("etc/ssl/certs/ca-certificates.crt")))))
+ (files '("etc/ssl/certs/ca-certificates.crt")))
+ (search-path-specification
+ (variable "CURLOPT_CAPATH")
+ (files '("etc/ssl/certs")))))
(arguments
`(#:configure-flags '("--with-gnutls" "--with-gssapi")
;; Add a phase to patch '/bin/sh' occurances in tests/runtests.pl
--
2.19.0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEg7ZwOtzKO2lLzi2m5qXuPBlGeg0FAluf1z0ACgkQ5qXuPBlG
eg1jNg/+McU6a69SAk85XmNXpqWbQEPa2+IGVyx04ME0iBNNOVaxQunja5EqSrfp
uJ0T30EnrzYippmJOnybXtFcWnohuTLOuimR9LuBThYCdxCI66cvxwbK865aWhEc
eXKTJZqx5Res7t4+wCCl3XovYEyUwyb2v57rU8O01h4GY2hcJLkNYshGQ1aSskYA
LiaVlcWjoNy9WNCCBSyznWWaTree9ZLRtJ3npFy9cl0u10AwYlIBTV01BJKvSp+C
P6m2CsUchsL+kB6oyVk40kYx7vXldJf59OCularF3W75B6vyxdwVbN4aOjCApC2Q
Pc7XENt9urx4rQue5PS1WEccSMathVlAe1bc/iA4EuX1A3cJ3Jn/2P1A8YLz75bY
BWsZKzRPzr0xCAlM8ClFLzrz4eAzDtmLw8NUaCXSBjiy8bCvOhnWkxP2hNdFlFkj
hDQcUbTMucI9HlSyWBeaqATEyq4Z1nlrxnrtW1nbHaRB0JPJyncKzciiBvc3BgZA
QIEISs6fV7FL9Fpswox6lxfYzdDW7Uuc+snl4xmNpi3X4l+yRhwkvKJwJLkCH1Km
Z50nuKL96CQrJpxnDTCc3vE/6SdY8lMZU732O3uQcRdE3j8MT0Ts0EI3fxeTENVK
NNFQ8FM9209sE+qutdCjvGOHHHyUZ0IjXkxM3O4WKzRkZi21xko=
=yEXp
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 17 Sep 2018 19:16
(address . 32530@debbugs.gnu.org)
875zz4oxil.fsf@fastmail.com
Kei Kebreau <kkebreau@posteo.net> writes:

Toggle quote (39 lines)
> Kei Kebreau <kkebreau@posteo.net> writes:
>
>> Marius Bakke <mbakke@fastmail.com> writes:
>>
>>> Kei Kebreau <kkebreau@posteo.net> writes:
>>>
>>>> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
>>>> Octave with the path to system CA certificates.
>>>> ---
>>>> gnu/packages/maths.scm | 8 +++++++-
>>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
>>>> index 3d571e8cc..b0caff0f5 100644
>>>> --- a/gnu/packages/maths.scm
>>>> +++ b/gnu/packages/maths.scm
>>>> @@ -1417,7 +1417,13 @@ can solve two kinds of problems:
>>>> (string-append "Vmakeinfo_program = \""
>>>> (assoc-ref inputs "texinfo")
>>>> "/bin/makeinfo\"")))
>>>> - #t)))))
>>>> + #t))
>>>> + (add-after 'install 'wrap-program
>>>> + (lambda* (#:key outputs #:allow-other-keys)
>>>> + (let ((out (assoc-ref outputs "out")))
>>>> + (wrap-program (string-append out "/bin/octave")
>>>> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
>>>> + #t))))))
>>>
>>> Instead of wrapping you can add a native-search-path for CURLOPT_CAPATH
>>> (as with CURL_CA_BUNDLE for `curl`). That way installing certificates
>>> to the profile should be sufficient.
>>
>> Ah! Yes, this works when I add curl to the profile. I didn't do this the
>> first time. I'll upload a patch here soon.
>
> Here's the search path patch. With this, I needed both nss-certs and
> cURL installed alongside Octave to get certificates working.

[...]

Toggle quote (14 lines)
> diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
> index 6d45dc0cc..8bdba8655 100644
> --- a/gnu/packages/curl.scm
> +++ b/gnu/packages/curl.scm
> @@ -83,7 +83,10 @@
> (variable "CURL_CA_BUNDLE")
> (file-type 'regular)
> (separator #f) ;single entry
> - (files '("etc/ssl/certs/ca-certificates.crt")))))
> + (files '("etc/ssl/certs/ca-certificates.crt")))
> + (search-path-specification
> + (variable "CURLOPT_CAPATH")
> + (files '("etc/ssl/certs")))))

Adding this native-search-path to the "octave" package should be
sufficient. Then you won't need curl in the profile, nor do we need to
rebuild all the things that depend on curl. Can you try that?

Thanks for fixing this issue :-)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAluf4VMACgkQoqBt8qM6
VPqi5QgAvtQ5jKsQCtFqNLWDSB90+isklTD5cDE7gqlloEdUMYAzK7mcv8HNbL7H
6NxEkYeqiB2RgRa9Mraz6LqYfOp3oUllLuRf2yqEs/CqtB/HnrP3mfMWeoY1ybA+
8f9qRsNB/ZXKkIDL5nXCu6Mrf5j1e6HN6TllQ2UtEbMQQycZhU1dY1AtuSUsHM3h
0Ty55iYbxBXpI4XJJh9GWLkw74FmHlO9BMLvx0TtDt9YS9Nsdr7mTtn/EyQvI8Gs
D9MVu7US/EoYaJf3fWVj4/1xaCF4KWAOZ/whrou882YkkEu0jLCFIwsVl2fuym1U
WR4CT4FaZzeyhfS70WNLfEzYKNuCHQ==
=bv6F
-----END PGP SIGNATURE-----

K
K
Kei Kebreau wrote on 18 Sep 2018 22:57
(name . Marius Bakke)(address . mbakke@fastmail.com)
87efdqttfu.fsf@posteo.net
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (61 lines)
> Kei Kebreau <kkebreau@posteo.net> writes:
>
>> Kei Kebreau <kkebreau@posteo.net> writes:
>>
>>> Marius Bakke <mbakke@fastmail.com> writes:
>>>
>>>> Kei Kebreau <kkebreau@posteo.net> writes:
>>>>
>>>>> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
>>>>> Octave with the path to system CA certificates.
>>>>> ---
>>>>> gnu/packages/maths.scm | 8 +++++++-
>>>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
>>>>> index 3d571e8cc..b0caff0f5 100644
>>>>> --- a/gnu/packages/maths.scm
>>>>> +++ b/gnu/packages/maths.scm
>>>>> @@ -1417,7 +1417,13 @@ can solve two kinds of problems:
>>>>> (string-append "Vmakeinfo_program = \""
>>>>> (assoc-ref inputs "texinfo")
>>>>> "/bin/makeinfo\"")))
>>>>> - #t)))))
>>>>> + #t))
>>>>> + (add-after 'install 'wrap-program
>>>>> + (lambda* (#:key outputs #:allow-other-keys)
>>>>> + (let ((out (assoc-ref outputs "out")))
>>>>> + (wrap-program (string-append out "/bin/octave")
>>>>> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
>>>>> + #t))))))
>>>>
>>>> Instead of wrapping you can add a native-search-path for CURLOPT_CAPATH
>>>> (as with CURL_CA_BUNDLE for `curl`). That way installing certificates
>>>> to the profile should be sufficient.
>>>
>>> Ah! Yes, this works when I add curl to the profile. I didn't do this the
>>> first time. I'll upload a patch here soon.
>>
>> Here's the search path patch. With this, I needed both nss-certs and
>> cURL installed alongside Octave to get certificates working.
>
> [...]
>
>> diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
>> index 6d45dc0cc..8bdba8655 100644
>> --- a/gnu/packages/curl.scm
>> +++ b/gnu/packages/curl.scm
>> @@ -83,7 +83,10 @@
>> (variable "CURL_CA_BUNDLE")
>> (file-type 'regular)
>> (separator #f) ;single entry
>> - (files '("etc/ssl/certs/ca-certificates.crt")))))
>> + (files '("etc/ssl/certs/ca-certificates.crt")))
>> + (search-path-specification
>> + (variable "CURLOPT_CAPATH")
>> + (files '("etc/ssl/certs")))))
>
> Adding this native-search-path to the "octave" package should be
> sufficient. Then you won't need curl in the profile, nor do we need to
> rebuild all the things that depend on curl. Can you try that?

Adding the native-search-path to the "octave" package works!

Toggle quote (2 lines)
>
> Thanks for fixing this issue :-)
From df88f083f8974b1cb17d03ede300505ec3ecabc1 Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kkebreau@posteo.net>
Date: Sun, 16 Sep 2018 22:17:06 -0400
Subject: [PATCH] gnu: octave: Add a search path for CURLOPT_CAPATH.

* gnu/packages/maths.scm (octave)[native-search-paths]: New field.
---
gnu/packages/maths.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index d3e72128c..7389f972b 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -1397,6 +1397,10 @@ can solve two kinds of problems:
("less" ,less)
("ghostscript" ,ghostscript)
("gnuplot" ,gnuplot)))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CURLOPT_CAPATH")
+ (files '("etc/ssl/certs")))))
(arguments
`(#:configure-flags
(list (string-append "--with-shell="
--
2.19.0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEg7ZwOtzKO2lLzi2m5qXuPBlGeg0FAluhZrUACgkQ5qXuPBlG
eg2v0RAAwDiORqKU69okM3DC/b3wpWtglK6ZmEt9YQl1AtemjMfFEL8uXHKt4Ocx
0ENo8xL/CGdo+35EVAJ7igNBAOps61Np1mRki001ICINJ4YcwyQYoCjesoCScWpa
6y17d67LyLlOFZZGp57H39hGzkVHXvcNrfB5h5pDGEBdiyPphNprOMRpam7Y0ZJP
PELC2LPDaO7tUehAwlyYNdy0vE/WcJ1xJ3CQLTNYx1AjxkOIJ39g/UejAuqdPPrp
uKjeyx73bAkXHEY3aIZH+gZDUMy3tNHj7sP0o6cnYu/2jkVaKNvW0rHl268KgtYn
9eWtpA65P1b5zww0Td90oKcYac9WWLDA/x6ltKsRoXVZRF96r2gBjg8k0varHbgy
YOoUztV06Eve0hqfORMv6rRtCy1dhAep0vNvWnr9g82OxQP+Agy2qN8rzqrILBg1
nesj0NzjEZoEqGTL2sei2ku53WL9Ve+lne2R/GTtOkeOG5w7iquFfEOIaupoMYBt
h4vGCq30OFWagspFDvQQHJgTqETzlZMFAEq/SQIpfxv0wEXP41C83yC4aFP4g6K6
cu3DhGh0VUns81N8Rrib/hK6UXqO3P7Zhiv8/oRSKVbr5vB4eERRy9AE8focPeDH
2J0hVkcYojeiqbZ0EoODXulIYXq6DlhwcYw5C1eBaWPOV9H5KaI=
=+PJk
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 19 Sep 2018 19:27
(name . Kei Kebreau)(address . kkebreau@posteo.net)
8736u5pfcv.fsf@fastmail.com
Kei Kebreau <kkebreau@posteo.net> writes:

Toggle quote (65 lines)
> Marius Bakke <mbakke@fastmail.com> writes:
>
>> Kei Kebreau <kkebreau@posteo.net> writes:
>>
>>> Kei Kebreau <kkebreau@posteo.net> writes:
>>>
>>>> Marius Bakke <mbakke@fastmail.com> writes:
>>>>
>>>>> Kei Kebreau <kkebreau@posteo.net> writes:
>>>>>
>>>>>> * gnu/packages/maths.scm (octave)[arguments]: Add 'wrap-program' phase to wrap
>>>>>> Octave with the path to system CA certificates.
>>>>>> ---
>>>>>> gnu/packages/maths.scm | 8 +++++++-
>>>>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
>>>>>> index 3d571e8cc..b0caff0f5 100644
>>>>>> --- a/gnu/packages/maths.scm
>>>>>> +++ b/gnu/packages/maths.scm
>>>>>> @@ -1417,7 +1417,13 @@ can solve two kinds of problems:
>>>>>> (string-append "Vmakeinfo_program = \""
>>>>>> (assoc-ref inputs "texinfo")
>>>>>> "/bin/makeinfo\"")))
>>>>>> - #t)))))
>>>>>> + #t))
>>>>>> + (add-after 'install 'wrap-program
>>>>>> + (lambda* (#:key outputs #:allow-other-keys)
>>>>>> + (let ((out (assoc-ref outputs "out")))
>>>>>> + (wrap-program (string-append out "/bin/octave")
>>>>>> + '("CURLOPT_CAPATH" suffix ("/etc/ssl/certs")))
>>>>>> + #t))))))
>>>>>
>>>>> Instead of wrapping you can add a native-search-path for CURLOPT_CAPATH
>>>>> (as with CURL_CA_BUNDLE for `curl`). That way installing certificates
>>>>> to the profile should be sufficient.
>>>>
>>>> Ah! Yes, this works when I add curl to the profile. I didn't do this the
>>>> first time. I'll upload a patch here soon.
>>>
>>> Here's the search path patch. With this, I needed both nss-certs and
>>> cURL installed alongside Octave to get certificates working.
>>
>> [...]
>>
>>> diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
>>> index 6d45dc0cc..8bdba8655 100644
>>> --- a/gnu/packages/curl.scm
>>> +++ b/gnu/packages/curl.scm
>>> @@ -83,7 +83,10 @@
>>> (variable "CURL_CA_BUNDLE")
>>> (file-type 'regular)
>>> (separator #f) ;single entry
>>> - (files '("etc/ssl/certs/ca-certificates.crt")))))
>>> + (files '("etc/ssl/certs/ca-certificates.crt")))
>>> + (search-path-specification
>>> + (variable "CURLOPT_CAPATH")
>>> + (files '("etc/ssl/certs")))))
>>
>> Adding this native-search-path to the "octave" package should be
>> sufficient. Then you won't need curl in the profile, nor do we need to
>> rebuild all the things that depend on curl. Can you try that?
>
> Adding the native-search-path to the "octave" package works!

Excellent! :-)

[...]

Toggle quote (13 lines)
> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
> index d3e72128c..7389f972b 100644
> --- a/gnu/packages/maths.scm
> +++ b/gnu/packages/maths.scm
> @@ -1397,6 +1397,10 @@ can solve two kinds of problems:
> ("less" ,less)
> ("ghostscript" ,ghostscript)
> ("gnuplot" ,gnuplot)))
> + (native-search-paths
> + (list (search-path-specification
> + (variable "CURLOPT_CAPATH")
> + (files '("etc/ssl/certs")))))

LGTM.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAluihwAACgkQoqBt8qM6
VPpVJwf8C9cA3reBvLayHAyCSi+/Y/vCqz33WSSZiedpZMe1AJlCpPWacZCu7v3i
jfJ9nsd433qDE8LWcWyDXMYISAOSsju8vN55ou2YyPhZsm2oNXUvEVyhExd1tQ0W
7Wr1MBK5M5zi6HvAMW2eBUqoAeoLeYriFzccx+fI6OevFzipiEIt3F+zAmDTkDlP
7cQOf+83v88gX0qBAFRtStBedsBUKiOyJz5udUvcnBFJ2qGo1MJpskT/ZXc0O2pt
tx6qwoVYp8y21JDfm1SepCy9oq3Wx9smfxTH6wCpqGD9DfrO1Wrp5MddSkOB3bb0
oFjGJJW91r9/7XsdWv03lS9RlQmXNw==
=rIGr
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 19 Sep 2018 21:52
(name . Marius Bakke)(address . mbakke@fastmail.com)
87k1nhfenz.fsf@gnu.org
Hello,

Marius Bakke <mbakke@fastmail.com> skribis:

Toggle quote (2 lines)
> Kei Kebreau <kkebreau@posteo.net> writes:

[...]

Toggle quote (3 lines)
>> Here's the search path patch. With this, I needed both nss-certs and
>> cURL installed alongside Octave to get certificates working.

This is expected (see https://issues.guix.info/issue/22138), which is
why I wrote it wouldn’t quite solve the issue; still, it’s a step in the
right direction. :-)

Toggle quote (17 lines)
>> diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
>> index 6d45dc0cc..8bdba8655 100644
>> --- a/gnu/packages/curl.scm
>> +++ b/gnu/packages/curl.scm
>> @@ -83,7 +83,10 @@
>> (variable "CURL_CA_BUNDLE")
>> (file-type 'regular)
>> (separator #f) ;single entry
>> - (files '("etc/ssl/certs/ca-certificates.crt")))))
>> + (files '("etc/ssl/certs/ca-certificates.crt")))
>> + (search-path-specification
>> + (variable "CURLOPT_CAPATH")
>> + (files '("etc/ssl/certs")))))
>
> Adding this native-search-path to the "octave" package should be
> sufficient.

I think we should avoid doing this though, because conceptually
CURLOPT_CAPATH “belongs” to cURL, not to Octave.

Toggle quote (3 lines)
> Then you won't need curl in the profile, nor do we need to rebuild all
> the things that depend on curl. Can you try that?

The patch above can go to the next ‘core-updates’ IMO.

Kei, what about the two other options we discussed? Namely:

Toggle quote (6 lines)
> 2. On GuixSD, we could define CURLOPT_CAPATH=/etc/ssl/certs in
> /etc/profile, like we already do for other variables.
>
> 3. We could document this variable under “X.509 Certificates” in the
> manual.

Thank you!

Ludo’.
M
M
Marius Bakke wrote on 19 Sep 2018 22:09
(name . Ludovic Courtès)(address . ludo@gnu.org)
87musdntad.fsf@fastmail.com
ludo@gnu.org (Ludovic Courtès) writes:

Toggle quote (35 lines)
> Hello,
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Kei Kebreau <kkebreau@posteo.net> writes:
>
> [...]
>
>>> Here's the search path patch. With this, I needed both nss-certs and
>>> cURL installed alongside Octave to get certificates working.
>
> This is expected (see <https://issues.guix.info/issue/22138>), which is
> why I wrote it wouldn’t quite solve the issue; still, it’s a step in the
> right direction. :-)
>
>>> diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
>>> index 6d45dc0cc..8bdba8655 100644
>>> --- a/gnu/packages/curl.scm
>>> +++ b/gnu/packages/curl.scm
>>> @@ -83,7 +83,10 @@
>>> (variable "CURL_CA_BUNDLE")
>>> (file-type 'regular)
>>> (separator #f) ;single entry
>>> - (files '("etc/ssl/certs/ca-certificates.crt")))))
>>> + (files '("etc/ssl/certs/ca-certificates.crt")))
>>> + (search-path-specification
>>> + (variable "CURLOPT_CAPATH")
>>> + (files '("etc/ssl/certs")))))
>>
>> Adding this native-search-path to the "octave" package should be
>> sufficient.
>
> I think we should avoid doing this though, because conceptually
> CURLOPT_CAPATH “belongs” to cURL, not to Octave.

Conceptually maybe, but to my knowledge libcurl itself does not support
run-time search paths (due to thread safety concerns IIRC).

This search path does seem to be Octave specific. From the ChangeLog:

Toggle snippet (10 lines)
2018-04-18 John W. Eaton <jwe@octave.org>

allow users to set path to CA certificates for cURL

* url-transfer.cc (curl_transfer::curl_transfer): Check for
CURLOPT_CAINFO and CURLOPT_CAPATH environment variables. If set, use
them to set the corresponding options for the cURL library.

Files: liboctave/util/url-transfer.cc
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAluirPoACgkQoqBt8qM6
VPpbtAgAh+mX4WIDduADOgwtwBexUoYsd2mUAU34ribqpnvYLTGDsOUAe1CKihcP
g8h9eutwYgdqNzisjn+1jIynWa7d1M8Ht0JBPGA8SbHiYSP8BXs8W7RIOjoatWTq
5mC4qh9ek/e5BngWn1TWqUDqEo0T8AlH23pnCvR6+ldy3MtKJ0SThAZ3/Up9Husu
MKwt9lNdGO2XV4v4MdhvzI+B9bCF5YB/WevC5rvjehffyQVhJUnoaZ5BBl4q4xTb
YEaBDyJ/vf3EiJ+Ecr1q52EUWW1OAfKx42rvO2i9xjpx2LkxbNf1gOx9RW/WGqI2
RbqJSnaYHQj6cqV25yuQ6jbe3I/mzQ==
=WDCx
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 19 Sep 2018 22:18
(name . Marius Bakke)(address . mbakke@fastmail.com)
871s9pfdgm.fsf@gnu.org
Marius Bakke <mbakke@fastmail.com> skribis:

Toggle quote (2 lines)
> ludo@gnu.org (Ludovic Courtès) writes:

[...]

Toggle quote (21 lines)
>>> Adding this native-search-path to the "octave" package should be
>>> sufficient.
>>
>> I think we should avoid doing this though, because conceptually
>> CURLOPT_CAPATH “belongs” to cURL, not to Octave.
>
> Conceptually maybe, but to my knowledge libcurl itself does not support
> run-time search paths (due to thread safety concerns IIRC).
>
> This search path does seem to be Octave specific. From the ChangeLog:
>
> 2018-04-18 John W. Eaton <jwe@octave.org>
>
> allow users to set path to CA certificates for cURL
>
> * url-transfer.cc (curl_transfer::curl_transfer): Check for
> CURLOPT_CAINFO and CURLOPT_CAPATH environment variables. If set, use
> them to set the corresponding options for the cURL library.
>
> Files: liboctave/util/url-transfer.cc

Oh, I stand corrected! Then the patch LGTM, maybe with a comment saying
that those variables are actually Octave-specific. :-)

Thank you!

Ludo’.
K
K
Kei Kebreau wrote on 20 Sep 2018 20:03
(name . Ludovic Courtès)(address . ludo@gnu.org)
87a7oct5av.fsf@posteo.net
ludo@gnu.org (Ludovic Courtès) writes:

Toggle quote (34 lines)
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
>
> [...]
>
>>>> Adding this native-search-path to the "octave" package should be
>>>> sufficient.
>>>
>>> I think we should avoid doing this though, because conceptually
>>> CURLOPT_CAPATH “belongs” to cURL, not to Octave.
>>
>> Conceptually maybe, but to my knowledge libcurl itself does not support
>> run-time search paths (due to thread safety concerns IIRC).
>>
>> This search path does seem to be Octave specific. From the ChangeLog:
>>
>> 2018-04-18 John W. Eaton <jwe@octave.org>
>>
>> allow users to set path to CA certificates for cURL
>>
>> * url-transfer.cc (curl_transfer::curl_transfer): Check for
>> CURLOPT_CAINFO and CURLOPT_CAPATH environment variables. If set, use
>> them to set the corresponding options for the cURL library.
>>
>> Files: liboctave/util/url-transfer.cc
>
> Oh, I stand corrected! Then the patch LGTM, maybe with a comment saying
> that those variables are actually Octave-specific. :-)
>
> Thank you!
>
> Ludo’.

Is it really Octave-specific? It's defined in the libcurl API [0], so
other software could make use of the variable.

L
L
Ludovic Courtès wrote on 24 Sep 2018 11:02
(name . Kei Kebreau)(address . kkebreau@posteo.net)
871s9jxo7o.fsf@gnu.org
Hello Kei,

Kei Kebreau <kkebreau@posteo.net> skribis:

Toggle quote (41 lines)
> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Marius Bakke <mbakke@fastmail.com> skribis:
>>
>>> ludo@gnu.org (Ludovic Courtès) writes:
>>
>> [...]
>>
>>>>> Adding this native-search-path to the "octave" package should be
>>>>> sufficient.
>>>>
>>>> I think we should avoid doing this though, because conceptually
>>>> CURLOPT_CAPATH “belongs” to cURL, not to Octave.
>>>
>>> Conceptually maybe, but to my knowledge libcurl itself does not support
>>> run-time search paths (due to thread safety concerns IIRC).
>>>
>>> This search path does seem to be Octave specific. From the ChangeLog:
>>>
>>> 2018-04-18 John W. Eaton <jwe@octave.org>
>>>
>>> allow users to set path to CA certificates for cURL
>>>
>>> * url-transfer.cc (curl_transfer::curl_transfer): Check for
>>> CURLOPT_CAINFO and CURLOPT_CAPATH environment variables. If set, use
>>> them to set the corresponding options for the cURL library.
>>>
>>> Files: liboctave/util/url-transfer.cc
>>
>> Oh, I stand corrected! Then the patch LGTM, maybe with a comment saying
>> that those variables are actually Octave-specific. :-)
>>
>> Thank you!
>>
>> Ludo’.
>
> Is it really Octave-specific? It's defined in the libcurl API [0], so
> other software could make use of the variable.
>
> [0]: https://curl.haxx.se/libcurl/c/CURLOPT_CAPATH.html

I think you’re both right. :-)

The ‘url-transfer.cc’ file in Octave mentioned above does this:

std::string cainfo = sys::env::getenv ("CURLOPT_CAINFO");
if (! cainfo.empty ())
SETOPT (CURLOPT_CAINFO, cainfo.c_str ());

std::string capath = sys::env::getenv ("CURLOPT_CAPATH");
if (! capath.empty ())
SETOPT (CURLOPT_CAPATH, capath.c_str ());

Based on that, I think it’s perfectly fine to add these two variables in
the ‘native-search-paths’ of Octave itself, probably with a comment
explaining that Octave really honors these variables by itself.

Feel free to push such a change!

Thank you,
Ludo’.
K
K
Kei Kebreau wrote on 25 Sep 2018 03:43
(name . Ludovic Courtès)(address . ludo@gnu.org)
87in2utkqz.fsf@posteo.net
ludo@gnu.org (Ludovic Courtès) writes:

Toggle quote (67 lines)
> Hello Kei,
>
> Kei Kebreau <kkebreau@posteo.net> skribis:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
>>
>>> Marius Bakke <mbakke@fastmail.com> skribis:
>>>
>>>> ludo@gnu.org (Ludovic Courtès) writes:
>>>
>>> [...]
>>>
>>>>>> Adding this native-search-path to the "octave" package should be
>>>>>> sufficient.
>>>>>
>>>>> I think we should avoid doing this though, because conceptually
>>>>> CURLOPT_CAPATH “belongs” to cURL, not to Octave.
>>>>
>>>> Conceptually maybe, but to my knowledge libcurl itself does not support
>>>> run-time search paths (due to thread safety concerns IIRC).
>>>>
>>>> This search path does seem to be Octave specific. From the ChangeLog:
>>>>
>>>> 2018-04-18 John W. Eaton <jwe@octave.org>
>>>>
>>>> allow users to set path to CA certificates for cURL
>>>>
>>>> * url-transfer.cc (curl_transfer::curl_transfer): Check for
>>>> CURLOPT_CAINFO and CURLOPT_CAPATH environment variables.
>>>> If set, use
>>>> them to set the corresponding options for the cURL library.
>>>>
>>>> Files: liboctave/util/url-transfer.cc
>>>
>>> Oh, I stand corrected! Then the patch LGTM, maybe with a comment saying
>>> that those variables are actually Octave-specific. :-)
>>>
>>> Thank you!
>>>
>>> Ludo’.
>>
>> Is it really Octave-specific? It's defined in the libcurl API [0], so
>> other software could make use of the variable.
>>
>> [0]: https://curl.haxx.se/libcurl/c/CURLOPT_CAPATH.html
>
> I think you’re both right. :-)
>
> The ‘url-transfer.cc’ file in Octave mentioned above does this:
>
> std::string cainfo = sys::env::getenv ("CURLOPT_CAINFO");
> if (! cainfo.empty ())
> SETOPT (CURLOPT_CAINFO, cainfo.c_str ());
>
> std::string capath = sys::env::getenv ("CURLOPT_CAPATH");
> if (! capath.empty ())
> SETOPT (CURLOPT_CAPATH, capath.c_str ());
>
> Based on that, I think it’s perfectly fine to add these two variables in
> the ‘native-search-paths’ of Octave itself, probably with a comment
> explaining that Octave really honors these variables by itself.
>
> Feel free to push such a change!
>
> Thank you,
> Ludo’.

Finally pushed to master! Thanks to both of you for reviewing this.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 32530@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 32530
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch