Bug 391367 - KIO 5.43: FTBFS with musl libc on 64-bit platforms
Summary: KIO 5.43: FTBFS with musl libc on 64-bit platforms
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.43.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-04 04:46 UTC by A. Wilcox (awilfox)
Modified: 2018-04-08 11:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description A. Wilcox (awilfox) 2018-03-04 04:46:31 UTC
musl is strictly POSIX conformant, which means it uses int for msg_iovlen and socklen_t for msg_controllen in the msghdr struct.  (See http://git.musl-libc.org/cgit/musl/commit/arch/x86_64/bits/socket.h?id=7168790763cdeb794df52be6e3b39fbb021c5a64 for more information.)

POSIX defines msghdr as containing "at least" the standard members.  (See http://pubs.opengroup.org/onlinepubs/009696699/basedefs/sys/socket.h.html for citation.)

Since the new shared fd code in KIO (non-conformantly) assumes the members and layout of msghdr in its ctor, it FTBFS on 64-bit musl platforms (including x86_64, ppc64, aarch64):

In file included from /usr/src/packages/user/kio/src/kio-5.43.0/src/ioslaves/file/fdreceiver.cpp:23:0:
/usr/src/packages/user/kio/src/kio-5.43.0/src/ioslaves/file/sharefd_p.h: In constructor 'FDMessageHeader::FDMessageHeader()':
/usr/src/packages/user/kio/src/kio-5.43.0/src/ioslaves/file/sharefd_p.h:78:37: error: invalid conversion from 'char (*)[24]' to 'int' [-fpermissive]
         , msg{nullptr, 0,  &io, 1,  &cmsg_buf, sizeof cmsg_buf, 0}
                                     ^~~~~~~~~
/usr/src/packages/user/kio/src/kio-5.43.0/src/ioslaves/file/sharefd_p.h:78:55: error: invalid conversion from 'long unsigned int' to 'void*' [-fpermissive]
         , msg{nullptr, 0,  &io, 1,  &cmsg_buf, sizeof cmsg_buf, 0}
                                                       ^~~~~~~~
/usr/src/packages/user/kio/src/kio-5.43.0/src/ioslaves/file/sharefd_p.h:78:66: warning: missing initializer for member 'msghdr::__pad2' [-Wmissing-field-initializers]
         , msg{nullptr, 0,  &io, 1,  &cmsg_buf, sizeof cmsg_buf, 0}
                                                                  ^
/usr/src/packages/user/kio/src/kio-5.43.0/src/ioslaves/file/sharefd_p.h:78:66: warning: missing initializer for member 'msghdr::msg_flags' [-Wmissing-field-initializers]
Comment 1 Chinmoy Ranjan Pradhan 2018-03-04 10:57:05 UTC
Git commit 2a2a8a0fe5ab882482784c90b217770266b460f4 by Chinmoy Ranjan Pradhan.
Committed on 04/03/2018 at 10:56.
Pushed by chinmoyr into branch 'master'.

Do not assume layout of msghdr and iovec structure

Summary:
Class FDMessageHeader assumes the layout of msghdr and iovec structure in its constructor. However, this assumption is wrong
because as per POSIX standards both may contain more members than usual. This patch fixes the issue.

Reviewers: dfaure, awilcox

Subscribers: #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D11011

M  +9    -2    src/ioslaves/file/sharefd_p.h

https://commits.kde.org/kio/2a2a8a0fe5ab882482784c90b217770266b460f4