Skip to content

Commit

Permalink
{influxdb, influxdb2}: fix build on aarch64-linux
Browse files Browse the repository at this point in the history
An inadvertent reliance on `char` being signed crept into `libflux`;
this patch specifies a signed 8-bit type for the literal and then
explicitly casts to the appropriate platform `c_char` type.
  • Loading branch information
magneticflux- committed Jun 16, 2024
1 parent 746c184 commit d7aecd3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkgs/servers/nosql/influxdb/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ let
excludes = [ ];
hash = "sha256-6LOTgbOCfETNTmshyXgtDZf9y4t/2iqRuVPkz9dYPHc=";
})
../influxdb2/fix-unsigned-char.patch
];
sourceRoot = "${src.name}/libflux";
cargoHash = "sha256-O+t4f4P5291BuyARH6Xf3LejMFEQEBv+qKtyjHRhclA=";
Expand Down
1 change: 1 addition & 0 deletions pkgs/servers/nosql/influxdb2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ let
excludes = [ ];
hash = "sha256-6LOTgbOCfETNTmshyXgtDZf9y4t/2iqRuVPkz9dYPHc=";
})
./fix-unsigned-char.patch
];
sourceRoot = "${src.name}/libflux";
cargoHash = "sha256-O+t4f4P5291BuyARH6Xf3LejMFEQEBv+qKtyjHRhclA=";
Expand Down
13 changes: 13 additions & 0 deletions pkgs/servers/nosql/influxdb2/fix-unsigned-char.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/flux/src/cffi.rs b/flux/src/cffi.rs
index ba18e3d5..0c1badf8 100644
--- a/flux/src/cffi.rs
+++ b/flux/src/cffi.rs
@@ -1149,7 +1149,7 @@ from(bucket: v.bucket)
fn parse_with_invalid_utf8() {
let cfname = CString::new("foo.flux").unwrap();
let cfname_ptr: *const c_char = cfname.as_ptr();
- let v: Vec<c_char> = vec![-61, 0];
+ let v: Vec<c_char> = vec![-61i8 as c_char, 0];
let csrc: *const c_char = &v[0];
// Safety: both pointers are valid
let pkg = unsafe { flux_parse(cfname_ptr, csrc) };

0 comments on commit d7aecd3

Please sign in to comment.