Bug 144439 - ftp/proftpd doesn't compile with __FreeBSD_version >= 900007
Summary: ftp/proftpd doesn't compile with __FreeBSD_version >= 900007
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Martin Matuska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-02 21:30 UTC by subbsd
Modified: 2010-05-13 16:47 UTC (History)
0 users

See Also:


Attachments
patch.txt (1.64 KB, text/plain; format=flowed)
2010-03-09 10:17 UTC, Munehiro Matsuda
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description subbsd 2010-03-02 21:30:02 UTC
According http://lists.freebsd.org/pipermail/freebsd-current/2010-January/014893.html FreeBSD changes utmp -> utmx 

So, when __FreeBSD_version >= 900007 compile is broken: 

In file included from ../include/conf.h:241,
                 from log.c:31:
/usr/include/sys/termios.h:3:2: warning: #warning "this file includes <sys/termios.h> which is deprecated, use <termios.h> instead"
log.c: In function 'log_wtmp':
log.c:58: error: storage size of 'ut' isn't known
log.c:130: error: 'WTMP_FILE' undeclared (first use in this function)
log.c:130: error: (Each undeclared identifier is reported only once
log.c:130: error: for each function it appears in.)
log.c:58: warning: unused variable 'ut'
gmake[1]: *** [log.o] Error 1
gmake[1]: Leaving directory `/usr/ports/ftp/proftpd/work/proftpd-1.3.2e/src'
gmake: *** [src] Error 2
*** Error code 1

Stop in /usr/ports/ftp/proftpd.
*** Error code 1

Stop in /usr/ports/ftp/proftpd.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2010-03-02 21:30:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->mm

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Munehiro Matsuda 2010-03-09 10:17:04 UTC
I've created a patch to work around the problem.

Hope this helps.

haro
Comment 3 Wesley Shields freebsd_committer freebsd_triage 2010-03-14 01:42:57 UTC
I just fixed a similar bug with a different patch in ftp/proftpd-devel,
which was submitted by the upstream maintainer privately to me. It may
be of interest in this PR.

http://www.freebsd.org/cgi/cvsweb.cgi/ports/ftp/proftpd-devel/files/patch-src__wtmp.c?rev=1.1

-- WXS
Comment 4 Munehiro Matsuda 2010-03-15 05:37:50 UTC
----Next_Part(Mon_Mar_15_14_37_50_2010_013)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

From: Wesley Shields <wxs@FreeBSD.org>
Date: Sat, 13 Mar 2010 20:42:57 -0500
>I just fixed a similar bug with a different patch in ftp/proftpd-devel,
>which was submitted by the upstream maintainer privately to me. It may
>be of interest in this PR.
>
>http://www.freebsd.org/cgi/cvsweb.cgi/ports/ftp/proftpd-devel/files/patch-src__wtmp.c?rev=1.1
>
>-- WXS

Hello Wesley,

Thanks for the info.
For proftpd-1.3.2e, I had to modify the patch like the attached:
  patch-src__log.c

Thanx,
 Haro
=-----------------------------------------------------------------------
           _ _    Munehiro (haro) Matsuda
 -|- /_\  |_|_|   KGT Inc.
 /|\ |_|  |_|_| 

----Next_Part(Mon_Mar_15_14_37_50_2010_013)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="patch-src__log.c"

Index: src/log.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/log.c,v
retrieving revision 1.2
diff -u -r1.2 log.c
--- src/log.c	18 Feb 2009 18:24:50 -0000	1.2
+++ src/log.c	13 Mar 2010 17:06:33 -0000
@@ -55,12 +55,15 @@
 int log_wtmp(char *line, const char *name, const char *host,
     pr_netaddr_t *ip) {
   struct stat buf;
+#if !defined(__FreeBSD_version) || __FreeBSD_version < 900007 || !defined(HAVE_UTMPX_H)
   struct utmp ut;
+#endif
   int res = 0;
   static int fd = -1;
 
 #if ((defined(SVR4) || defined(__SVR4)) || \
-    (defined(__NetBSD__) && defined(HAVE_UTMPX_H))) && \
+    (defined(__NetBSD__) && defined(HAVE_UTMPX_H)) || \
+    (defined(__FreeBSD_version) && __FreeBSD_version >= 900007 && defined(HAVE_UTMPX_H))) && \
     !(defined(LINUX) || defined(__hpux) || defined (_AIX))
   /* This "auxilliary" utmp doesn't exist under linux. */
 #if defined(__sparcv9) && !defined(__NetBSD__)
@@ -71,8 +72,17 @@
 #endif 
   static int fdx = -1;
 
-#if !defined(WTMPX_FILE) && defined(_PATH_WTMPX)
-# define WTMPX_FILE _PATH_WTMPX
+#if !defined(WTMPX_FILE)
+# if defined(_PATH_WTMPX)
+#   define WTMPX_FILE _PATH_WTMPX
+# elif defined(_PATH_UTMPX)
+#   define WTMPX_FILE _PATH_UTMPX
+# else
+/* This path works for FreeBSD; not sure what to do for other platforms which
+ * don't define _PATH_WTMPX or _PATH_UTMPX.
+ */
+#   define WTMPX_FILE "/var/log/utx.log"
+# endif
 #endif
 
   if (fdx < 0 &&
@@ -98,6 +108,9 @@
     memcpy(&utx.ut_ss, pr_netaddr_get_inaddr(ip), sizeof(utx.ut_ss));
     gettimeofday(&utx.ut_tv, NULL);
+#elif defined(__FreeBSD_version) && __FreeBSD_version >= 900007 && defined(HAVE_UTMPX_H)
+    gettimeofday(&utx.ut_tv, NULL);
+
 #else /* SVR4 */
     utx.ut_syslen = strlen(utx.ut_host)+1;
 #  ifdef __sparcv9

----Next_Part(Mon_Mar_15_14_37_50_2010_013)----
Comment 5 Martin Matuska freebsd_committer freebsd_triage 2010-03-30 15:25:35 UTC
Does this Problem still occur with ProFTPd 1.3.3?
If yes, can you provide an updated patch?
Thanks, mm.
Comment 6 Martin Matuska freebsd_committer freebsd_triage 2010-03-30 16:18:00 UTC
State Changed
From-To: open->feedback

Awaiting feedback from originator.
Comment 7 dfilter service freebsd_committer freebsd_triage 2010-05-13 15:30:51 UTC
mm          2010-05-13 14:30:42 UTC

  FreeBSD ports repository

  Added files:
    ftp/proftpd/files    patch-src-wtmp.c 
  Log:
  - Fix breakage on 9-CURRENT
  - Bump PORTREVISON
  
  PR:             ports/144439
  Reported by:    subbsd <subbsd@gmail.com>
  
  Revision  Changes    Path
  1.1       +53 -0     ports/ftp/proftpd/files/patch-src-wtmp.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 8 Martin Matuska freebsd_committer freebsd_triage 2010-05-13 16:47:15 UTC
State Changed
From-To: feedback->closed

Committed, with minor changes. Thanks!