pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang/rust



Module Name:    pkgsrc
Committed By:   tnn
Date:           Tue Oct 21 18:46:02 UTC 2025

Modified Files:
        pkgsrc/lang/rust: distinfo
        pkgsrc/lang/rust/patches: patch-src_bootstrap_src_lib.rs

Log Message:
rust: work around panic when building as non-root

During the bootstrap it seems to copy everything under $PREFIX/lib to a
staging area for some reason. This is not ideal because it may lead to
circumvention buildlink3's intents. But more urgent is that it breaks
non-root builds if there are unreadable files (e.g. setuid binaries)
installed by other packages. Skip such files.

Thread 'main' panicked at src/bootstrap/src/lib.rs:1816:17:
failed to copy `/usr/pkg/lib/polkit-1/polkit-agent-helper-1` to `/tmp/pkgsrc-obj/lang/rust/work/rustc-1.90.0-src/build/aarch64-unknown-netbsd/stage0-sysroot/lib/polkit-1/polkit-agent-helper-1`: 
Permission denied (os error 13)


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 pkgsrc/lang/rust/distinfo
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/lang/rust/patches/patch-src_bootstrap_src_lib.rs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/rust/distinfo
diff -u pkgsrc/lang/rust/distinfo:1.191 pkgsrc/lang/rust/distinfo:1.192
--- pkgsrc/lang/rust/distinfo:1.191     Tue Oct 21 08:54:19 2025
+++ pkgsrc/lang/rust/distinfo   Tue Oct 21 18:46:02 2025
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.191 2025/10/21 08:54:19 jperkin Exp $
+$NetBSD: distinfo,v 1.192 2025/10/21 18:46:02 tnn Exp $
 
 BLAKE2s (rust-1.89.0-aarch64-apple-darwin.tar.gz) = f88fb0fd3e1204d91dc89948bc6ae38fd212d36d2973521bc3d47e72c6d13456
 SHA512 (rust-1.89.0-aarch64-apple-darwin.tar.gz) = e9ec8d8f60d1f38e01e389ec5d4f45f22c186b0fde9e2f68b7e869f4f2e54d049f7790d6863a85ad9335d317668dea52a39f055b2e30f17a0c3824d9f01d2ab8
@@ -119,7 +119,7 @@ SHA1 (patch-src_bootstrap_bootstrap.py) 
 SHA1 (patch-src_bootstrap_src_core_build__steps_compile.rs) = e928203ed4734c93cc33c5a3f7879cf18dcecc83
 SHA1 (patch-src_bootstrap_src_core_build__steps_install.rs) = cc6558df42c9c9ac28fdb2ff180bdaa7f22ce816
 SHA1 (patch-src_bootstrap_src_core_builder_cargo.rs) = b7ce18d045c2ef250817ee4b6ed57e0524d99e71
-SHA1 (patch-src_bootstrap_src_lib.rs) = b90a3b9044c4ad92a7ba50a9e3388f6a91caf9c6
+SHA1 (patch-src_bootstrap_src_lib.rs) = 735a3f6cbb3054200dd55eebce6e9acbd285f51e
 SHA1 (patch-src_llvm-project_llvm_CMakeLists.txt) = 446acdd51fb6ddcba733371263aa2f9949299d31
 SHA1 (patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake) = e1b2eb2f0b3cf1cf87b443656ae306b3242f6b12
 SHA1 (patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h) = cb011fc19957883c01725797f7c85ed1b20f96f1

Index: pkgsrc/lang/rust/patches/patch-src_bootstrap_src_lib.rs
diff -u pkgsrc/lang/rust/patches/patch-src_bootstrap_src_lib.rs:1.7 pkgsrc/lang/rust/patches/patch-src_bootstrap_src_lib.rs:1.8
--- pkgsrc/lang/rust/patches/patch-src_bootstrap_src_lib.rs:1.7 Mon Aug 25 17:51:12 2025
+++ pkgsrc/lang/rust/patches/patch-src_bootstrap_src_lib.rs     Tue Oct 21 18:46:02 2025
@@ -1,11 +1,12 @@
-$NetBSD: patch-src_bootstrap_src_lib.rs,v 1.7 2025/08/25 17:51:12 wiz Exp $
+$NetBSD: patch-src_bootstrap_src_lib.rs,v 1.8 2025/10/21 18:46:02 tnn Exp $
 
 Don't filter out optimization flags.
-FreeBSD has a particular C++ runtime library name
+FreeBSD has a particular C++ runtime library name.
+Don't assume files in ${PREFIX}/lib are readable by the building user.
 
---- src/bootstrap/src/lib.rs.orig      2024-01-06 20:52:50.892941220 +0000
+--- src/bootstrap/src/lib.rs.orig      2025-09-14 15:05:11.000000000 +0000
 +++ src/bootstrap/src/lib.rs
-@@ -1209,7 +1209,6 @@ Executed at: {executed_at}"#,
+@@ -1256,7 +1256,6 @@ impl Build {
          base.args()
              .iter()
              .map(|s| s.to_string_lossy().into_owned())
@@ -13,7 +14,7 @@ FreeBSD has a particular C++ runtime lib
              .collect::<Vec<String>>()
      }
  
-@@ -1225,7 +1224,8 @@ Executed at: {executed_at}"#,
+@@ -1272,7 +1271,8 @@ impl Build {
          // If we're compiling C++ on macOS then we add a flag indicating that
          // we want libc++ (more filled out than libstdc++), ensuring that
          // LLVM/etc are all properly compiled.
@@ -23,3 +24,17 @@ FreeBSD has a particular C++ runtime lib
              base.push("-stdlib=libc++".into());
          }
  
+@@ -1813,7 +1813,12 @@ impl Build {
+             // but if that fails just fall back to a slow `copy` operation.
+         } else {
+             if let Err(e) = fs::copy(&src, dst) {
+-                panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
++                if e.kind() == io::ErrorKind::PermissionDenied {
++                    eprintln!("Skipping copy of `{}` to `{}`: {}", src.display(), dst.display(), e);
++                    return;
++                } else {
++                    panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
++                }
+             }
+             t!(fs::set_permissions(dst, metadata.permissions()));
+ 



Home | Main Index | Thread Index | Old Index