Index | Thread | Search

From:
Chris Lobkowicz <chris.lobkowicz@gmail.com>
Subject:
Re: ttyplot and amd64 snapshots
To:
Matthieu Herrb <matthieu@herrb.eu>
Cc:
ports@openbsd.org
Date:
Thu, 23 Apr 2026 00:34:02 -0600

Download raw body.

Thread
Hi Matthieu,

I am but a user, not a developer.
To test your patch, I would have to checkout the ports tree (assuming
current) and apply your diff to ttyplot, compile, and test - to verify.

I assume I can try this in an openbsd vm, so I do not pollute my current
system?

I think I can attempt this, I'll get back to you in a couple of days with
some results.

Kind regards,
Chris


------------------------------------
Chris Lobkowicz
chris.lobkowicz@gmail.com


On Thu, Apr 23, 2026 at 12:16 AM Matthieu Herrb <matthieu@herrb.eu> wrote:

> On Wed, Apr 22, 2026 at 09:15:30PM -0600, Chris Lobkowicz wrote:
> > I just switched over to snapshots (from 7.8-stable) to take advantage of
> > the vmd virtio updates, and then noticed that ttyplot looks to be limited
> > by pledge.
> >
> > When I invoke "vmstat 1 | awk 'NR>2 { print 100-$(NF); fflush(); }' |
> > ttyplot -t "Cpu usage" -s 100"
> > I get a "waiting for data from stdinttyplot[23086]: pledge "rpath",
> syscall
> > 5" and then Abort trap (core dump).
> >
> > I assume the dump may not interest you - as either I am doing something
> > wrong, or I somehow need to convince pledge/unveil to allow me do my
> > ttyplot invocation.
> >
> > I wanted to let you know, as ttyplot may not be high on the list of
> > packages needing attention.
> >
> > Thank you for your time.
> >
>
> Thanks for the report. This is caused by the pledge tighting changes
> that happenned a couple of weeks ago.
>
> Possible fix is to postpone the pledge() call after /dev/tty has been
> opened.
>
> ok?
>
> Index: Makefile
> ===================================================================
> RCS file: /local/cvs/ports/sysutils/ttyplot/Makefile,v
> diff -u -p -u -r1.18 Makefile
> --- Makefile    15 Sep 2025 10:58:51 -0000      1.18
> +++ Makefile    23 Apr 2026 06:12:57 -0000
> @@ -3,6 +3,7 @@ COMMENT =       realtime plotting utility for
>  GH_ACCOUNT =   tenox7
>  GH_PROJECT =   ttyplot
>  GH_TAGNAME =   1.7.4
> +REVISION =     0
>
>  CATEGORIES =   sysutils
>
> Index: patches/patch-ttyplot_c
> ===================================================================
> RCS file: /local/cvs/ports/sysutils/ttyplot/patches/patch-ttyplot_c,v
> diff -u -p -u -r1.4 patch-ttyplot_c
> --- patches/patch-ttyplot_c     15 Sep 2025 10:58:51 -0000      1.4
> +++ patches/patch-ttyplot_c     23 Apr 2026 06:12:57 -0000
> @@ -12,3 +12,26 @@ Index: ttyplot.c
>   #define _XOPEN_SOURCE_EXTENDED
>   #else
>   // This is needed for musl libc
> +@@ -923,10 +923,6 @@ int main(int argc, char *argv[]) {
> +         exit(1);
> +     }
> +
> +-#ifdef __OpenBSD__
> +-    if (pledge("stdio tty", NULL) == -1)
> +-        err(1, "pledge");
> +-#endif
> +
> +     // Check if any colors are defined
> +     bool has_colors = false;
> +@@ -986,6 +982,11 @@ int main(int argc, char *argv[]) {
> +
> +     signal(SIGWINCH, signal_handler);
> +     signal(SIGINT, signal_handler);
> ++
> ++#ifdef __OpenBSD__
> ++    if (pledge("stdio tty", NULL) == -1)
> ++        err(1, "pledge");
> ++#endif
> +
> +     while (1) {
> +         struct timeval timeout =
> calculate_clock_refresh_timeout_from(now.tv_usec);
>
> --
> Matthieu Herrb
>