u2fhud build breakage on musl libc

RESOLVED FIXED in Firefox 57

Status

()

defect
RESOLVED FIXED
2 years ago
2 months ago

People

(Reporter: anarchy, Assigned: ttaubert)

Tracking

57 Branch
mozilla58
Points:
---

Firefox Tracking Flags

(firefox57+ fixed, firefox58 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

2 years ago
error[E0308]: mismatched types
  --> /var/tmp/portage/www-client/firefox-57.0_beta4/work/firefox-57.0b4/dom/webauthn/u2f-hid-rs/src/linux/hidraw.rs:60:46
   |
60 |             from_unix_result(libc::ioctl(fd, ioc as libc::c_ulong, val))
   |                                              ^^^^^^^^^^^^^^^^^^^^ expected i32, found u64
...
66 | ioctl!(READ, hidiocgrdescsize, b'H', 0x01; ::libc::c_int);
   | ---------------------------------------------------------- in this macro invocation

error[E0308]: mismatched types
  --> /var/tmp/portage/www-client/firefox-57.0_beta4/work/firefox-57.0b4/dom/webauthn/u2f-hid-rs/src/linux/hidraw.rs:60:46
   |
60 |             from_unix_result(libc::ioctl(fd, ioc as libc::c_ulong, val))
   |                                              ^^^^^^^^^^^^^^^^^^^^ expected i32, found u64
...
67 | ioctl!(READ, hidiocgrdesc, b'H', 0x02; /*struct*/ ReportDescriptor);
   | -------------------------------------------------------------------- in this macro invocation

error: aborting due to 2 previous errors
@Andrea: Is it platform DOM component? (doesn't seem like dev tools issue).

Honza
Flags: needinfo?(amarchesini)
Component: Developer Tools: DOM → DOM
Flags: needinfo?(amarchesini) → needinfo?(ttaubert)
Product: Firefox → Core
(Reporter)

Comment 2

2 years ago
https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl/libc/fn.ioctl.html

pub unsafe extern "C" fn ioctl(fd: c_int, request: c_int, ...) -> c_int

https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu/libc/fn.ioctl.html

pub unsafe extern "C" fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int

As you can see linux-gnu uses the Linux Prototypes while, musl uses the Posix Prototypes.
(Reporter)

Comment 3

2 years ago
This is just a quick hack for those who are working on musl. We will need to find an appropriate solution that can be landed in tree.
(Assignee)

Updated

2 years ago
Assignee: nobody → ttaubert
Status: NEW → ASSIGNED
Flags: needinfo?(ttaubert)
Jory, can you please try the patch [1] I just submitted and report back whether that works for you? Thanks!

[1] https://phabricator.services.mozilla.com/D96?download=true
Flags: needinfo?(anarchy)
(Reporter)

Comment 5

2 years ago
Works as expected, tested with glibc and musl setups.
Flags: needinfo?(anarchy)
(In reply to Jory A. Pratt from comment #5)
> Works as expected, tested with glibc and musl setups.

Great, thank you!
Comment on attachment 8915074 [details]
Bug 1404556 - Support libc::ioctl() call on musl libc

J.C. Jones [:jcj] has approved the revision.

https://phabricator.services.mozilla.com/D96#2037
Attachment #8915074 - Flags: review+

Comment 8

2 years ago
Pushed by ttaubert@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d2b9f46b0447
Support libc::ioctl() call on musl libc

Comment 9

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/d2b9f46b0447
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
(Reporter)

Comment 10

2 years ago
[Tracking Requested - why for this release]:

Is a simple compile fix, nothing has changed that would cause breakage for glibc variants of Linux.
Please request Beta approval on this patch if it's something you feel should be fixed in 57 still.
Flags: needinfo?(ttaubert)
(Assignee)

Updated

2 years ago
Blocks: 1388843
Comment on attachment 8915074 [details]
Bug 1404556 - Support libc::ioctl() call on musl libc

Approval Request Comment
[Feature/Bug causing the regression]: bug 1388843
[User impact if declined]: No user impact, but may affect distributors.
[Is this code covered by automated tests?]: No.
[Has the fix been verified in Nightly?]: Yes.
[Needs manual test from QE? If yes, steps to reproduce]: 
[List of other uplifts needed for the feature/fix]:
[Is the change risky?]: No.
[Why is the change risky/not risky?]: It's a build-time change that doesn't alter behavior.
[String changes made/needed]: None.

I think this is something we should fix for 57. It's a change that will allow building Firefox 57 with musl. We're currently breaking things like Gentoo's "Hardened musl" project, and in general people that want to link against musl.
Flags: needinfo?(ttaubert)
Attachment #8915074 - Flags: approval-mozilla-beta?
Comment on attachment 8915074 [details]
Bug 1404556 - Support libc::ioctl() call on musl libc

NPOTB, Beta57+
Attachment #8915074 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Component: DOM → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.