git: b86a22f00dd1 - main - sysutils/root-tail: Resurrect port, Print text directly to X11 root window

Daniel Engberg diizzy at FreeBSD.org
Sat Oct 2 23:15:21 UTC 2021


The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b86a22f00dd1e0c507b160e91feb78d06c58f4d8

commit b86a22f00dd1e0c507b160e91feb78d06c58f4d8
Author:     Boris Korzun <drtr0jan at yandex.ru>
AuthorDate: 2021-10-02 23:11:11 +0000
Commit:     Daniel Engberg <diizzy at FreeBSD.org>
CommitDate: 2021-10-02 23:14:43 +0000

    sysutils/root-tail: Resurrect port, Print text directly to X11 root window
    
    Simple utility to tail files/logs to a root X window.
    Useful for keeping tabs on log files in X without having
    an additional terminal window open.
    
    Removed in commit 0786acb3155523a38d1442f3c16ca56750f1db04 due to
    being expired. It previously used roottail but is now
    using root-tail to follow upstream naming.
    
    Additional patches obtained from Debian and Fedora repositories
    
    Sources:
    https://salsa.debian.org/debian/root-tail/-/blob/master/debian/patches/do-not-chown-manually.patch
    https://salsa.debian.org/debian/root-tail/-/blob/master/debian/patches/fix-linker-and-compiler-options.patch
    https://src.fedoraproject.org/rpms/root-tail/blob/rawhide/f/root-tail-1.3-Generate-Expose-events-when-clearing-a-window.patch
    https://src.fedoraproject.org/rpms/root-tail/blob/rawhide/f/root-tail-1.3-Respect-width-and-height-unsigness-in-arithmetics.patch
    
    PR:             258498
    Approved by:    arrowd (mentor)
    Differential Revision:  https://reviews.freebsd.org/D32032
---
 MOVED                                      |   2 +-
 sysutils/Makefile                          |   1 +
 sysutils/root-tail/Makefile                |  19 +++++
 sysutils/root-tail/distinfo                |   3 +
 sysutils/root-tail/files/patch-Makefile    |  41 ++++++++++
 sysutils/root-tail/files/patch-root-tail.c | 126 +++++++++++++++++++++++++++++
 sysutils/root-tail/pkg-descr               |   5 ++
 7 files changed, 196 insertions(+), 1 deletion(-)

diff --git a/MOVED b/MOVED
index 9857f582200a..d3df73c3787e 100644
--- a/MOVED
+++ b/MOVED
@@ -14791,7 +14791,6 @@ sysutils/phantom||2020-05-05|Has expired: Broken for more than 6 months
 sysutils/ptools||2020-05-05|Has expired: Broken for more than 6 months
 sysutils/realsync||2020-05-05|Has expired: Broken for more than 6 months
 sysutils/rmonitor||2020-05-05|Has expired: Broken for more than 6 months
-sysutils/roottail||2020-05-05|Has expired: Broken for more than 6 months
 sysutils/sb16config||2020-05-05|Has expired: Broken for more than 6 months
 sysutils/sbase||2020-05-05|Has expired: Broken for more than 6 months
 sysutils/setquota||2020-05-05|Has expired: Broken for more than 6 months
@@ -16484,6 +16483,7 @@ net-mgmt/zabbix52-frontend||2021-09-19|Has expired: Unsupported by upstream
 net-mgmt/zabbix52-java||2021-09-19|Has expired: Unsupported by upstream
 net-mgmt/zabbix52-proxy||2021-09-19|Has expired: Unsupported by upstream
 net-mgmt/zabbix52-server||2021-09-19|Has expired: Unsupported by upstream
+sysutils/roottail|sysutils/root-tail|2021-09-26|Renamed to match upstream
 devel/py-pyyaml-env-tag|devel/py-pyyaml_env_tag|2021-09-28|Renamed to match upstream naming
 mail/opensmtpd-devel|mail/opensmtpd|2021-09-28|Has expired: move to offical releases
 devel/erlang-exmpp||2021-09-30|Removed, last upstream patches over 10 years ago
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 273617dd5143..910f92f3630e 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -1127,6 +1127,7 @@
     SUBDIR += rmlint
     SUBDIR += rocr
     SUBDIR += roct
+    SUBDIR += root-tail
     SUBDIR += rovclock
     SUBDIR += rpi-firmware
     SUBDIR += rset
diff --git a/sysutils/root-tail/Makefile b/sysutils/root-tail/Makefile
new file mode 100644
index 000000000000..d501f55a7533
--- /dev/null
+++ b/sysutils/root-tail/Makefile
@@ -0,0 +1,19 @@
+PORTNAME=	root-tail
+DISTVERSION=	1.3
+CATEGORIES=	sysutils
+MASTER_SITES=	http://dist.schmorp.de/${PORTNAME}/
+
+MAINTAINER=	drtr0jan at yandex.ru
+COMMENT=	Print text directly to X11 root window
+
+LICENSE=	GPLv2+
+
+LIB_DEPENDS=	libXfixes.so:x11/libXfixes
+
+USES=		imake xorg
+USE_XORG=	x11 xext
+
+PLIST_FILES=	bin/root-tail \
+		man/man1/root-tail.1.gz
+
+.include <bsd.port.mk>
diff --git a/sysutils/root-tail/distinfo b/sysutils/root-tail/distinfo
new file mode 100644
index 000000000000..8b49cd96fa4e
--- /dev/null
+++ b/sysutils/root-tail/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1633216089
+SHA256 (root-tail-1.3.tar.gz) = 460475323404460919ff48c90f7b3ebfdb66f3b9961f54dd73dd172178c07712
+SIZE (root-tail-1.3.tar.gz) = 19068
diff --git a/sysutils/root-tail/files/patch-Makefile b/sysutils/root-tail/files/patch-Makefile
new file mode 100644
index 000000000000..5fddee879635
--- /dev/null
+++ b/sysutils/root-tail/files/patch-Makefile
@@ -0,0 +1,41 @@
+Sources:
+https://salsa.debian.org/debian/root-tail/-/blob/master/debian/patches/do-not-chown-manually.patch
+https://salsa.debian.org/debian/root-tail/-/blob/master/debian/patches/fix-linker-and-compiler-options.patch
+
+--- Makefile.orig	2019-06-16 00:57:40 UTC
++++ Makefile
+@@ -1,9 +1,5 @@
+-COPTS = -g
++LDFLAGS += -lX11 -lXfixes
+ 
+-CFLAGS = -Wall $(COPTS)
+-
+-LDFLAGS = -L/usr/X11R6/lib -lX11 -lXfixes
+-
+ PREFIX = $(DESTDIR)/usr
+ BINDIR = $(PREFIX)/bin
+ MANDIR = $(PREFIX)/share/man/man1
+@@ -14,7 +10,7 @@ SOURCES = root-tail.c
+ all: root-tail man
+ 
+ root-tail: $(SOURCES) config.h
+-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(SOURCES)
++	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(SOURCES) $(LDFLAGS)
+ 
+ man: root-tail.1.gz
+ 
+@@ -26,10 +22,10 @@ clean:
+ 	rm -f root-tail root-tail.o root-tail.1.gz
+ 
+ install: all
+-	install -D -o root -g root root-tail $(BINDIR)
+-	install -D -m 0644 -o root -g root root-tail.1.gz $(MANDIR)
+-	install -D -m 0644 -o root -g root README $(DOCDIR)
+-	install -m 0644 -o root -g root Changes $(DOCDIR)
++	install -D root-tail $(BINDIR)
++	install -D -m 0644 root-tail.1.gz $(MANDIR)
++	install -D -m 0644 README $(DOCDIR)
++	install -m 0644 Changes $(DOCDIR)
+ 
+ uninstall:
+ 	rm -f $(BINDIR)/root-tail $(MANDIR)/root-tail.1.gz
diff --git a/sysutils/root-tail/files/patch-root-tail.c b/sysutils/root-tail/files/patch-root-tail.c
new file mode 100644
index 000000000000..8f4fe0f4a82c
--- /dev/null
+++ b/sysutils/root-tail/files/patch-root-tail.c
@@ -0,0 +1,126 @@
+Sources:
+https://src.fedoraproject.org/rpms/root-tail/blob/rawhide/f/root-tail-1.3-Generate-Expose-events-when-clearing-a-window.patch
+https://src.fedoraproject.org/rpms/root-tail/blob/rawhide/f/root-tail-1.3-Respect-width-and-height-unsigness-in-arithmetics.patch
+
+--- root-tail.c.orig	2019-06-16 00:46:04 UTC
++++ root-tail.c
+@@ -38,6 +38,7 @@
+ #include <locale.h>
+ #include <ctype.h>
+ #include <stdarg.h>
++#include <limits.h>
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+ #include <X11/Xutil.h>
+@@ -118,7 +119,7 @@ static int continuation_length;
+ /* HACK - ideally listlen will start at however many '~'s will fit on
+  * the screen */
+ static unsigned int width = STD_WIDTH, height = STD_HEIGHT;
+-static int listlen = 50;
++static unsigned int listlen = 50;
+ static int win_x = LOC_X, win_y = LOC_Y;
+ static int effect_x_space, effect_y_space; /* how much space does shading / outlining take up */
+ static int effect_x_offset, effect_y_offset; /* and how does it offset the usable space */
+@@ -206,7 +207,7 @@ force_refresh (int dummy)
+ static void
+ blank_window (int dummy)
+ {
+-  XClearArea (disp, root, win_x, win_y, width + MARGIN_OF_ERROR, height, False);
++  XClearArea (disp, root, win_x, win_y, width + MARGIN_OF_ERROR, height, True);
+   XFlush (disp);
+   exit (0);
+ }
+@@ -369,7 +370,7 @@ InitWindow (void)
+ 	{
+ 	  fprintf(stderr, "\n  the display isn't tall enough to display a single line in font '%s'\n",
+ 		  e->fontname);
+-	  fprintf(stderr, "\n  the geometry in use is %d pixels tall\n", height);
++	  fprintf(stderr, "\n  the geometry in use is %u pixels tall\n", height);
+ 	  fprintf(stderr, "\n  font '%s' is %d pixels tall\n", e->fontname, e->font_height);
+ 	  if (effect_y_space)
+ 	    fprintf(stderr, "\n  the shade or outline options need an extra %d pixel%s of vertical space\n",
+@@ -445,8 +446,8 @@ draw_text (Display *disp, Window root, GC WinGC, int x
+ static void
+ refresh (int miny, int maxy, int clear, int refresh_all)
+ {
+-  int lin = 0;
+-  int space = height;
++  unsigned int lin = 0;
++  int space = (int)height;
+   int offset;
+   unsigned long black_color = GetColor ("black");
+   struct line_node *line;
+@@ -462,7 +463,7 @@ refresh (int miny, int maxy, int clear, int refresh_al
+   maxy -= win_y;
+ 
+   if (clear && !opt_noflicker)
+-    XClearArea (disp, root, win_x, win_y, width + MARGIN_OF_ERROR, height, False);
++    XClearArea (disp, root, win_x, win_y, width + MARGIN_OF_ERROR, height, True);
+ 
+   for (line = linelist; line; line = line->next, lin++)
+     {
+@@ -470,7 +471,7 @@ refresh (int miny, int maxy, int clear, int refresh_al
+ 
+       if (opt_noflicker && lin >= listlen)
+         {
+-          int i = listlen;
++          unsigned int i = listlen;
+           listlen *= 1.5;
+           display = xrealloc(display, listlen * sizeof(struct displaymatrix));
+           for (; i < listlen; i++)
+@@ -535,7 +536,7 @@ refresh (int miny, int maxy, int clear, int refresh_al
+                                       width, step_per_line);
+ #else /* DEBUG */
+                       XClearArea (disp, root, win_x, win_y + offset - line->logfile->font_ascent,
+-                                  width + MARGIN_OF_ERROR, step_per_line, False);
++                                  width + MARGIN_OF_ERROR, step_per_line, True);
+ #endif /* DEBUG */
+                     }
+                 }
+@@ -584,7 +585,7 @@ refresh (int miny, int maxy, int clear, int refresh_al
+                       width, space);
+ #else /* DEBUG */
+       XClearArea (disp, root, win_x, win_y + offset - (opt_reverse ? 0 : space),
+-                  width + MARGIN_OF_ERROR, space, False);
++                  width + MARGIN_OF_ERROR, space, True);
+ #endif
+     }
+ 
+@@ -1112,7 +1113,7 @@ append_to_existing_line (char *str, struct logfile_ent
+ static void
+ main_loop (void)
+ {
+-  int lin;
++  unsigned int lin;
+   time_t lastreload;
+   Region region = XCreateRegion ();
+   XEvent xev;
+@@ -1325,8 +1326,26 @@ main (int argc, char *argv[])
+           else if (!strcmp (arg, "-V"))
+             display_version ();
+           else if (!strcmp (arg, "-g") || !strcmp (arg, "-geometry"))
+-            geom_mask =
+-              XParseGeometry (argv[++i], &win_x, &win_y, &width, &height);
++            {
++              geom_mask =
++                XParseGeometry (argv[++i], &win_x, &win_y, &width, &height);
++              /* Width and height are used in various expressions assigned to
++               * signed or unsigned integers. The assignments could overflow. */
++              if (width < 1 || width > INT_MAX - MARGIN_OF_ERROR || width > UINT_MAX)
++                {
++                  fprintf (stderr,
++                      "The geometry width is too small or too large: '%u'.\n",
++                      width);
++                  exit (1);
++                }
++              if (height < 1 || height > UINT_MAX)
++                {
++                  fprintf (stderr,
++                      "The geometry height is too small or too large: '%u'.\n",
++                      height);
++                  exit (1);
++                }
++            }
+           else if (!strcmp (arg, "-display"))
+             dispname = argv[++i];
+           else if (!strcmp (arg, "-cont"))
diff --git a/sysutils/root-tail/pkg-descr b/sysutils/root-tail/pkg-descr
new file mode 100644
index 000000000000..39d31b664d2d
--- /dev/null
+++ b/sysutils/root-tail/pkg-descr
@@ -0,0 +1,5 @@
+Simple utility to tail files/logs to a root X window.
+Useful for keeping tabs on log files in X without having
+an additional terminal window open.
+
+WWW: http://software.schmorp.de/pkg/root-tail.html


More information about the dev-commits-ports-all mailing list