Repository: alex/rust-asn1 (language: rust)

Issue:
rust-asn1 fails to build on platforms other than X86_64
I'm unable to build rust-asn1 0.4.1 on platforms other than X86_64, https://koji.fedoraproject.org/koji/taskinfo?taskID=67487715

* Rust 1.52
* crates
```
DEBUG util.py:446:  Installed:
DEBUG util.py:446:    rust-asn1_derive+default-devel-0.4.1-1.fc35.noarch                            
DEBUG util.py:446:    rust-asn1_derive-devel-0.4.1-1.fc35.noarch                                    
DEBUG util.py:446:    rust-autocfg+default-devel-1.0.1-2.fc34.noarch                                
DEBUG util.py:446:    rust-autocfg-devel-1.0.1-2.fc34.noarch                                        
DEBUG util.py:446:    rust-chrono+alloc-devel-0.4.19-2.fc34.noarch                                  
DEBUG util.py:446:    rust-chrono-devel-0.4.19-2.fc34.noarch                                        
DEBUG util.py:446:    rust-libc+default-devel-0.2.94-1.fc35.noarch                                  
DEBUG util.py:446:    rust-libc+std-devel-0.2.94-1.fc35.noarch                                      
DEBUG util.py:446:    rust-libc-devel-0.2.94-1.fc35.noarch                                          
DEBUG util.py:446:    rust-num-integer-devel-0.1.44-2.fc34.noarch                                   
DEBUG util.py:446:    rust-num-traits-devel-0.2.14-2.fc34.noarch                                    
DEBUG util.py:446:    rust-proc-macro2+default-devel-1.0.26-1.fc35.noarch                           
DEBUG util.py:446:    rust-proc-macro2+proc-macro-devel-1.0.26-1.fc35.noarch                        
DEBUG util.py:446:    rust-proc-macro2-devel-1.0.26-1.fc35.noarch                                   
DEBUG util.py:446:    rust-quote+default-devel-1.0.9-1.fc35.noarch                                  
DEBUG util.py:446:    rust-quote+proc-macro-devel-1.0.9-1.fc35.noarch                               
DEBUG util.py:446:    rust-quote-devel-1.0.9-1.fc35.noarch                                          
DEBUG util.py:446:    rust-syn+clone-impls-devel-1.0.71-1.fc35.noarch                               
DEBUG util.py:446:    rust-syn+default-devel-1.0.71-1.fc35.noarch                                   
DEBUG util.py:446:    rust-syn+derive-devel-1.0.71-1.fc35.noarch                                    
DEBUG util.py:446:    rust-syn+extra-traits-devel-1.0.71-1.fc35.noarch                              
DEBUG util.py:446:    rust-syn+parsing-devel-1.0.71-1.fc35.noarch                                   
DEBUG util.py:446:    rust-syn+printing-devel-1.0.71-1.fc35.noarch                                  
DEBUG util.py:446:    rust-syn+proc-macro-devel-1.0.71-1.fc35.noarch                                
DEBUG util.py:446:    rust-syn-devel-1.0.71-1.fc35.noarch                                           
DEBUG util.py:446:    rust-unicode-xid+default-devel-0.2.2-1.fc35.noarch                            
DEBUG util.py:446:    rust-unicode-xid-devel-0.2.2-1.fc35.noarch        
```

## i686 test failure

```
failures:
---- parser::tests::test_parse_octet_string stdout ----
thread 'parser::tests::test_parse_octet_string' panicked at 'assertion failed: `(left == right)`
  left: `Err(IntegerOverflow)`,
 right: `Err(ShortData)`', src/parser.rs:229:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
    parser::tests::test_parse_octet_string
test result: FAILED. 51 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
     Running `/builddir/build/BUILD/asn1-0.4.1/target/release/deps/derive_test-dc0283dbf88cd38b`
running 7 tests
```

## armv7hl, aarch64, ppc64le, s390x build failure

```
error[E0308]: mismatched types
  --> examples/no_std.rs:13:45
   |
13 |         Ok((r, s)) => unsafe { libc::printf(b"r=%ld, s=%ld\n\x00".as_ptr() as *const i8, r, s) },
   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
error[E0308]: mismatched types
  --> examples/no_std.rs:14:41
   |
14 |         Err(_) => unsafe { libc::printf("Error\n\x00".as_ptr() as *const i8) },
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
error[E0308]: mismatched types
  --> examples/no_std.rs:25:13
   |
25 |             "Original length: %ld\nComputed length: %ld\n\x00".as_ptr() as *const i8,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.
error: could not compile `asn1`
```



Discussion / hints:

Fix patch:
diff --git a/examples/no_std.rs b/examples/no_std.rs
index fae8c6e..a8f7587 100644
--- a/examples/no_std.rs
+++ b/examples/no_std.rs
@@ -10,8 +10,10 @@ fn main() {
 
     // Using libc::printf because println! isn't no_std!
     match result {
-        Ok((r, s)) => unsafe { libc::printf(b"r=%ld, s=%ld\n\x00".as_ptr() as *const i8, r, s) },
-        Err(_) => unsafe { libc::printf("Error\n\x00".as_ptr() as *const i8) },
+        Ok((r, s)) => unsafe {
+            libc::printf(b"r=%ld, s=%ld\n\x00".as_ptr() as *const libc::c_char, r, s)
+        },
+        Err(_) => unsafe { libc::printf("Error\n\x00".as_ptr() as *const libc::c_char) },
     };
 
     let computed = asn1::write(|w| {
@@ -22,7 +24,7 @@ fn main() {
     });
     unsafe {
         libc::printf(
-            "Original length: %ld\nComputed length: %ld\n\x00".as_ptr() as *const i8,
+            "Original length: %ld\nComputed length: %ld\n\x00".as_ptr() as *const libc::c_char,
             data.len() as i64,
             computed.len() as i64,
         );
diff --git a/src/parser.rs b/src/parser.rs
index 7e62cd0..16cfe9d 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -327,7 +327,7 @@ mod tests {
                 b"\x04\x89\x01\x01\x01\x01\x01\x01\x01\x01\x01"
             ),
             (Err(ParseError::ShortData), b"\x04\x03\x01\x02"),
-            (Err(ParseError::ShortData), b"\x04\x86\xff\xff\xff\xff\xff\xff"),
+            (Err(ParseError::ShortData), b"\x04\x83\xff\xff\xff\xff\xff\xff"),
         ]);
     }
 


Test patch: