Bug 164306

Summary: update mail/mailagent to 3.1.77 and utmpx fix
Product: Ports & Packages Reporter: kasahara <kasahara>
Component: Individual Port(s)Assignee: Stefan Walter <stefan>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description kasahara 2012-01-19 09:30:06 UTC
The revision of upstream had become 77, and I updated the distfile
provided at http://eron.info/ .

Also I noticed that it won't be built on FreeBSD 9 due to utmpx migration.
I couldn't find a good way to access the utmpx structure from Perl 
without using C or other packages, so I decided not to compile utmp_ph.c
and directly provide a simplified version of utmp.pl which parses the
output of "/usr/bin/who".  It is only used by biff function, and I 
confirmed it worked.  Please tell me if someone knows better solution...

Fix: Here is the patch:
Comment 1 Michael Scheidell freebsd_committer freebsd_triage 2012-02-27 11:36:01 UTC
Thank you for your efforts in keeping FreeBSD and ports tree updated. It 
is greatly appreciated.

have you looked at ports/165380  ?

This looks like the cleanest way to support utmpx on 9.x

http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/165380

Can you give that a try, and submit a new patch if that works?

-- 
Michael Scheidell, CTO
 >*| * SECNAP Network Security Corporation
d: +1.561.948.2259
w: http://people.freebsd.org/~scheidell
Comment 2 kasahara 2012-02-29 01:46:12 UTC
Thank you very much for the pointer, but I'm afraid that it is not
applicable to this case.  The patch for net/msend looks clean because
msend already has codes for utmpx (calling get/setutxent instead of
directly reading the utmp file when USE_UTMPX is defined).  The patch
just defines USE_UTMPX and fixes incompatibility of a member name.

The actual problem (or difficulty for me) is that mailagent is a Perl
script and there seems no way to obtain utmpx data structure by a Perl
script (maybe except writing a C module calling set/getutxent ?).
utmp-era programs can read and parse utmp file directly, but utmpx
file is not directly readable (the file format (futx?) is hidden
inside libc and there seems no way to read it in a portable way).

CPAN has User::Utmp module, but it is not in FreeBSD ports collection.
I tried to build it by myself but failed on 9.x.  Also the author of
mailagent seems to have a policy not to use any external modules.  So
I was stucked and decided to call /usr/bin/who instead, because
mailagent just needs users and tty names they are on.  mailagent uses
them to decide which ttys to biff.  I don't use biff function, but at
least I want it to work as expected.

I have only a little knowledge about utmpx on FreeBSD 9.x so my
understanding might be wrong.  If there is a clean way to access utmpx
from a Perl script, I'd like to know.

-- 
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
Comment 3 Ed Schouten 2012-03-03 19:02:36 UTC
Hi all,

I just sent a patch to the author of User::Utmp to make it somewhat
usable on FreeBSD. I hope it helps.

	https://rt.cpan.org/Public/Bug/Display.html?id=75509

Best regards,
-- 
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/
Comment 4 Stefan Walter freebsd_committer freebsd_triage 2013-04-28 20:47:10 UTC
Hi,

there hasn't been any activity regarding this PR (see [1]) for
mail/mailagent for quite a while. Can you let me know what the state of
things is? Should the patch in the PR be committed as it is, or with
modifications, or should the PR just be closed?

Best regards,
Stefan

[1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/164306
Comment 5 Stefan Walter freebsd_committer freebsd_triage 2013-04-28 20:47:24 UTC
State Changed
From-To: open->feedback

Awaiting feedback. 


Comment 6 Stefan Walter freebsd_committer freebsd_triage 2013-04-28 20:47:24 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stefan

Track this while waiting for feedback.
Comment 7 kasahara 2013-04-30 01:48:55 UTC
Ok, I haven't found better ways so far, so could you please commit the
patch as is and see if anyone will complain about it?  At least it is
working here (on 9-STABLE) for a year.

Thank you.
--
Y.Kasahara

On Sun, 28 Apr 2013 21:47:10 +0200,
	Stefan Walter <stefan@freebsd.org> said:

> Hi,
> 
> there hasn't been any activity regarding this PR (see [1]) for
> mail/mailagent for quite a while. Can you let me know what the state of
> things is? Should the patch in the PR be committed as it is, or with
> modifications, or should the PR just be closed?
> 
> Best regards,
> Stefan
> 
> [1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/164306
Comment 8 Stefan Walter freebsd_committer freebsd_triage 2013-04-30 13:19:24 UTC
State Changed
From-To: feedback->closed

Committed, thanks!
Comment 9 dfilter service freebsd_committer freebsd_triage 2013-04-30 13:19:26 UTC
Author: stefan
Date: Tue Apr 30 12:19:06 2013
New Revision: 316925
URL: http://svnweb.freebsd.org/changeset/ports/316925

Log:
  - Update to 3.1.77. [1]
  - Fix build on 9.x. [1]
  - Convert Makefile header to new style and fix a couple of portlint
    warnings.
  
  PR:		164306 [1]
  Submitted by:	Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> [1]

Added:
  head/mail/mailagent/files/extra-patch-utmpx-agent_pl_utmp_Makefile.SH   (contents, props changed)
  head/mail/mailagent/files/extra-patch-utmpx-agent_pl_utmp_utmp.pl   (contents, props changed)
Modified:
  head/mail/mailagent/Makefile   (contents, props changed)
  head/mail/mailagent/distinfo   (contents, props changed)

Modified: head/mail/mailagent/Makefile
==============================================================================
--- head/mail/mailagent/Makefile	Tue Apr 30 12:19:00 2013	(r316924)
+++ head/mail/mailagent/Makefile	Tue Apr 30 12:19:06 2013	(r316925)
@@ -1,12 +1,8 @@
-# New ports collection makefile for:	mailagent
-# Date created:			23 Sep 1996
-# Whom:				Masafumi NAKANE <max@FreeBSD.org>
-#
+# Created by: Masafumi NAKANE <max@FreeBSD.org>
 # $FreeBSD$
-#
 
 PORTNAME=		mailagent
-PORTVERSION=		3.1.71
+PORTVERSION=		3.1.77
 CATEGORIES=		mail
 MASTER_SITES=		http://eron.info/
 
@@ -34,6 +30,12 @@ MAN1=		edusers.1 mailagent.1 package.1 m
 MLINKS=		mailhelp.1 maildist.1  mailhelp.1 mailpatch.1 \
 		mailhelp.1 maillist.1
 
+.include <bsd.port.pre.mk>
+.if ${OSVERSION} > 900006
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-utmpx-agent_pl_utmp_utmp.pl \
+		${PATCHDIR}/extra-patch-utmpx-agent_pl_utmp_Makefile.SH
+.endif
+
 pre-extract:
 	@if [ `${SH} -c umask` != 0022 ]; then \
 	  ${ECHO} "Please set umask to 022 before running make,"; \
@@ -58,4 +60,4 @@ post-install:
 	${CP} -pR ${WRKSRC}/misc/* ${EXAMPLESDIR}/misc
 	@${LN} -fs ${PREFIX}/lib/mailagent/examples ${EXAMPLESDIR}/agent
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>

Modified: head/mail/mailagent/distinfo
==============================================================================
--- head/mail/mailagent/distinfo	Tue Apr 30 12:19:00 2013	(r316924)
+++ head/mail/mailagent/distinfo	Tue Apr 30 12:19:06 2013	(r316925)
@@ -1,2 +1,2 @@
-SHA256 (mailagent-3.1.71.tar.bz2) = 4785a018797d4405f8708ba59197f249f77cd4f22f87b086c04c7226cb64ebdb
-SIZE (mailagent-3.1.71.tar.bz2) = 446820
+SHA256 (mailagent-3.1.77.tar.bz2) = 89d399ee9aa87399070309e18b1e4237edf62b345ee1d8061202913de8e027b3
+SIZE (mailagent-3.1.77.tar.bz2) = 450202

Added: head/mail/mailagent/files/extra-patch-utmpx-agent_pl_utmp_Makefile.SH
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mailagent/files/extra-patch-utmpx-agent_pl_utmp_Makefile.SH	Tue Apr 30 12:19:06 2013	(r316925)
@@ -0,0 +1,20 @@
+--- ../mailagent-3.1.77/agent/pl/utmp/Makefile.SH	2006-08-24 22:24:12.354556000 +0900
++++ agent/pl/utmp/Makefile.SH	2012-01-19 17:37:50.697895588 +0900
+@@ -107,7 +107,6 @@
+ 	cp Makefile.new Makefile
+ 	$(RM) Makefile.new
+ 
+-all:: utmp_ph
+ 
+ local_realclean::
+ 	$(RM) utmp_ph
+@@ -122,8 +121,7 @@
+ local_realclean::
+ 	$(RM) utmp.pl
+ 
+-utmp.pl: utmp_pl.sh utmp_ph
+-	/bin/sh utmp_pl.sh
++utmp.pl:
+ 
+ ########################################################################
+ # Common rules for all Makefiles -- do not edit

Added: head/mail/mailagent/files/extra-patch-utmpx-agent_pl_utmp_utmp.pl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mailagent/files/extra-patch-utmpx-agent_pl_utmp_utmp.pl	Tue Apr 30 12:19:06 2013	(r316925)
@@ -0,0 +1,25 @@
+--- /dev/null	2012-01-19 17:47:14.000000000 +0900
++++ agent/pl/utmp/utmp.pl	2012-01-19 17:53:06.536872534 +0900
+@@ -0,0 +1,22 @@
++#
++# utmp file primitives
++#
++
++package utmp;
++
++# Return the ttys on which a given user is logged
++sub ttys {
++	local($user) = @_;			# User's login name
++	local(@u);
++	open(WHO, '/usr/bin/who |') || warn "Can't invoke /usr/bin/who: $!\n";
++	while (<WHO>) {
++	    next unless /^$user\s/;
++	    my ($name, $line, $dummy) = split;
++	    push(@u, $line);
++	}
++	close WHO;     
++	return @u;		# Returns array of ttys
++}
++
++package main;
++
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"