Bug 164660 - sysutils/su2: utmpx fix
sysutils/su2: utmpx fix
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Chris Rees
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-31 09:40 UTC by gd
Modified: 2012-02-17 18:10 UTC (History)
0 users

See Also:


Attachments
file.txt (2.90 KB, text/plain)
2012-01-31 09:40 UTC, gd
no flags Details
patch.txt (2.98 KB, text/plain)
2012-01-31 10:07 UTC, gd
no flags Details
patch.txt (3.00 KB, text/plain)
2012-02-07 22:53 UTC, gd
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description gd 2012-01-31 09:40:11 UTC
port marked as broken due to changes in accounting system

Fix: Patch attached with submission follows:
How-To-Repeat: su2 -r or su2 -s
Comment 1 gd 2012-01-31 10:07:08 UTC
Sorry, this patch break su2 for FreeBSD versions before 8.0
I attach new patch.

On Tue, 31 Jan 2012 09:33:55 GMT
Denis Generalov <gd@rambler-co.ru> wrote:

> 
> >Number:         164660
> >Category:       ports
> >Synopsis:       utmpx fix
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       low
> >Responsible:    freebsd-ports-bugs
> >State:          open
> >Quarter:        
> >Keywords:       
> >Date-Required:
> >Class:          update
> >Submitter-Id:   current-users
> >Arrival-Date:   Tue Jan 31 09:40:11 UTC 2012
> >Closed-Date:
> >Last-Modified:
> >Originator:     Denis Generalov
> >Release:        9.0-STABLE
> >Organization:
> Rambler
> >Environment:
> FreeBSD tyl2.park.rambler.ru 9.0-STABLE FreeBSD 9.0-STABLE #0: Sat Jan 14 02:35:27 MSK 2012     root@tyl2.park.rambler.ru:/usr/obj/usr/src/sys/GENERIC  amd64
> >Description:
> port marked as broken due to changes in accounting system
> >How-To-Repeat:
> su2 -r or su2 -s
> >Fix:
> 
> 
> > 
> ===> Generating patch
> ===> Viewing diff with more
> diff -ruN --exclude=CVS /usr/ports/sysutils/su2/Makefile /tmp/gd/su2/Makefile
> --- /usr/ports/sysutils/su2/Makefile	2010-03-20 17:31:50.000000000 +0300
> +++ /tmp/gd/su2/Makefile	2012-01-31 00:59:18.000000000 +0400
> @@ -7,23 +7,20 @@
>  
>  PORTNAME=	su2
>  PORTVERSION=	1.3
> +PORTREVISION=	1
>  CATEGORIES=	sysutils security
>  MASTER_SITES=	ftp://ftp.ccs.neu.edu/pub/sysadmin/
>  
>  MAINTAINER=	ports@FreeBSD.org
>  COMMENT=	An enhanced su, allows users to su with own password + more
>  
> -NO_CDROM=	"Don't sell for profit"
> +NO_CDROM=	Don't sell for profit
>  
>  MAN1=		su2.1
>  PLIST_FILES=	bin/su2
>  
>  .include <bsd.port.pre.mk>
>  
> -.if ${OSVERSION} > 900007
> -BROKEN=		fails to build with new utmpx
> -.endif
> -
>  post-patch:
>  	${REINPLACE_CMD} -e 's,/etc/super,${PREFIX}/etc/super,g' ${WRKSRC}/su2.man
>  
> diff -ruN --exclude=CVS /usr/ports/sysutils/su2/files/patch-ad /tmp/gd/su2/files/patch-ad
> --- /usr/ports/sysutils/su2/files/patch-ad	1970-01-01 03:00:00.000000000 +0300
> +++ /tmp/gd/su2/files/patch-ad	2012-01-31 01:59:00.000000000 +0400
> @@ -0,0 +1,69 @@
> +--- su2.c.orig	2012-01-31 01:37:47.000000000 +0400
> ++++ su2.c	2012-01-31 01:39:14.000000000 +0400
> +@@ -151,7 +151,12 @@
> + #include <fcntl.h>
> + #include <stdio.h>
> + #include <time.h>
> ++#include <osreldate.h>
> ++#if defined(__FreeBSD_version) && __FreeBSD_version > 900007
> ++#include <utmpx.h>
> ++#else
> + #include <utmp.h>
> ++#endif
> + #include <signal.h>
> + #ifdef IOCTL
> + #include <sys/ioctl.h>
> +@@ -383,7 +388,7 @@
> +     if (FullTTY == (char *) 0)
> + 	FullTTY = "/dev/TTY??";
> + 
> +-    TTY = strrchr (FullTTY, '/') + 1;
> ++    TTY = strchr (FullTTY + 1, '/') + 1;
> + 
> +     Debug (1, "-> FullTTY=\"%s\"\n", FullTTY);
> +     Debug (1, "-> TTY=\"%s\"\n", TTY);
> +@@ -1315,7 +1320,11 @@
> +  *	Copies name into an internal static buffer.
> +  */
> + 
> ++#if defined(__FreeBSD_version) && __FreeBSD_version > 900007
> ++#define MAXNAME sizeof(((struct utmpx *)nptr)->ut_user)
> ++#else
> + #define MAXNAME sizeof(((struct utmp *)nptr)->ut_name)
> ++#endif
> + 
> + #ifdef BROKENCUSERID
> + char *mycuserid ()
> +@@ -1432,6 +1441,24 @@
> + ModifyUtmp (NewUserName)
> + register char  *NewUserName;
> + {
> ++#if defined(__FreeBSD_version) && __FreeBSD_version > 900007
> ++    struct utmpx ut, *utr;
> ++
> ++    strncpy(ut.ut_line, TTY, sizeof(ut.ut_line));
> ++    setutxent();
> ++    if ((utr = getutxline(&ut)) == NULL) {
> ++        endutxent();
> ++        (void) fprintf (stderr, "Terminal %s not found\n", ut.ut_line);
> ++        return (1);
> ++    }
> ++    strncpy(utr->ut_user, NewUserName, sizeof(utr->ut_user));
> ++    if (pututxline(utr) == NULL) {
> ++        endutxent();
> ++        (void) fprintf (stderr, "pututxline failed\n");
> ++        return (1);
> ++    }
> ++    endutxent();
> ++#else
> +     register int    fd;		/* /etc/utmp file */
> +     register int    i;		/* index */
> + #ifdef hpux
> +@@ -1482,6 +1509,7 @@
> + 
> +     (void) write (fd, (char *) & Utmp, sizeof (Utmp));
> +     (void) close (fd);
> ++#endif
> +     return (0);
> + }
> + 
> ===> Done
> 
> 
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
> _______________________________________________
> freebsd-ports-bugs@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
> To unsubscribe, send any mail to "freebsd-ports-bugs-unsubscribe@freebsd.org"


-- 
GD <gd@powernet.ru>
Comment 2 Martin Wilke freebsd_committer 2012-02-01 11:21:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->miwi

I'll take it.
Comment 3 Martin Wilke freebsd_committer 2012-02-07 06:42:20 UTC
Responsible Changed
From-To: miwi->freebsd-ports-bugs

back to pool, sorry i cant test it.
Comment 4 Chris Rees freebsd_committer 2012-02-07 17:32:28 UTC
Responsible Changed
From-To: freebsd-ports-bugs->crees

I'll take it.  Would you like to be maintainer?
Comment 5 Chris Rees freebsd_committer 2012-02-07 17:35:06 UTC
State Changed
From-To: open->feedback

Great work.  Can we not use #ifdef _UTMPX_H_ after the first 
FreeBSD_version test so upstream can fix it more easily?
Comment 6 gd 2012-02-07 20:46:17 UTC
On Tue, 7 Feb 2012 17:35:07 GMT
crees@FreeBSD.org wrote:

> Synopsis: sysutils/su2: utmpx fix
> 
> State-Changed-From-To: open->feedback
> State-Changed-By: crees
> State-Changed-When: Tue Feb 7 17:35:06 UTC 2012
> State-Changed-Why: 
> Great work.  Can we not use #ifdef _UTMPX_H_ after the first
> FreeBSD_version test so upstream can fix it more easily?
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=164660

Of course, it's much more better.
Thank you very much, I will fix the patch.

-- 
Denis Generalov <gd@rambler-co.ru>
Comment 7 gd 2012-02-07 22:53:31 UTC
Hello,

It's another one try.
I fixed unnecessary OS version checks.

-- 
Denis Generalov <gd@rambler-co.ru>
Comment 8 dfilter freebsd_committer 2012-02-17 17:59:43 UTC
crees       2012-02-17 17:59:24 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/su2         Makefile 
  Added files:
    sysutils/su2/files   patch-su2-c 
  Log:
  - Fix with utmpx for 9+ [1]
  
  - Fix clang build
  
  PR:             ports/164660
  Submitted by:   Denis Generalov <gd@rambler-co.ru> [1]
  
  Revision  Changes    Path
  1.14      +6 -9      ports/sysutils/su2/Makefile
  1.1       +74 -0     ports/sysutils/su2/files/patch-su2-c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 9 Chris Rees freebsd_committer 2012-02-17 18:00:20 UTC
State Changed
From-To: feedback->closed

I've committed the original patch-- ed@ yelled at me for using _UTMPX_H_ 
outside headers :$  Thanks for the fix!