Skip to content

Commit 76b74b7

Browse files
committed
www-client/firefox: fix the build with musl-1.2.4
Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <orbea@riseup.net>
1 parent 1bb364a commit 76b74b7

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
https://github.com/rust-random/getrandom/pull/326
2+
https://github.com/rust-random/getrandom/commit/7f73e3ccc1f53bfc419e4ddcfd343766aa5837b6
3+
4+
From 7c80ae7cae663e5b85dcd953f3e93b13ed5b1b8e Mon Sep 17 00:00:00 2001
5+
From: Khem Raj <raj.khem@gmail.com>
6+
Date: Wed, 28 Dec 2022 21:44:17 -0800
7+
Subject: [PATCH] Use open instead of open64
8+
9+
glibc is providing open64 and other lfs64 functions but musl aliases
10+
them to normal equivalents since off_t is always 64-bit on musl,
11+
therefore check for target env along when target OS is linux before
12+
using open64, this is more available. Latest Musl has made these
13+
namespace changes [1]
14+
15+
There is no need for using LFS64 open explicitly as we are only using it
16+
for opening device files and not real files
17+
18+
[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
19+
20+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
21+
---
22+
src/util_libc.rs | 10 +---------
23+
1 file changed, 1 insertion(+), 9 deletions(-)
24+
25+
diff --git a/src/util_libc.rs b/src/util_libc.rs
26+
index 63b060e7..bd9c7de1 100644
27+
--- a/third_party/rust/getrandom/src/util_libc.rs
28+
+++ b/third_party/rust/getrandom/src/util_libc.rs
29+
@@ -140,19 +140,11 @@ impl Weak {
30+
}
31+
}
32+
33+
-cfg_if! {
34+
- if #[cfg(any(target_os = "linux", target_os = "emscripten"))] {
35+
- use libc::open64 as open;
36+
- } else {
37+
- use libc::open;
38+
- }
39+
-}
40+
-
41+
// SAFETY: path must be null terminated, FD must be manually closed.
42+
pub unsafe fn open_readonly(path: &str) -> Result<libc::c_int, Error> {
43+
debug_assert_eq!(path.as_bytes().last(), Some(&0));
44+
loop {
45+
- let fd = open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
46+
+ let fd = libc::open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
47+
if fd >= 0 {
48+
return Ok(fd);
49+
}

www-client/firefox/firefox-113.0.2.ebuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,9 @@ src_prepare() {
649649
! use ppc64 && rm -v "${WORKDIR}"/firefox-patches/*bmo-1775202-ppc64*.patch
650650

651651
eapply "${WORKDIR}/firefox-patches"
652+
eapply "${FILESDIR}"/${PN}-113.0.2-musl-1.2.4-getrandom.patch
653+
sed -e 's/2a63ac0e6dab16b85c4728b79a16e0640301e8b876f151b0a1db0b4394fa219f/a47b20e73637fed248405650f56358f3339e511b217b7ba80e32011d8ee2ca22/' \
654+
-i third_party/rust/getrandom/.cargo-checksum.json
652655

653656
# Allow user to apply any additional patches without modifing ebuild
654657
eapply_user

0 commit comments

Comments
 (0)