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

Bug#917000: rustc: Please include patch to fix incorrect fnctls on sparc64



Source: rustc
Version: 1.31.0+dfsg1-2
Severity: normal
Tags: patch upstream
User: debian-sparc@lists.debian.org
Usertags: sparc64

Hello!

The fnctl constants used by the file-locking API are hard-coded in the
code instead of using the libc crate. This causes the compiler to emit
the wrong fnctl for locking and in turn breaks incremental compilation [1].

The attached patch uses the correct fnctl constants for sparc64 to fix
the problem. I haven't checked the other architectures but it may be
worth to verify that the other non-x86 architectures are using the correct
constansts as well.

Once this patch has been integrated into the rustc Debian package, we can
remove the workaround in cargo to disable incremental builds on sparc64.

Note: I have not tested this patch yet, I am currently doing this but
      since the logic is simple and obvious, I have no doubt it will
      work correctly. I will report back later.

Thanks,
Adrian

> [1] https://github.com/rust-lang/rust/issues/57007

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Description: Use correct fnctl constants for sparc64
Author: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Bug: https://github.com/rust-lang/rust/issues/57007
Last-Update: 2018-12-21

--- rustc-1.31.0+dfsg1.orig/src/librustc_data_structures/flock.rs
+++ rustc-1.31.0+dfsg1/src/librustc_data_structures/flock.rs
@@ -42,11 +42,18 @@ cfg_if! {
                 pub l_sysid: libc::c_int,
             }
 
+	    #[cfg(target_arch = "sparc64")]
+            pub const F_RDLCK: libc::c_short = 1;
+            pub const F_WRLCK: libc::c_short = 2;
+            pub const F_UNLCK: libc::c_short = 3;
+            pub const F_SETLK: libc::c_int = 8;
+            pub const F_SETLKW: libc::c_int = 9;	    
+	    #[cfg(not(target_arch = "sparc64"))]
             pub const F_RDLCK: libc::c_short = 0;
             pub const F_WRLCK: libc::c_short = 1;
             pub const F_UNLCK: libc::c_short = 2;
             pub const F_SETLK: libc::c_int = 6;
-            pub const F_SETLKW: libc::c_int = 7;
+            pub const F_SETLKW: libc::c_int = 7;	    
         }
 
         #[cfg(target_os = "freebsd")]

Reply to: