OpenSSH broken on HP-UX 10.x and fix

Darren Tucker dtucker at
Sat Nov 6 08:00:57 AEDT 2021

On Thu, Nov 04, 2021 at 10:33:58PM -0400, Larkin Nickle wrote:
> OpenSSH is broken on HP-UX 10.x as the libc has an undocumented `getline`
> which is detected by configure, openbsd-compat's `getline` ends up not being
> used. This causes a segfault as soon as you try to do anything useful with
> the built binaries.
> I think it could be worked around with something like this (after taking
> getline out of the long list of functions to check) in, but
> consider this as pseudocode as I don't know much about actually writing
> m4/for autoconf:

Usually we have a BROKEN_$THING to disable $THING in that case (grep for
BROKEN_SNPRINTF for an example), and there's an existing case statement
for HP-UX where we can put it.  Please try this patch (you'll need to
run "autoreconf" to rebuild configure).

diff --git a/ b/
index 57fcc9bc..67824888 100644
--- a/
+++ b/
@@ -765,6 +765,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
 		if test -z "$GCC"; then
+		AC_DEFINE([BROKEN_GETLINE], [1], [getine is not what we expect])
diff --git a/openbsd-compat/bsd-getline.c b/openbsd-compat/bsd-getline.c
index d676f4ce..a1c78e96 100644
--- a/openbsd-compat/bsd-getline.c
+++ b/openbsd-compat/bsd-getline.c
@@ -39,7 +39,7 @@
 #include "file.h"
+#if !defined(HAVE_GETLINE) && !defined(BROKEN_GETLINE)
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>

Darren Tucker (dtucker at
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list