From: Rafael Sadowski Subject: Re: update: wayland/havoc 0.7.0 To: Matthieu Herrb Cc: ports@openbsd.org Date: Wed, 30 Jul 2025 19:50:48 +0200 On Wed Jul 30, 2025 at 05:14:13PM +0200, Matthieu Herrb wrote: > relatively straightforward. Upstream has improved portability, so 2 > patches can go away. > > ok ? > > Index: Makefile > =================================================================== > RCS file: /local/cvs/ports/wayland/havoc/Makefile,v > diff -u -p -u -r1.5 Makefile > --- Makefile 5 Nov 2024 17:43:45 -0000 1.5 > +++ Makefile 30 Jul 2025 15:10:58 -0000 > @@ -2,7 +2,7 @@ COMMENT = minimal terminal emulator for > > GH_ACCOUNT = ii8 > GH_PROJECT = havoc > -GH_TAGNAME = 0.6.0 > +GH_TAGNAME = 0.7.0 > > > CATEGORIES = wayland > Index: distinfo > =================================================================== > RCS file: /local/cvs/ports/wayland/havoc/distinfo,v > diff -u -p -u -r1.3 distinfo > --- distinfo 5 Nov 2024 17:43:45 -0000 1.3 > +++ distinfo 30 Jul 2025 15:10:58 -0000 > @@ -1,2 +1,2 @@ > -SHA256 (havoc-0.6.0.tar.gz) = P2U464orWEZFnzjCg+7yyBUohqTtB54QOLAtDDGjJHw= > -SIZE (havoc-0.6.0.tar.gz) = 95645 > +SHA256 (havoc-0.7.0.tar.gz) = tPgZv8Ow+OqWcBiUjb86cfF0oCiG0A7hYSFzn80UDW8= > +SIZE (havoc-0.7.0.tar.gz) = 93445 > Index: patches/patch-Makefile > =================================================================== > RCS file: /local/cvs/ports/wayland/havoc/patches/patch-Makefile,v > diff -u -p -u -r1.3 patch-Makefile > --- patches/patch-Makefile 5 Nov 2024 17:43:45 -0000 1.3 > +++ patches/patch-Makefile 30 Jul 2025 15:10:58 -0000 > @@ -1,29 +1,23 @@ > Index: Makefile > --- Makefile.orig > +++ Makefile > -@@ -6,7 +6,7 @@ BINDIR ?= $(PREFIX)/bin > +@@ -11,7 +11,7 @@ CDEFS = -DVERSION='$(VERSION)' -D_XOPEN_SOURCE=700 > > - VERSION="0.6.0" > + WAYLAND_PROTOCOLS_DIR != $(PKG_CONFIG) --variable=pkgdatadir wayland-protocols > > --CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-format-overflow > -+CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -I/usr/local/include -I/usr/local/include/libepoll-shim Replace /usr/local with ${LOCALBASE} and setup pre-configure: ${SUBST_CMD} ${WRKSRC}/.... > - override CFLAGS += -DVERSION=\"$(VERSION)\" > +-LIBRARIES = wayland-client wayland-cursor xkbcommon > ++LIBRARIES = wayland-client wayland-cursor xkbcommon epoll-shim > + PKG_CFLAGS != $(PKG_CONFIG) --cflags $(LIBRARIES) > + PKG_LIBS != $(PKG_CONFIG) --libs $(LIBRARIES) > > - VPATH = $(WAYLAND_PROTOCOLS_DIR)/stable/xdg-shell \ > -@@ -17,14 +17,14 @@ GEN = xdg-shell.h xdg-shell.c \ > - xdg-decoration-unstable-v1.h xdg-decoration-unstable-v1.c \ > - primary-selection-unstable-v1.h primary-selection-unstable-v1.c > - > --LIBS=-lrt -lm -lutil -lwayland-client -lwayland-cursor -lxkbcommon -Ltsm -lhtsm > -+LIBS=-L/usr/local/lib -R/usr/local/lib -lm -lutil -lwayland-client -lwayland-cursor -lxkbcommon -Ltsm -lhtsm -lepoll-shim See above > - OBJ=xdg-shell.o xdg-decoration-unstable-v1.o primary-selection-unstable-v1.o glyph.o main.o > - > - havoc: tsm $(OBJ) > - $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) > +@@ -72,8 +72,8 @@ primary-selection-unstable-v1.xml: > + cp $(WAYLAND_PROTOCOLS_DIR)/unstable/primary-selection/$@ $@ > > install: havoc > -- install -D -t $(DESTDIR)$(BINDIR) havoc > -+ install -m 755 havoc $(BINDIR) > +- mkdir -p $(DESTDIR)$(BINDIR) > +- install -m 755 havoc $(DESTDIR)$(BINDIR)/havoc > ++ mkdir -p $(BINDIR) > ++ install -m 755 havoc $(BINDIR)/havoc > > uninstall: > - rm -f $(DESTDIR)$(BINDIR)/havoc > + rm $(DESTDIR)$(BINDIR)/havoc > Index: patches/patch-main_c > =================================================================== > RCS file: patches/patch-main_c > diff -N patches/patch-main_c > --- patches/patch-main_c 5 Nov 2024 17:43:45 -0000 1.4 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,162 +0,0 @@ > -Index: main.c > ---- main.c.orig > -+++ main.c > -@@ -13,7 +13,13 @@ > - #include > - #include > - #include > -+#ifndef __OpenBSD__ > - #include > -+#else > -+#include > -+#include > -+#include > -+#endif > - > - #include > - #include > -@@ -203,7 +209,7 @@ static struct { > - [TSM_COLOR_LIGHT_CYAN] = { 0, 255, 255 }, > - [TSM_COLOR_WHITE] = { 255, 255, 255 }, > - [TSM_COLOR_FOREGROUND] = { 229, 229, 229 }, > -- [TSM_COLOR_BACKGROUND] = { 0, 0, 0 }, > -+ [TSM_COLOR_BACKGROUND] = { 0, 0, 1 }, > - }, > - .opt.app_id = "havoc" > - }; > -@@ -212,7 +218,7 @@ static void wcb(struct tsm_vte *vte, const char *u8, s > - { > - assert(len <= PIPE_BUF); > - if (term.master_fd >= 0 && write(term.master_fd, u8, len) < 0) { > -- fprintf(stderr, "could not write to pty master: %m\n"); > -+ fprintf(stderr, "could not write to pty master: %s\n", strerror(errno)); > - abort(); > - } > - } > -@@ -223,7 +229,7 @@ static void handle_display(int ev) > - term.die = true; > - } else if (ev & EPOLLIN) { > - if (wl_display_dispatch(term.display) < 0) { > -- fprintf(stderr, "could not dispatch events: %m\n"); > -+ fprintf(stderr, "could not dispatch events: %s\n", strerror(errno)); > - abort(); > - } > - } > -@@ -234,22 +240,22 @@ static void handle_tty(int ev) > - char data[256]; > - int len; > - > -- if (ev & EPOLLIN) { > -+ if (ev & EPOLLHUP) { > -+ epoll_ctl(term.fd, EPOLL_CTL_DEL, term.master_fd, NULL); > -+ close(term.master_fd); > -+ term.master_fd = -1; > -+ if (!term.opt.linger) > -+ term.die = true; > -+ } else if (ev & EPOLLIN) { > - term.need_redraw = true; > - len = read(term.master_fd, data, sizeof(data)); > - assert(len); > - if (len < 0) { > -- fprintf(stderr, "could not read from pty: %m\n"); > -+ fprintf(stderr, "could not read from pty: %s\n", strerror(errno)); > - abort(); > - } else { > - tsm_vte_input(term.vte, data, len); > - } > -- } else if (ev & EPOLLHUP) { > -- epoll_ctl(term.fd, EPOLL_CTL_DEL, term.master_fd, NULL); > -- close(term.master_fd); > -- term.master_fd = -1; > -- if (!term.opt.linger) > -- term.die = true; > - } > - } > - > -@@ -528,20 +534,20 @@ static int buffer_init(struct buffer *buf) > - stride = term.width * 4; > - buf->size = stride * term.height; > - > -- srand(time(NULL)); > - do { > -- sprintf(shm_name, "/havoc-%d", rand() % 1000000); > -+ snprintf(shm_name, sizeof(shm_name), "/havoc-%d", > -+ arc4random_uniform(1000000)); > - fd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, 0600); > - } while (fd < 0 && errno == EEXIST && --max); > - > - if (fd < 0) { > -- fprintf(stderr, "shm_open failed: %m\n"); > -+ fprintf(stderr, "shm_open failed: %s\n", strerror(errno)); > - return -1; > - } > - shm_unlink(shm_name); > - > - if (ftruncate(fd, buf->size) < 0) { > -- fprintf(stderr, "ftruncate failed: %m\n"); > -+ fprintf(stderr, "ftruncate failed: %s\n", strerror(errno)); > - close(fd); > - return -1; > - } > -@@ -550,7 +556,7 @@ static int buffer_init(struct buffer *buf) > - fd, 0); > - > - if (buf->data == MAP_FAILED) { > -- fprintf(stderr, "mmap failed: %m\n"); > -+ fprintf(stderr, "mmap failed: %s\n", strerror(errno)); > - close(fd); > - return -1; > - } > -@@ -1492,7 +1498,7 @@ static void configure(void *d, struct xdg_surface *sur > - term.row = row; > - tsm_screen_resize(term.screen, col, row); > - if (term.master_fd >= 0 && ioctl(term.master_fd, TIOCSWINSZ, &ws) < 0) > -- fprintf(stderr, "could not resize pty: %m\n"); > -+ fprintf(stderr, "could not resize pty: %s\n", strerror(errno)); > - > - term.need_redraw = true; > - term.resize = 2; > -@@ -1579,7 +1585,7 @@ static void setup_pty(char *argv[]) > - pid_t pid = forkpty(&term.master_fd, NULL, NULL, NULL); > - > - if (pid < 0) { > -- fprintf(stderr, "forkpty failed: %m"); > -+ fprintf(stderr, "forkpty failed: %s", strerror(errno)); > - exit(EXIT_FAILURE); > - } else if (pid == 0) { > - char *prog; > -@@ -1591,7 +1597,7 @@ static void setup_pty(char *argv[]) > - execlp(term.cfg.shell, term.cfg.shell, (char *) NULL); > - prog = term.cfg.shell; > - } > -- fprintf(stderr, "could not execute %s: %m", prog); > -+ fprintf(stderr, "could not execute %s: %s", prog, strerror(errno)); > - pause(); > - exit(EXIT_FAILURE); > - } > -@@ -1794,9 +1800,9 @@ static FILE *open_config(void) > - > - f = fopen(term.opt.config, "r"); > - if (f == NULL) > -- fprintf(stderr, "could not open '%s': %m, " > -+ fprintf(stderr, "could not open '%s': %s, " > - "using default configuration\n", > -- term.opt.config); > -+ term.opt.config, strerror(errno)); > - return f; > - } > - > -@@ -2018,9 +2024,10 @@ retry: > - > - term.repeat.fd = timerfd_create(CLOCK_MONOTONIC, > - TFD_NONBLOCK | TFD_CLOEXEC); > -- if (term.repeat.fd < 0) > -- fail(etimer, "could not create key repeat timer: %m"); > -- > -+ if (term.repeat.fd < 0) { > -+ fprintf(stderr, "could not create key repeat timer: %s", strerror(errno)); > -+ goto etimer; > -+ } > - if (term.d_dm && term.seat) { > - term.d_d = wl_data_device_manager_get_data_device( > - term.d_dm, term.seat); > Index: patches/patch-tsm_Makefile > =================================================================== > RCS file: patches/patch-tsm_Makefile > diff -N patches/patch-tsm_Makefile > --- patches/patch-tsm_Makefile 26 Feb 2024 18:17:32 -0000 1.2 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,9 +0,0 @@ > -Index: tsm/Makefile > ---- tsm/Makefile.orig > -+++ tsm/Makefile > -@@ -1,4 +1,5 @@ > - CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-format-overflow > -+CFLAGS += -I/usr/local/include See above > - > - OBJ=wcwidth.o shl-htable.o\ > - tsm-render.o tsm-screen.o tsm-selection.o\ > > -- > Matthieu Herrb >