Index | Thread | Search

From:
Matthieu Herrb <matthieu@openbsd.org>
Subject:
Re: ttyplot and amd64 snapshots
To:
Chris Lobkowicz <chris.lobkowicz@gmail.com>
Cc:
ports@openbsd.org
Date:
Thu, 23 Apr 2026 08:15:52 +0200

Download raw body.

Thread
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