argv icon indicating copy to clipboard operation
argv copied to clipboard

Macos builds are failing

Open dtolnay opened this issue 5 years ago • 5 comments

Overnight all three of our nightly, beta, and stable macos builds began failing with:

thread 'test' panicked at 'assertion failed: `(left == right)`
  left: `""`,
 right: `"target/debug/examples/print\na\nb\nc\n"`', tests/test.rs:19:5

dtolnay avatar Jan 20 '20 09:01 dtolnay

Last good build: https://travis-ci.com/dtolnay/argv/jobs/277304972 First bad build: https://travis-ci.com/dtolnay/argv/jobs/277521343

dtolnay avatar Jan 20 '20 09:01 dtolnay

Has this been fixed?

MacOS seems to be passing on CI for a while now

vrmiguel avatar Nov 08 '21 12:11 vrmiguel

I think the same failure is still there: https://github.com/dtolnay/argv/runs/4146600747.

thread 'test' panicked at 'assertion failed: `(left == right)`
  left: `""`,
 right: `"target/x86_64-apple-darwin/debug/examples/print\na\nb\nc\n"`', tests/test.rs:31:5

On the master branch a6f326cd15728ac437e43c02670ae97f52b32b14 hides it by leaking memory.

dtolnay avatar Nov 09 '21 01:11 dtolnay

Was this fixed in a recent Rust version? On 1.60.0 tests pass with the following diff

diff --git src/lib.rs src/lib.rs
index f5b2bec6216e..079c53d0033a 100644
--- src/lib.rs
+++ src/lib.rs
@@ -72,7 +72,7 @@ impl ExactSizeIterator for Iter {
     }
 }
 
-#[cfg(all(target_os = "linux", not(target_env = "musl")))]
+#[cfg(all(target_os = "linux", target_os="macos", not(target_env = "musl")))]
 mod r#impl {
     use std::ffi::{CStr, OsStr};
     use std::mem;
@@ -88,7 +88,6 @@ mod r#impl {
     #[used]
     static CAPTURE: unsafe extern "C" fn(c_int, *const *const c_char) = capture;
 
-    // Disabled for now until we investigate https://github.com/dtolnay/argv/issues/1
     #[cfg_attr(target_os = "macos", link_section = "__DATA,__mod_init_func")]
     #[allow(dead_code)]
     unsafe extern "C" fn capture(argc: c_int, argv: *const *const c_char) {
@@ -145,7 +144,7 @@ mod r#impl {
     unsafe impl Sync for Iter {}
 }
 
-#[cfg(any(not(target_os = "linux"), target_env = "musl"))]
+#[cfg(any(not(target_os = "linux"), not(target_os = "macos"), target_env = "musl"))]
 mod r#impl {
     use std::ffi::OsStr;
     use std::sync::Once;

msfjarvis avatar May 19 '22 11:05 msfjarvis

No. The logic in your cfg changes is not correct.

dtolnay avatar May 19 '22 15:05 dtolnay