Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
sysutils/rustic: drop current_exe() workaround
To:
Bjorn Ketelaars <bket@openbsd.org>
Cc:
OpenBSD ports <ports@openbsd.org>
Date:
Sat, 05 Sep 2026 15:53:20 +0200

Download raw body.

Thread
Bjorn,

rust in ports contains a patch to use getexecpath() for current_exe() that
makes this workaround outdate.

Ok to drop it?

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/sysutils/rustic/Makefile,v
diff -u -p -r1.36 Makefile
--- Makefile	18 Aug 2026 22:46:49 -0000	1.36
+++ Makefile	5 Sep 2026 13:23:45 -0000
@@ -10,6 +10,7 @@ USE_NOEXECONLY =	Yes
 COMMENT =		fast, encrypted, deduplicated backups
 
 DIST_TUPLE =		github rustic-rs rustic v0.11.4 .
+REVISION =		0
 
 CATEGORIES =		sysutils
 
Index: patches/patch-modcargo-crates_canonical-path-2_0_2_src_lib_rs
===================================================================
RCS file: patches/patch-modcargo-crates_canonical-path-2_0_2_src_lib_rs
diff -N patches/patch-modcargo-crates_canonical-path-2_0_2_src_lib_rs
--- patches/patch-modcargo-crates_canonical-path-2_0_2_src_lib_rs	6 May 2026 13:29:16 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-env::current_exe() is a no-op on OpenBSD; resolve via argv[0] instead.
-
-Index: modcargo-crates/canonical-path-2.0.2/src/lib.rs
---- modcargo-crates/canonical-path-2.0.2/src/lib.rs.orig
-+++ modcargo-crates/canonical-path-2.0.2/src/lib.rs
-@@ -327,8 +327,15 @@ impl ToOwned for CanonicalPath {
- /// Returns the full, canonicalized filesystem path of the current running
- /// executable.
- pub fn current_exe() -> Result<CanonicalPathBuf> {
--    let p = env::current_exe()?;
--    Ok(CanonicalPathBuf::canonicalize(p)?)
-+    let p = env::args().next().map(PathBuf::from)
-+        .ok_or_else(|| Error::new(ErrorKind::Other, "can't get argv[0]"))?;
-+
-+    CanonicalPathBuf::canonicalize(&p).or_else(|_| {
-+        env::var_os("PATH")
-+            .and_then(|paths| env::split_paths(&paths).map(|d| d.join(&p)).find(|f| f.exists()))
-+            .ok_or_else(|| Error::new(ErrorKind::NotFound, "executable not found"))
-+            .and_then(CanonicalPathBuf::canonicalize)
-+    })
- }
- 
- // TODO: test on Windows


-- 
wbr, Kirill