git: 4e9f09f24982 - main - games/veloren-weekly: unbreak without security/ca_root_nss

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sat, 11 May 2024 00:40:08 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4e9f09f24982bde0785ab1cf8baafe0e419d161b

commit 4e9f09f24982bde0785ab1cf8baafe0e419d161b
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-05-10 22:45:31 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-05-11 00:39:35 +0000

    games/veloren-weekly: unbreak without security/ca_root_nss
    
    PanicInfo: panicked at cargo-crates/hyper-rustls-0.24.2/src/config.rs:48:9:
    no CA certificates found
    Game version: b47aa6ae [2024-05-09]
    
    Backtrace:
       0: veloren_voxygen::panic_handler::set_panic_hook::{{closure}}
       1: std::panicking::rust_panic_with_hook
       2: std::panicking::begin_panic_handler::{{closure}}
       3: std::sys_common::backtrace::__rust_end_short_backtrace
       4: rust_begin_unwind
       5: core::panicking::panic_fmt
       6: authc::AuthClient::new
       7: veloren_client::Client::new::{{closure}}
       8: veloren_voxygen::menu::main::client_init::ClientInit::new::{{closure}}
       9: tokio::runtime::task::raw::poll
      10: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
      11: tokio::runtime::scheduler::multi_thread::worker::run
      12: tokio::runtime::task::raw::poll
      13: std::sys_common::backtrace::__rust_begin_short_backtrace
      14: core::ops::function::FnOnce::call_once{{vtable.shim}}
      15: std::sys::pal::unix::thread::Thread::new::thread_start
      16: <unknown>
---
 games/veloren-weekly/Makefile                      |  2 +-
 .../veloren-weekly/files/patch-rustls-native-certs | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/games/veloren-weekly/Makefile b/games/veloren-weekly/Makefile
index 576eaffb3bd0..437539fc7ded 100644
--- a/games/veloren-weekly/Makefile
+++ b/games/veloren-weekly/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	veloren
 PORTVERSION=	s20240509
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	games wayland
 PKGNAMESUFFIX=	-weekly
 
diff --git a/games/veloren-weekly/files/patch-rustls-native-certs b/games/veloren-weekly/files/patch-rustls-native-certs
new file mode 100644
index 000000000000..f17a6074ac06
--- /dev/null
+++ b/games/veloren-weekly/files/patch-rustls-native-certs
@@ -0,0 +1,36 @@
+https://github.com/rustls/rustls-native-certs/issues/28
+https://github.com/rustls/rustls-native-certs/commit/8162b232045e
+
+--- cargo-crates/rustls-native-certs-0.6.3/src/unix.rs.orig	1970-01-01 00:00:00 UTC
++++ cargo-crates/rustls-native-certs-0.6.3/src/unix.rs
+@@ -1,13 +1,27 @@ use crate::Certificate;
+ use crate::load_pem_certs;
+ use crate::Certificate;
+ 
++use std::fs;
+ use std::io::Error;
+ 
+ pub fn load_native_certs() -> Result<Vec<Certificate>, Error> {
+     let likely_locations = openssl_probe::probe();
+ 
+-    match likely_locations.cert_file {
+-        Some(cert_file) => load_pem_certs(&cert_file),
+-        None => Ok(Vec::new()),
++    let mut certs = match likely_locations.cert_file {
++        Some(cert_file) => load_pem_certs(&cert_file)?,
++        None => Vec::new(),
++    };
++
++    if let Some(cert_dir) = likely_locations.cert_dir {
++        let dir_reader = fs::read_dir(cert_dir)?;
++        for entry in dir_reader {
++            let entry = entry?;
++            let path = entry.path();
++            if fs::metadata(&path)?.is_file() {
++                certs.append(&mut load_pem_certs(&path)?);
++            }
++        }
+     }
++
++    Ok(certs)
+ }