Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 935353

Summary: net-misc/openssh-9.8_p1-r1 fails to compile - error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
Product: Gentoo Linux Reporter: gresskar1
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: gresskar1, quincyf467, releng
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/37440
https://bugzilla.mindrot.org/show_bug.cgi?id=3707
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 870412    
Attachments: emerge --info
build log

Description gresskar1 2024-07-02 14:39:12 UTC
Created attachment 896804 [details]
emerge --info

net-misc/openssh-9.8_p1-r1 fails to compile on my x86_64 machine running hardened musl
Comment 1 gresskar1 2024-07-02 14:39:41 UTC
Created attachment 896805 [details]
build log
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-04 22:17:22 UTC
I think it might work better to -USYSTEMD_NOTIFY with musl.
Comment 4 Quincy Fleming 2024-07-05 05:20:13 UTC
That is better but I tried passing -USYSTEMD_NOTIFY without success so I removed the preprocessor define from configure.ac
Comment 5 Mike Gilbert gentoo-dev 2024-07-06 04:01:11 UTC
(In reply to Sam James from comment #3)
> I think it might work better to -USYSTEMD_NOTIFY with musl.

I disagree. The code is designed to be a noop when systemd is not being used.

It would be better to fix the compile failure than to disable the code specifically for musl.
Comment 6 Mike Gilbert gentoo-dev 2024-07-06 04:04:14 UTC
It looks like glibc's sys/socket.h has some macro magic to make all "struct sockaddr" types compatible with each other.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-06 04:10:23 UTC
(In reply to Mike Gilbert from comment #5)
> (In reply to Sam James from comment #3)
> > I think it might work better to -USYSTEMD_NOTIFY with musl.
> 
> I disagree. The code is designed to be a noop when systemd is not being used.
> 
> It would be better to fix the compile failure than to disable the code
> specifically for musl.

Obviously - but I'm talking about a hacky cast to make it build on musl when it's never going to be taken, but might break runtime on glibc, vs stubbing it.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-06 04:11:03 UTC
i.e. I'm not opposed to a patch, but the original one isn't obviously right and if we have to pick between the two, I'd take the macro being undefined. Feel free to look at doing it right if you have time though.
Comment 9 Mike Gilbert gentoo-dev 2024-07-06 15:35:35 UTC
As far as I am aware, casting to struct sockaddr * is the accepted way to deal with this.
Comment 10 Andreas K. Hüttel archtester gentoo-dev 2024-07-06 22:07:17 UTC
Blocking musl stages, e.g. on riscv
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-07 06:02:36 UTC
Reported https://bugzilla.mindrot.org/show_bug.cgi?id=3707.

floppym discussed it on IRC and I was being a bit anal, I think. I'll do the cast for now given OpenSSH builds with -fno-strict-aliasing.
Comment 12 Larry the Git Cow gentoo-dev 2024-07-07 08:44:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=452e53a96051ccb5000b6d1b923bc5f25aade72d

commit 452e53a96051ccb5000b6d1b923bc5f25aade72d
Author:     Quincy Fleming <quincyf467@protonmail.com>
AuthorDate: 2024-07-04 22:00:27 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-07-07 08:43:56 +0000

    net-misc/openssh: Fix compile error on musl
    
    Closes: https://github.com/gentoo/gentoo/pull/37440
    Closes: https://bugs.gentoo.org/935353
    Signed-off-by: Quincy Fleming <quincyf467@protonmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 net-misc/openssh/files/openssh-9.8_p1-musl-connect.patch | 13 +++++++++++++
 net-misc/openssh/openssh-9.8_p1-r2.ebuild                |  1 +
 2 files changed, 14 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d791fcea11352d79bb896d131433a4c12d5e2fee

commit d791fcea11352d79bb896d131433a4c12d5e2fee
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-07-07 08:43:34 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-07-07 08:43:57 +0000

    net-misc/openssh: switch to upstream variant of patch
    
    Bug: https://bugs.gentoo.org/935353
    Signed-off-by: Sam James <sam@gentoo.org>

 net-misc/openssh/files/openssh-9.8_p1-musl-connect.patch | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)