You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/10/17 06:43:23 UTC

(maka) branch rust-preview updated: fix(cli): preserve panic unwinding in macOS debug builds

This is an automated email from the ASF dual-hosted git repository.

M4n5ter pushed a commit to branch rust-preview
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/rust-preview by this push:
     new 30cc2c1d62 fix(cli): preserve panic unwinding in macOS debug builds
30cc2c1d62 is described below

commit 30cc2c1d6274def3f15540aa6128d0f8ffb6fc8d
Author: Wang <m4...@gmail.com>
AuthorDate: Sat Oct 17 14:43:17 2026 +0800

    fix(cli): preserve panic unwinding in macOS debug builds
    
    Remove the compact-unwind override and verify caught panic payloads and exactly-once stack cleanup in both CLI test artifacts.
    
    Generated-by: Codex
---
 products/maka/cli/build.rs                         |  5 ----
 products/maka/cli/notices.json                     |  2 +-
 products/maka/cli/src/main.rs                      |  2 ++
 .../{tests/integration/main.rs => src/tests.rs}    | 29 ++++++++++++++++------
 products/maka/cli/tests/integration/main.rs        |  2 ++
 5 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/products/maka/cli/build.rs b/products/maka/cli/build.rs
index 8bf46da76b..c8ae402455 100644
--- a/products/maka/cli/build.rs
+++ b/products/maka/cli/build.rs
@@ -35,10 +35,5 @@ fn main() {
     }
     if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
         println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
-        if std::env::var("PROFILE").as_deref() == Ok("debug") {
-            // The unoptimized Host exceeds compact unwind's 16 MiB DWARF
-            // offset limit. Use DWARF unwinding directly for development builds.
-            println!("cargo:rustc-link-arg=-Wl,-no_compact_unwind");
-        }
     }
 }
diff --git a/products/maka/cli/notices.json b/products/maka/cli/notices.json
index 4098ebe9a8..f755454c7e 100644
--- a/products/maka/cli/notices.json
+++ b/products/maka/cli/notices.json
@@ -436,7 +436,7 @@
     "products/maka/bundle/src/composition.ts": "c3ef908bb77fd6a65aeb38635709dec650c6b0a84840910df0b90433d342cfeb",
     "products/maka/bundle/src/installation.ts": "614e9ed4ee41c26f9a398da21b1c5a4b41d91a22080a472d64207c5826e491fc",
     "products/maka/cli/Cargo.toml": "2a41d9dd434d08bb62cfe784e32b9e9facd41c58bbe9eb1b809b3fde3a2ed446",
-    "products/maka/cli/build.rs": "98452274bb0f20fa55fda5a20313f81740e759652aa4227fba0b0de5e3f4cc29",
+    "products/maka/cli/build.rs": "852960c81f7f6ee03e882eabfa07603bcb8727b98f22a3e6e2552e6e375668cd",
     "products/maka/cli/build/product.rs": "6302eefa7c818dbd73e75f7796d331542315b79032a62727fa43f53413c25766",
     "products/maka/desktop/Cargo.toml": "6c1bdac5c0eb0d3f205005af94837fac3abb904441d9e8fa2096469ab606ac8e",
     "products/maka/native/Cargo.toml": "4a3c69dfe3d7e5773316dbd0f703ec376cbaef0a7b9915fce395b8460c633d76",
diff --git a/products/maka/cli/src/main.rs b/products/maka/cli/src/main.rs
index 65ebb33bae..3fa91280fc 100644
--- a/products/maka/cli/src/main.rs
+++ b/products/maka/cli/src/main.rs
@@ -36,6 +36,8 @@ mod sandbox;
 mod serve;
 mod signals;
 mod startup;
+#[cfg(test)]
+mod tests;
 #[cfg(windows)]
 mod windows;
 
diff --git a/products/maka/cli/tests/integration/main.rs b/products/maka/cli/src/tests.rs
similarity index 50%
copy from products/maka/cli/tests/integration/main.rs
copy to products/maka/cli/src/tests.rs
index a0030c3aff..09cf2101b6 100644
--- a/products/maka/cli/tests/integration/main.rs
+++ b/products/maka/cli/src/tests.rs
@@ -17,10 +17,25 @@
  * under the License.
  */
 
-mod application;
-mod candidate;
-mod code_command;
-#[cfg(unix)]
-mod desktop;
-mod sandbox;
-mod terminal;
+// Both CLI test targets must preserve stack cleanup under the package's
+// native linker configuration, including the large V8-bearing binary.
+#[test]
+fn caught_panic_runs_original_stack_cleanup() {
+    use std::sync::atomic::{AtomicUsize, Ordering};
+
+    struct Guard<'a>(&'a AtomicUsize);
+    impl Drop for Guard<'_> {
+        fn drop(&mut self) {
+            self.0.fetch_add(1, Ordering::SeqCst);
+        }
+    }
+
+    let drops = AtomicUsize::new(0);
+    let result = std::panic::catch_unwind(|| {
+        let _guard = Guard(&drops);
+        panic!("CLI unwind probe");
+    });
+    let payload = result.expect_err("the original panic must reach its handler");
+    assert_eq!(payload.downcast_ref::<&str>(), Some(&"CLI unwind probe"));
+    assert_eq!(drops.load(Ordering::SeqCst), 1);
+}
diff --git a/products/maka/cli/tests/integration/main.rs b/products/maka/cli/tests/integration/main.rs
index a0030c3aff..79aa9bd8a1 100644
--- a/products/maka/cli/tests/integration/main.rs
+++ b/products/maka/cli/tests/integration/main.rs
@@ -24,3 +24,5 @@ mod code_command;
 mod desktop;
 mod sandbox;
 mod terminal;
+#[path = "../../src/tests.rs"]
+mod unwind;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org