NetBSD Problem Report #56936

From www@netbsd.org  Fri Jul 22 11:15:18 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8A6EC1A923C
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Jul 2022 11:15:18 +0000 (UTC)
Message-Id: <20220722111516.8C6B11A923D@mollari.NetBSD.org>
Date: Fri, 22 Jul 2022 11:15:16 +0000 (UTC)
From: rokuyama.rk@gmail.com
Reply-To: rokuyama.rk@gmail.com
To: gnats-bugs@NetBSD.org
Subject: posix_openpt(O_RDWR | O_NOCTTY) fails when configuring pkgsrc/x11/mlterm
X-Send-Pr-Version: www-1.0

>Number:         56936
>Category:       pkg
>Synopsis:       posix_openpt(O_RDWR | O_NOCTTY) fails when configuring pkgsrc/x11/mlterm
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gutteridge
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 22 11:20:00 +0000 2022
>Closed-Date:    Tue Oct 08 07:34:47 +0000 2024
>Last-Modified:  Thu Apr 03 16:35:01 +0000 2025
>Originator:     Rin Okuyama
>Release:        9.0, 9.2 (?)
>Organization:
Department of Physics, Meiji University
>Environment:
NetBSD nb9 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
pkgsrc/x11/mlterm tries to detect whether system has working
posix_openpt(3) as:

mlterm-3.9.2/baselib/configure:
----
...
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <fcntl.h>
int
main ()
{
return posix_openpt(O_RDWR | O_NOCTTY) == -1;
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
...
----

This is expected to pass for NetBSD, but it does not for some cases.

For official package build of pkgsrc-2022Q[12] and -2021Q4 for amd64,
i386, and aarch64 (for 9.0), this test failed and configure fell back
to old BSD pty.

Also, there is report on netbsd-users@, in which x11/mlterm is
misconfigured for NetBSD/amd64 9.2:

https://mail-index.netbsd.org/netbsd-users/2022/07/21/msg028733.html

On the other hand, for pkgsrc-current for NetBSD/amd64 9.0:

http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/.9.0-current-2022-07-15-22.09-being-update/All/mlterm-3.9.2nb3.tgz

this test succeeded, and mlterm uses posix_openpt(3) appropriately.

Also, I could not reproduce the problem by myself for freshly-installed
NetBSD/amd64 9.2:

- Manually compiled conftest.c above passes as expected.
- x11/mlterm from pkgsrc-2022Q2 is successfully configured to use
  posix_openpt(3).
>How-To-Repeat:
N/A
>Fix:
N/A

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Fri, 22 Jul 2022 22:37:44 +0000

 On Fri, Jul 22, 2022 at 11:20:01AM +0000, rokuyama.rk@gmail.com wrote:
  > For official package build of pkgsrc-2022Q[12] and -2021Q4 for amd64,
  > i386, and aarch64 (for 9.0), this test failed and configure fell back
  > to old BSD pty.
  > 
  > Also, there is report on netbsd-users@, in which x11/mlterm is
  > misconfigured for NetBSD/amd64 9.2:
  > 
  > https://mail-index.netbsd.org/netbsd-users/2022/07/21/msg028733.html
  > 
  > On the other hand, for pkgsrc-current for NetBSD/amd64 9.0:
  > 
  > http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/.9.0-current-2022-07-15-22.09-being-update/All/mlterm-3.9.2nb3.tgz
  > 
  > this test succeeded, and mlterm uses posix_openpt(3) appropriately.
  > 
  > Also, I could not reproduce the problem by myself for freshly-installed
  > NetBSD/amd64 9.2:
  > 
  > - Manually compiled conftest.c above passes as expected.
  > - x11/mlterm from pkgsrc-2022Q2 is successfully configured to use
  >   posix_openpt(3).

 Someone needs to check config.log from a machine where it failed to
 see what the error message is.

 It's almost certainly something silly.

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David H. Gutteridge" <david@gutteridge.ca>
To: Gnats Bugs <gnats-bugs@netbsd.org>, dholland@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when 
 configuring pkgsrc/x11/mlterm
Date: Tue, 06 Sep 2022 18:29:00 -0400

 On Fri, Jul 22, 2022 at 11:20:01AM +0000, rokuyama.rk@gmail.com wrote:
 > For official package build of pkgsrc-2022Q[12] and -2021Q4 for amd64,
 > i386, and aarch64 (for 9.0), this test failed and configure fell back
 > to old BSD pty.
 > 
 > Also, there is report on netbsd-users@, in which x11/mlterm is
 > misconfigured for NetBSD/amd64 9.2:
 > 
 > https://mail-index.netbsd.org/netbsd-users/2022/07/21/msg028733.html
 > 
 > On the other hand, for pkgsrc-current for NetBSD/amd64 9.0:
 > 
 > http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/.9.0-current-2022-07-15-22.09-being-update/All/mlterm-3.9.2nb3.tgz
 > 
 > this test succeeded, and mlterm uses posix_openpt(3) appropriately.
 > 
 > Also, I could not reproduce the problem by myself for freshly-installed
 > NetBSD/amd64 9.2:
 > 
 > - Manually compiled conftest.c above passes as expected.
 > - x11/mlterm from pkgsrc-2022Q2 is successfully configured to use
 >   posix_openpt(3).

 The cause of the issue is that the package uses AC_RUN_IFELSE to check
 if the posix_openpt(3) call *succeeds at runtime[1]*, not just if it
 compiles and links. If the build environment is sandboxed, then the
 call to open /dev/ptmx will fail, and the package will fall back to the
 old "bsd" implementation instead.

 The fix would be to remove the runtime check in the configure script,
 if we want it reliably building in official (presumably sandboxed)
 builds. I've had to do that in the past for other packages that did
 something similar.

 1. See baselib/configure.in starting at line 279

 Dave

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Tue, 6 Sep 2022 22:45:05 +0000

 On Tue, Sep 06, 2022 at 10:30:03PM +0000, David H. Gutteridge wrote:
  >  The cause of the issue is that the package uses AC_RUN_IFELSE to check
  >  if the posix_openpt(3) call *succeeds at runtime[1]*, not just if it
  >  compiles and links. If the build environment is sandboxed, then the
  >  call to open /dev/ptmx will fail, and the package will fall back to the
  >  old "bsd" implementation instead.

 Ugh.

 On the one hand, it's good for configure tests to check that things
 actually work, because sometimes they don't. On the other hand, it's
 annoying in cases like this.

  >  The fix would be to remove the runtime check in the configure script,
  >  if we want it reliably building in official (presumably sandboxed)
  >  builds. I've had to do that in the past for other packages that did
  >  something similar.

 CONFIGURE_ENV+=ac_cv_mumble=yes if NetBSD is the most expedient way.

 Problem is, I suspect even now not everyone uses ptyfs.

 What does it fall back to? openpty(3) ought to work correctly whether
 or not ptyfs is present. (And why doesn't posix_openpt?)

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David H. Gutteridge" <david@gutteridge.ca>
To: Gnats Bugs <gnats-bugs@netbsd.org>, dholland-pbugs@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when configuring
 pkgsrc/x11/mlterm
Date: Wed, 07 Sep 2022 17:33:46 -0400

 On Tue, 6 Sep 2022 at 22:50:02 +0000 (UTC), David Holland wrote:
 > CONFIGURE_ENV+=ac_cv_mumble=yes if NetBSD is the most expedient way.

 It seems "CONFIGURE_ENV+= bl_cv_pty=streams" was already tried:

 http://mail-index.netbsd.org/netbsd-users/2022/07/22/msg028743.html

 I don't follow why it was reported as not working, as it worked for me
 in my sandboxed environment. (I see now the reporter was using a
 sandbox, too.) With that, I end up with mlterm using posix_openpt(3).

 > What does it fall back to? openpty(3) ought to work correctly whether
 > or not ptyfs is present. (And why doesn't posix_openpt?)

 It falls back to its own home-rolled "open_pty" function, which
 ultimately does

 if ((*master = open(name, O_RDWR, 0)) == -1)

 following its own hard-coded list of "old-style" BSD ptys.

 Inside a sandbox, I went as far as ktracing the posix_openpt(3) call,
 which results in:
    1963      1 open_test2 CALL  open(0x400b7e,0,0x7f7fff5f3328)
    1963      1 open_test2 NAMI  "/dev/ptmx"
    1963      1 open_test2 RET   open -1 errno 45 Operation not supported

 Inside a sandbox, openpty(3) also doesn't work, as I'd noticed since
 script(1) fails to work in that context.

 script: openpty: No such file or directory

   22686      1 script   CALL  open(0x6fd6ee21228c,2,0)
   22686      1 script   NAMI  "/dev/ptm"
   22686      1 script   RET   open 4
   22686      1 script   CALL  ioctl(4,TIOCPTMGET,0x7f7fffd49b00)
   22686      1 script   RET   ioctl -1 errno 45 Operation not supported

 Dave

State-Changed-From-To: open->analyzed
State-Changed-By: gutteridge@NetBSD.org
State-Changed-When: Wed, 07 Sep 2022 21:49:34 +0000
State-Changed-Why:
Issue analyzed.

Responsible-Changed-From-To: pkg-manager->gutteridge
Responsible-Changed-By: gutteridge@NetBSD.org
Responsible-Changed-When: Wed, 07 Sep 2022 21:51:17 +0000
Responsible-Changed-Why:
Take, since I've done the analysis.

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
	rokuyama.rk@gmail.com
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Thu, 8 Sep 2022 00:55:33 +0200

 Am Wed, Sep 07, 2022 at 09:35:01PM +0000 schrieb David H. Gutteridge:
 >  Inside a sandbox, openpty(3) also doesn't work, as I'd noticed since
 >  script(1) fails to work in that context.
 >  
 >  script: openpty: No such file or directory
 >  
 >    22686      1 script   CALL  open(0x6fd6ee21228c,2,0)
 >    22686      1 script   NAMI  "/dev/ptm"
 >    22686      1 script   RET   open 4
 >    22686      1 script   CALL  ioctl(4,TIOCPTMGET,0x7f7fffd49b00)
 >    22686      1 script   RET   ioctl -1 errno 45 Operation not supported

 That means your sandbox is not configured correctly. Do you have
 /dev/pts null-mounted in the chroot?

 Joerg

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org, joerg@bec.de
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Wed, 07 Sep 2022 21:25:39 -0400

 On Wed, 2022-09-07 at 23:00 +0000, Joerg Sonnenberger wrote:
 > The following reply was made to PR pkg/56936; it has been noted by
 > GNATS.
 >=20
 > From: Joerg Sonnenberger <joerg@bec.de>
 > To: gnats-bugs@netbsd.org
 > Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org,
 > pkgsrc-bugs@netbsd.org,
 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0rokuyama.rk@gmail.com
 > Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 > =C2=A0configuring pkgsrc/x11/mlterm
 > Date: Thu, 8 Sep 2022 00:55:33 +0200
 >=20
 > =C2=A0Am Wed, Sep 07, 2022 at 09:35:01PM +0000 schrieb David H. Gutteridg=
 e:
 > =C2=A0>=C2=A0 Inside a sandbox, openpty(3) also doesn't work, as I'd noti=
 ced
 > since
 > =C2=A0>=C2=A0 script(1) fails to work in that context.
 > =C2=A0>=C2=A0=20
 > =C2=A0>=C2=A0 script: openpty: No such file or directory
 > =C2=A0>=C2=A0=20
 > =C2=A0>=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 script=C2=
 =A0=C2=A0 CALL=C2=A0 open(0x6fd6ee21228c,2,0)
 > =C2=A0>=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 script=C2=
 =A0=C2=A0 NAMI=C2=A0 "/dev/ptm"
 > =C2=A0>=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 script=C2=
 =A0=C2=A0 RET=C2=A0=C2=A0 open 4
 > =C2=A0>=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 script=C2=
 =A0=C2=A0 CALL=C2=A0 ioctl(4,TIOCPTMGET,0x7f7fffd49b00)
 > =C2=A0>=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 script=C2=
 =A0=C2=A0 RET=C2=A0=C2=A0 ioctl -1 errno 45 Operation not
 > supported
 > =C2=A0
 > =C2=A0That means your sandbox is not configured correctly. Do you have
 > =C2=A0/dev/pts null-mounted in the chroot?
 > =C2=A0
 > =C2=A0Joerg
 >=20

 No, I don't. I never even noticed any of this until I was trying to
 diagnose this particular issue, my (limited) bulk builds always "just
 worked" for me. (I don't use mlterm.)

 My basis for defining the sandbox has always been essentially what
 pkgtools/mksandbox does, which doesn't seem to cover this case (and I'm
 guessing that's true for some other installations, or they follow some
 other similar means of definition).

 Dave

From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: agc@NetBSD.org
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Thu, 8 Sep 2022 07:17:21 +0200

 On Thu, Sep 08, 2022 at 12:55:33AM +0200, Joerg Sonnenberger wrote:
 > Am Wed, Sep 07, 2022 at 09:35:01PM +0000 schrieb David H. Gutteridge:
 > >  Inside a sandbox, openpty(3) also doesn't work, as I'd noticed since
 > >  script(1) fails to work in that context.
 > >  
 > >  script: openpty: No such file or directory
 > >  
 > >    22686      1 script   CALL  open(0x6fd6ee21228c,2,0)
 > >    22686      1 script   NAMI  "/dev/ptm"
 > >    22686      1 script   RET   open 4
 > >    22686      1 script   CALL  ioctl(4,TIOCPTMGET,0x7f7fffd49b00)
 > >    22686      1 script   RET   ioctl -1 errno 45 Operation not supported
 > 
 > That means your sandbox is not configured correctly. Do you have
 > /dev/pts null-mounted in the chroot?

 If that's a requirement, pkgtools/mksandbox should learn about it -
 AFAICT it doesn't handle this.
  Thomas

From: "David H. Gutteridge" <gutteridge@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56936 CVS commit: pkgsrc/x11/mlterm
Date: Sat, 10 Sep 2022 00:14:19 +0000

 Module Name:	pkgsrc
 Committed By:	gutteridge
 Date:		Sat Sep 10 00:14:19 UTC 2022

 Modified Files:
 	pkgsrc/x11/mlterm: Makefile

 Log Message:
 mlterm: force consistent builds with posix_openpt(3) on NetBSD

 Work around the fact this package tests whether posix_openpt(3) works at
 runtime. This fails in typical sandboxed build environments (including
 TNF's used for official binary builds), which causes a fallback to use
 "old-style" BSD ptys, which can result in runtime failures.

 Addresses PR pkg/56936. Needs monitoring to ensure official TNF binary
 packages now behave as expected.


 To generate a diff of this commit:
 cvs rdiff -u -r1.175 -r1.176 pkgsrc/x11/mlterm/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Sat, 10 Sep 2022 04:01:04 +0000

 On Wed, Sep 07, 2022 at 11:00:03PM +0000, Joerg Sonnenberger wrote:
  >  >  Inside a sandbox, openpty(3) also doesn't work, as I'd noticed since
  >  >  script(1) fails to work in that context.
  >  >  
  >  >  script: openpty: No such file or directory
  >  >  
  >  >    22686      1 script   CALL  open(0x6fd6ee21228c,2,0)
  >  >    22686      1 script   NAMI  "/dev/ptm"
  >  >    22686      1 script   RET   open 4
  >  >    22686      1 script   CALL  ioctl(4,TIOCPTMGET,0x7f7fffd49b00)
  >  >    22686      1 script   RET   ioctl -1 errno 45 Operation not supported
  >  
  >  That means your sandbox is not configured correctly. Do you have
  >  /dev/pts null-mounted in the chroot?

 Openpty falls back to opening pty devices, so it should work
 regardless of whether /dev/pts is present. Unless you have no ptys at
 all in the sandbox, and that does seem like a configuration error.

 -- 
 David A. Holland
 dholland@netbsd.org

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Sat, 10 Sep 2022 04:05:25 +0000

 also,

 On Wed, Sep 07, 2022 at 09:35:01PM +0000, David H. Gutteridge wrote:
  >  > What does it fall back to? openpty(3) ought to work correctly whether
  >  > or not ptyfs is present. (And why doesn't posix_openpt?)
  >  
  >  It falls back to its own home-rolled "open_pty" function, which
  >  ultimately does
  >  
  >  if ((*master = open(name, O_RDWR, 0)) == -1)
  >  
  >  following its own hard-coded list of "old-style" BSD ptys.

 Ugh. I mean, you need that code if you want to run everywhere, but it
 ought to know about openpty().

 (My question about posix_openpt stands, too.)

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org, dholland-pbugs@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Sun, 11 Sep 2022 17:11:51 -0400

 On Sat, 2022-09-10 at 04:05 +0000, David Holland wrote:
 > The following reply was made to PR pkg/56936; it has been noted by
 > GNATS.
 >=20
 > From: David Holland <dholland-pbugs@netbsd.org>
 > To: gnats-bugs@netbsd.org
 > Cc:=20
 > Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 > =C2=A0configuring pkgsrc/x11/mlterm
 > Date: Sat, 10 Sep 2022 04:01:04 +0000
 >=20
 > =C2=A0On Wed, Sep 07, 2022 at 11:00:03PM +0000, Joerg Sonnenberger wrote:
 > =C2=A0 >=C2=A0 >=C2=A0 Inside a sandbox, openpty(3) also doesn't work, as=
  I'd noticed
 > since
 > =C2=A0 >=C2=A0 >=C2=A0 script(1) fails to work in that context.
 > =C2=A0 >=C2=A0 >=C2=A0=20
 > =C2=A0 >=C2=A0 >=C2=A0 script: openpty: No such file or directory
 > =C2=A0 >=C2=A0 >=C2=A0=20
 > =C2=A0 >=C2=A0 >=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 =
 script=C2=A0=C2=A0 CALL=C2=A0 open(0x6fd6ee21228c,2,0)
 > =C2=A0 >=C2=A0 >=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 =
 script=C2=A0=C2=A0 NAMI=C2=A0 "/dev/ptm"
 > =C2=A0 >=C2=A0 >=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 =
 script=C2=A0=C2=A0 RET=C2=A0=C2=A0 open 4
 > =C2=A0 >=C2=A0 >=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 =
 script=C2=A0=C2=A0 CALL=C2=A0
 > ioctl(4,TIOCPTMGET,0x7f7fffd49b00)
 > =C2=A0 >=C2=A0 >=C2=A0=C2=A0=C2=A0 22686=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1 =
 script=C2=A0=C2=A0 RET=C2=A0=C2=A0 ioctl -1 errno 45 Operation not
 > supported
 > =C2=A0 >=C2=A0=20
 > =C2=A0 >=C2=A0 That means your sandbox is not configured correctly. Do yo=
 u have
 > =C2=A0 >=C2=A0 /dev/pts null-mounted in the chroot?
 > =C2=A0
 > =C2=A0Openpty falls back to opening pty devices, so it should work
 > =C2=A0regardless of whether /dev/pts is present. Unless you have no ptys =
 at
 > =C2=A0all in the sandbox, and that does seem like a configuration error.

 openpty(3) does fall back to trying to open pty devices, and fails like
 so:

  22686      1 script   CALL  open(0x7f7fffd496d5,2,0)
  22686      1 script   NAMI  "/dev/ptyp0"
  22686      1 script   RET   open -1 errno 2 No such file or directory

 There are no pty devices in the sandboxes I have, because there are also
 none under actual /dev. They are not populated in any installs I have,
 presumably on purpose given it says in MAKEDEV "creating BSD style tty
 nodes with ptyfs is a security issue"?

 Dave

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56936: posix_openpt(O_RDWR | O_NOCTTY) fails when
 configuring pkgsrc/x11/mlterm
Date: Wed, 14 Sep 2022 03:51:44 +0000

 On Sun, Sep 11, 2022 at 09:15:02PM +0000, David H. Gutteridge wrote:
  >  openpty(3) does fall back to trying to open pty devices, and fails like
  >  so:
  >  
  >   22686      1 script   CALL  open(0x7f7fffd496d5,2,0)
  >   22686      1 script   NAMI  "/dev/ptyp0"
  >   22686      1 script   RET   open -1 errno 2 No such file or directory
  >  
  >  There are no pty devices in the sandboxes I have, because there are also
  >  none under actual /dev. They are not populated in any installs I have,
  >  presumably on purpose given it says in MAKEDEV "creating BSD style tty
  >  nodes with ptyfs is a security issue"?

 The security problem arises if you have both ptyfs and old-style pty
 devices, because they are attached to the same internal objects but
 have their own file permissions, which will then mostly be wrong.
 Don't do that.

 Having some ptys in the chroot that are the same as ptys you're using
 outside isn't good either, but creating one that's high-enough
 numbered that you won't use it elsewhere by accident is fine. So is
 inserting a copy of ptyfs via null mount, though this makes all your
 ordinary ptys accessible there so you need to be sure not to use the
 same uids as outside.

 However, having no ptys at all is bound to break some stuff, like,
 apparently, mlterm. :-(

 (And I still wonder about posix_openpt. If we intend to continue to
 support old-style ptys, it's broken. If not, the old code in openpty
 should probably be G/C'd. This is a matter for a different PR though.)

 -- 
 David A. Holland
 dholland@netbsd.org

From: Mayuresh <mayuresh@acm.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/56936
Date: Fri, 4 Oct 2024 18:08:50 +0530

 Would like to add an observation:

 pkgsrc version of mlterm has now changed to 3.9.3

 On NetBSD 9.2 amd64 I noticed this line in config.log:

     bl_cv_pty=bsd

 Is this change in mlterm/Makefile not working anymore?

     .if ${OPSYS} == "NetBSD"
     CONFIGURE_ENV+=         bl_cv_pty=streams
     .endif

 mlterm gets built, but can't open as it says "Failed to open pty". This is
 so even for root.

From: Mayuresh <mayuresh@acm.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/56936
Date: Sat, 5 Oct 2024 09:59:46 +0530

 On Fri, Oct 04, 2024 at 06:08:54PM +0530, Mayuresh wrote:

 Further, ktrace shows following kind of error:

  14159      1 mlterm   CALL  open(0x7f7fff471bed,2,0)
  14159      1 mlterm   NAMI  "/dev/ptyp0"
  14159      1 mlterm   RET   open -1 errno 5 Input/output error

 -- 
 Mayuresh

From: Mayuresh <mayuresh@acm.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/56936
Date: Sat, 5 Oct 2024 10:58:31 +0530

 On Sat, Oct 05, 2024 at 09:59:50AM +0530, Mayuresh wrote:

 Further I confirm that setting 'bl_cv_pty=streams' in configure script
 still solves the problem.

 Just that it's not clear to me what is a clean way to do it. For above
 trial I just replaced bl_cv_pty=bsd with bl_cv_pty=streams at 3 places in
 the configure script.

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56936
Date: Mon, 07 Oct 2024 19:25:12 -0400

 On 2024-10-05 01:30, Mayuresh via gnats wrote:
 > The following reply was made to PR pkg/56936; it has been noted by 
 > GNATS.
 > 
 > From: Mayuresh <mayuresh@acm.org>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: pkg/56936
 > Date: Sat, 5 Oct 2024 10:58:31 +0530
 > 
 > On Sat, Oct 05, 2024 at 09:59:50AM +0530, Mayuresh wrote:
 > 
 > Further I confirm that setting 'bl_cv_pty=streams' in configure script
 > still solves the problem.
 > 
 > Just that it's not clear to me what is a clean way to do it. For above
 > trial I just replaced bl_cv_pty=bsd with bl_cv_pty=streams at 3 places 
 > in
 > the configure script.

 The upstream project modified a configure.in definition in the 3.9.3
 release here:

 https://github.com/arakiken/mlterm/commit/abe3282fc7b6952450cf6000222a19729f3cb7cc

 In summary, they removed this:

 -AC_CACHE_VAL(bl_cv_pty,
 [etc.]

 This means they no longer allow builders to override the value of
 bl_cv_pty as an argument to configure. I'm not sure if that was done
 deliberately, or just something cut for simplicity's sake when other
 changes were being made. Later on, they also moved the file location of
 this check itself, in its newer form.

 (Again, another fix would be simply to populate a pbulk sandbox with
 the expected pseudo-terminal devices so the runtime check succeeds.)

 Dave

From: "David H. Gutteridge" <gutteridge@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56936 CVS commit: pkgsrc/x11/mlterm
Date: Tue, 8 Oct 2024 00:06:10 +0000

 Module Name:	pkgsrc
 Committed By:	gutteridge
 Date:		Tue Oct  8 00:06:10 UTC 2024

 Modified Files:
 	pkgsrc/x11/mlterm: Makefile distinfo
 	pkgsrc/x11/mlterm/patches: patch-configure

 Log Message:
 mlterm: allow bl_cv_pty to be overridden as a configure argument

 As of 3.9.3, the configure script was altered to no longer allow
 builders to override the value of bl_cv_pty as an argument. Restore the
 previous capability, in order to continue to address PR pkg/56936.


 To generate a diff of this commit:
 cvs rdiff -u -r1.195 -r1.196 pkgsrc/x11/mlterm/Makefile
 cvs rdiff -u -r1.100 -r1.101 pkgsrc/x11/mlterm/distinfo
 cvs rdiff -u -r1.22 -r1.23 pkgsrc/x11/mlterm/patches/patch-configure

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org, mayuresh@acm.org
Cc: 
Subject: Re: pkg/56936
Date: Mon, 07 Oct 2024 20:23:33 -0400

 Mayuresh,

 Please re-confirm whether this fixes it for you. (It builds as expected
 for me in a sandboxed build environment with no relevant pseudo-
 terminals.)

 Dave

From: Mayuresh <mayuresh@acm.org>
To: "David H. Gutteridge" <david@gutteridge.ca>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/56936
Date: Tue, 8 Oct 2024 11:24:04 +0530

 On Mon, Oct 07, 2024 at 08:23:33PM -0400, David H. Gutteridge wrote:
 > Please re-confirm whether this fixes it for you. (It builds as expected
 > for me in a sandboxed build environment with no relevant pseudo-
 > terminals.)

 Yes, builds and runs fine for me.

 -- 
 Mayuresh

State-Changed-From-To: analyzed->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Tue, 08 Oct 2024 07:34:47 +0000
State-Changed-Why:
Submitter confirmed that the migtigation works.


From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56936 CVS commit: pkgsrc/x11/mlterm
Date: Thu, 3 Apr 2025 16:33:08 +0000

 Module Name:	pkgsrc
 Committed By:	tsutsui
 Date:		Thu Apr  3 16:33:08 UTC 2025

 Modified Files:
 	pkgsrc/x11/mlterm: Makefile PLIST distinfo hacks.mk options.mk
 	pkgsrc/x11/mlterm/patches: patch-configure
 Removed Files:
 	pkgsrc/x11/mlterm/patches: patch-common_c__imagelib.c
 	    patch-common_c__sixel.c patch-configure.in
 	    patch-contrib_scrollbar_pixmap__engine_pixmap__engine.c
 	    patch-doc_ja_README.ja patch-drcssixel_DRCS-SIXEL-v2
 	    patch-libvterm_vterm.c patch-man_mlterm.1
 	    patch-tool_mlconfig_Makefile.in patch-tool_mlimgloader_Makefile.in
 	    patch-tool_mlimgloader_gdk-pixbuf.c patch-tool_mlimgloader_libpng.c
 	    patch-tool_mlimgloader_stb__image__resize2.h
 	    patch-uitoolkit_beos_ui__imagelib.c
 	    patch-uitoolkit_console_ui__imagelib.c
 	    patch-uitoolkit_fb_ui__imagelib.c
 	    patch-uitoolkit_fb_ui__virtual__kbd.c
 	    patch-uitoolkit_quartz_ui__imagelib.c
 	    patch-uitoolkit_ui__copymode.c patch-uitoolkit_ui__copymode.h
 	    patch-uitoolkit_ui__draw__str.c patch-uitoolkit_ui__imagelib.h
 	    patch-uitoolkit_ui__picture.c patch-uitoolkit_ui__picture.h
 	    patch-uitoolkit_ui__sb__view.h patch-uitoolkit_ui__screen.c
 	    patch-uitoolkit_ui__screen__manager.c patch-uitoolkit_ui__xic.h
 	    patch-uitoolkit_win32_ui__imagelib.c
 	    patch-uitoolkit_xlib_ui__imagelib.c patch-uitoolkit_xlib_ui__xic.c
 	    patch-vtemu_Makefile.in patch-vtemu_vt__char.h
 	    patch-vtemu_vt__edit.c patch-vtemu_vt__parser.c
 	    patch-vtemu_vt__parser.h

 Log Message:
 mlterm: update to 3.9.4.

 pkgsrc changes:
 - remove patches already integrated into the upstream source tree
 - remove hack for PR pkg/56936 fixed by upstream issue #113
   https://github.com/arakiken/mlterm/issues/113
 - add options libssh2 (disabled by default)
 - misc pkglint

 Upstream changes (from doc/en/ReleaseNote):

 ver 3.9.4
 * Support Shift+Control+v and Shift+Control+c to copy&paste via clipboard by default.
   Drop -P/--clip/use_clipboard option.
   Add --chsel/change_selection_immediately option in anything except xlib and wayland.
 * Add COPY_CLIPBOARD shortcut key.
 * Pressing '?' in copy mode searches for a string backward.
   (https://github.com/arakiken/mlterm/issues/72)
 * Support wp-primary-selection protocol in wayland.
 * Support "exesel:" operation in ~/.mlterm/key in win32.
 * Support libvte compatible library in win32. (See gtk/README)
 * Support ConPTY in win32.
 * Support Alternate Scroll Mode. (https://github.com/arakiken/mlterm/issues/80)
 * Support P2=1 in sixel graphics. (https://github.com/arakiken/mlterm/issues/81)
 * Support libpng to build mlimgloader if gdk-pixbuf is not found.
   (https://github.com/arakiken/mlterm/issues/96)
 * Support Emoji variation selectors 15 and 16. (https://github.com/arakiken/mlterm/issues/84)
 * Add --conpty/use_conpty and --winsize/output_xtwinops_in_resizing options in win32.
 * Add --norepkey/mod_keys_to_stop_mouse_report option.
 * Add --clp/use_clipping option. (https://github.com/arakiken/mlterm/issues/132)
 * Add tool/accessories/applycfg.sh and applyfontcfg.sh
   (https://github.com/arakiken/mlterm/issues/71)
 * Add "de", "fr", "es", "pt" and "jp106" to available values for "kbd"
   input method argument.
 * Add vte 0.78 API symbols to libvte compatible library.
 * Change the default value of "xterm" entry in etc/termcap from "ut" to "kb=^H:ut".
 * Update unicode property table (generated from UnicodeData.txt and
   EastAsianWidth.txt) to version 15.1.0.
 * Merge patches:
   https://github.com/arakiken/mlterm/pull/68
   https://github.com/arakiken/mlterm/pull/83 (Add --locktitle/use_locked_title option)
   https://github.com/arakiken/mlterm/pull/119
 * Bug fixes:
   https://github.com/arakiken/mlterm/issues/52
   https://github.com/arakiken/mlterm/issues/67
   https://github.com/arakiken/mlterm/issues/69
   https://github.com/arakiken/mlterm/issues/73
   https://github.com/arakiken/mlterm/issues/78
   https://github.com/arakiken/mlterm/issues/79
   https://github.com/arakiken/mlterm/issues/92
   https://github.com/arakiken/mlterm/issues/97
   https://github.com/arakiken/mlterm/issues/103
   https://github.com/arakiken/mlterm/issues/107
   https://github.com/arakiken/mlterm/issues/111
   https://github.com/arakiken/mlterm/issues/113
   https://github.com/arakiken/mlterm/issues/118
   https://github.com/arakiken/mlterm/issues/124
   https://github.com/arakiken/mlterm/issues/125
   https://github.com/arakiken/mlterm/issues/126
   https://github.com/arakiken/mlterm/issues/127
   https://github.com/arakiken/mlterm/issues/128
   https://github.com/arakiken/mlterm/issues/129
   https://github.com/arakiken/mlterm/issues/137
   Fix an issue where mlconfig was not displayed.
   Fix an issue where Control+Shift+xxx shortcut didn't work in SDL2.
   Fix unexpected reset of inverted colors in selected area in SDL2.
   Fix --point / use_point_size option which broke font width in win32.
   Fix drawing glyphs in incorrect position with some fonts, such as devanagari.
   (https://github.com/arakiken/mlterm/issues/131)


 To generate a diff of this commit:
 cvs rdiff -u -r1.202 -r1.203 pkgsrc/x11/mlterm/Makefile
 cvs rdiff -u -r1.47 -r1.48 pkgsrc/x11/mlterm/PLIST
 cvs rdiff -u -r1.101 -r1.102 pkgsrc/x11/mlterm/distinfo
 cvs rdiff -u -r1.2 -r1.3 pkgsrc/x11/mlterm/hacks.mk
 cvs rdiff -u -r1.25 -r1.26 pkgsrc/x11/mlterm/options.mk
 cvs rdiff -u -r1.5 -r0 pkgsrc/x11/mlterm/patches/patch-common_c__imagelib.c
 cvs rdiff -u -r1.1 -r0 pkgsrc/x11/mlterm/patches/patch-common_c__sixel.c \
     pkgsrc/x11/mlterm/patches/patch-contrib_scrollbar_pixmap__engine_pixmap__engine.c \
     pkgsrc/x11/mlterm/patches/patch-doc_ja_README.ja \
     pkgsrc/x11/mlterm/patches/patch-drcssixel_DRCS-SIXEL-v2 \
     pkgsrc/x11/mlterm/patches/patch-libvterm_vterm.c \
     pkgsrc/x11/mlterm/patches/patch-man_mlterm.1 \
     pkgsrc/x11/mlterm/patches/patch-tool_mlconfig_Makefile.in \
     pkgsrc/x11/mlterm/patches/patch-tool_mlimgloader_Makefile.in \
     pkgsrc/x11/mlterm/patches/patch-tool_mlimgloader_gdk-pixbuf.c \
     pkgsrc/x11/mlterm/patches/patch-tool_mlimgloader_libpng.c \
     pkgsrc/x11/mlterm/patches/patch-tool_mlimgloader_stb__image__resize2.h \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_beos_ui__imagelib.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_console_ui__imagelib.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_fb_ui__imagelib.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_fb_ui__virtual__kbd.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_quartz_ui__imagelib.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__copymode.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__copymode.h \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__draw__str.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__imagelib.h \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__picture.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__picture.h \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__sb__view.h \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__screen.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__screen__manager.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_ui__xic.h \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_win32_ui__imagelib.c \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_xlib_ui__xic.c \
     pkgsrc/x11/mlterm/patches/patch-vtemu_Makefile.in \
     pkgsrc/x11/mlterm/patches/patch-vtemu_vt__char.h \
     pkgsrc/x11/mlterm/patches/patch-vtemu_vt__edit.c \
     pkgsrc/x11/mlterm/patches/patch-vtemu_vt__parser.h
 cvs rdiff -u -r1.23 -r1.24 pkgsrc/x11/mlterm/patches/patch-configure
 cvs rdiff -u -r1.3 -r0 pkgsrc/x11/mlterm/patches/patch-configure.in \
     pkgsrc/x11/mlterm/patches/patch-vtemu_vt__parser.c
 cvs rdiff -u -r1.6 -r0 \
     pkgsrc/x11/mlterm/patches/patch-uitoolkit_xlib_ui__imagelib.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.