[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-workers] nmh on openbsd...

From: William Yodlowsky
Subject: [Nmh-workers] nmh on openbsd...
Date: Thu, 17 Apr 2014 22:56:25 -0400


In preparing an update to the OpenBSD port to 1.6-RC1, we found it
failed to compile uip/rcvtty due to this commit:


It results in:

cc  -O2 -pipe   -o uip/rcvtty uip/rcvtty.o uip/scansbr.o sbr/libmh.a -ltermcap  
2>&1 | sed -e 's/: w\(arning: s.*() is .* misused, please use\)/: W\1/'
sbr/libmh.a(sbr_libmh_a-m_getfld.o)(.text+0x6d5): In function `m_unknown':
sbr/libmh.a(sbr_libmh_a-mts.o)(.text+0x5be): In function `LocalName':
sbr/libmh.a(sbr_libmh_a-m_maildir.o)(.text+0x13e): In function `m_maildir':
uip/rcvtty.o(.text+0x6ef): In function `main':
: undefined reference to `alert'
collect2: ld returned 1 exit status

How we hit this needs a bit of explanation.

After the failed discussion here on nmh-workers about utmp support, in
which we attempted to resurrect it with this tiny patch:


...we had to add that patch to our ports tree to keep rcvtty working
on OpenBSD.  OK fine.

But now other changes have been made to fix up the OpenBSD build, which
is actually breaking it for the OpenBSD project's build of the binary
package.  The majority of our users are going to use our built packages,
and they are built from the port that includes utmp support.

I'm grateful to see the buildbot and the attention being given to
OpenBSD build-related issues, but the reality is that the code is going
to continue to diverge.

So, I can add the patch below to our ports tree to work around both the
commits (and drop this topic for good), or I ask that it be reconsidered
for inclusion in nmh proper and our perceptions of the codepath on
OpenBSD, and any issues therein, can be shared by both groups.


--- uip/rcvtty.c.orig   Mon Apr 14 13:41:27 2014
+++ uip/rcvtty.c        Wed Apr 16 07:59:10 2014
@@ -23,6 +23,8 @@
 #include <utmpx.h>
+#include <utmp.h>
 #endif /* HAVE_GETUTXENT */
 #define        SCANFMT \
@@ -69,9 +71,7 @@ char *getusername(void);
 static void alrmser (int);
 static int message_fd (char **);
 static int header_fd (void);
 static void alert (char *, int);
-#endif /* HAVE_GETUTXENT */
@@ -80,7 +80,12 @@ main (int argc, char **argv)
     int md, vecp = 0;
     char *cp, *user, buf[BUFSIZ], tty[BUFSIZ];
     char **argp, **arguments, *vec[MAXARGS];
     struct utmpx *utp;
+    struct utmp ut;
+    register FILE *uf;
     if (nmh_init(argv[0], 1)) { return 1; }
@@ -162,8 +167,15 @@ main (int argc, char **argv)
-    NMH_UNUSED (tty);
-    NMH_UNUSED (utp);
+    if ((uf = fopen (_PATH_UTMP, "r")) == NULL)
+       exit (RCV_MBX);
+    while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1)
+       if (ut.ut_name[0] != 0
+               && strncmp (user, ut.ut_name, sizeof(ut.ut_name)) == 0) {
+           strncpy (tty, ut.ut_line, sizeof(ut.ut_line));
+           alert (tty, md);
+       }
+    fclose (uf);
 #endif /* HAVE_GETUTXENT */
     exit (RCV_MOK);
@@ -274,7 +286,6 @@ header_fd (void)
 static void
 alert (char *tty, int md)
@@ -312,4 +323,3 @@ alert (char *tty, int md)
     close (td);
-#endif /* HAVE_GETUTXENT */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]