Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Nov 2002 15:09:32 +0100 (CET)
From:      Matthias Andree <matthias.andree@gmx.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/45238: maintainer update port: mail/bogofilter 
Message-ID:  <200211121409.gACE9WNW002162@libertas.emma.line.org>

next in thread | raw e-mail | index | archive | help

>Number:         45238
>Category:       ports
>Synopsis:       maintainer update port: mail/bogofilter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 12 06:10:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Matthias Andree
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD libertas.emma.line.org 4.7-STABLE FreeBSD 4.7-STABLE #3: Sun Nov 3 18:49:35 CET 2002 toor@libertas.emma.line.org:/usr/src/sys/compile/LIBERTAS i386


	
>Description:
[BCC to bogofilter-dev mailing list]
The attached patch fixes a "Can't find $HOME." error when bogofilter
is started from a daemon that never logged in.
	
>How-To-Repeat:
echo "test" | env - PATH=$PATH bogofilter -p -e
	
>Fix:
1. cd to ports/mail/bogofilter
2. apply this patch with -p4:

diff -Nur /usr/ports/mail/bogofilter/Makefile /usr/myports/bogofilter/Makefile
--- /usr/ports/mail/bogofilter/Makefile	Mon Nov 11 18:34:27 2002
+++ /usr/myports/bogofilter/Makefile	Tue Nov 12 03:41:46 2002
@@ -7,6 +7,7 @@
 
 PORTNAME=	bogofilter
 PORTVERSION=	0.8.0
+PORTREVISION=	1
 CATEGORIES=	mail
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -18,6 +19,7 @@
 # This port needs PERL5 at run time, but not for the build.
 USE_PERL5=	yes
 GNU_CONFIGURE=	yes
+PATCH_STRIP=	-p1
 CONFIGURE_ENV=	CPPFLAGS="-I${PREFIX}/include/db4" \
 		LDFLAGS="-L${PREFIX}/lib"
 
diff -Nur /usr/ports/mail/bogofilter/files/patch-bogofilter-0.8.0.1.diff /usr/myports/bogofilter/files/patch-bogofilter-0.8.0.1.diff
--- /usr/ports/mail/bogofilter/files/patch-bogofilter-0.8.0.1.diff	Thu Jan  1 01:00:00 1970
+++ /usr/myports/bogofilter/files/patch-bogofilter-0.8.0.1.diff	Tue Nov 12 03:40:35 2002
@@ -0,0 +1,260 @@
+diff -NurbBw bogofilter-0.8.0/Makefile.in bogofilter-0.8.0.1/Makefile.in
+--- bogofilter-0.8.0/Makefile.in	Sat Nov  9 19:21:40 2002
++++ bogofilter-0.8.0.1/Makefile.in	Mon Nov 11 02:07:42 2002
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.7 from Makefile.am.
++# Makefile.in generated by automake 1.7.1 from Makefile.am.
+ # @configure_input@
+ 
+ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+@@ -119,7 +119,9 @@
+ man1_MANS = bogofilter.1 bogoutil.1 bogoupgrade.1 bogolexer.1
+ 
+ # what to build that from
+-MYCOMMON = xmalloc.h xmalloc.c xstrdup.h xstrdup.c globals.h debug.h debug.c
++MYCOMMON = xmalloc.h xmalloc.c xstrdup.h xstrdup.c globals.h debug.h \
++debug.c find_home.c find_home.h
++
+ 
+ BUILT_SOURCES = version.h
+ 
+@@ -164,7 +166,8 @@
+ check_PROGRAMS = debugtest$(EXEEXT) configtest$(EXEEXT)
+ PROGRAMS = $(bin_PROGRAMS)
+ 
+-am__objects_1 = xmalloc.$(OBJEXT) xstrdup.$(OBJEXT) debug.$(OBJEXT)
++am__objects_1 = xmalloc.$(OBJEXT) xstrdup.$(OBJEXT) debug.$(OBJEXT) \
++	find_home.$(OBJEXT)
+ am_bogofilter_OBJECTS = bogofilter.$(OBJEXT) main.$(OBJEXT) \
+ 	lexer.$(OBJEXT) datastore_db.$(OBJEXT) config.$(OBJEXT) \
+ 	rstats.$(OBJEXT) wordhash.$(OBJEXT) wordlists.$(OBJEXT) \
+@@ -206,10 +209,11 @@
+ @AMDEP_TRUE@	./$(DEPDIR)/bogolexer.Po ./$(DEPDIR)/bogoutil.Po \
+ @AMDEP_TRUE@	./$(DEPDIR)/config.Po ./$(DEPDIR)/configtest.Po \
+ @AMDEP_TRUE@	./$(DEPDIR)/datastore_db.Po ./$(DEPDIR)/debug.Po \
+-@AMDEP_TRUE@	./$(DEPDIR)/debug.main.Po ./$(DEPDIR)/lexer.Po \
+-@AMDEP_TRUE@	./$(DEPDIR)/main.Po ./$(DEPDIR)/rstats.Po \
+-@AMDEP_TRUE@	./$(DEPDIR)/wordhash.Po ./$(DEPDIR)/wordlists.Po \
+-@AMDEP_TRUE@	./$(DEPDIR)/xmalloc.Po ./$(DEPDIR)/xstrdup.Po
++@AMDEP_TRUE@	./$(DEPDIR)/debug.main.Po ./$(DEPDIR)/find_home.Po \
++@AMDEP_TRUE@	./$(DEPDIR)/lexer.Po ./$(DEPDIR)/main.Po \
++@AMDEP_TRUE@	./$(DEPDIR)/rstats.Po ./$(DEPDIR)/wordhash.Po \
++@AMDEP_TRUE@	./$(DEPDIR)/wordlists.Po ./$(DEPDIR)/xmalloc.Po \
++@AMDEP_TRUE@	./$(DEPDIR)/xstrdup.Po
+ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+@@ -351,6 +355,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datastore_db.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.main.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_home.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lexer.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rstats.Po@am__quote@
+@@ -567,9 +572,11 @@
+ 	mkdir $(distdir)
+ 	$(mkinstalldirs) $(distdir)/. $(distdir)/contrib $(distdir)/doc
+ 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
++	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ 	list='$(DISTFILES)'; for file in $$list; do \
+ 	  case $$file in \
+ 	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
++	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ 	  esac; \
+ 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+@@ -628,7 +635,6 @@
+ 	chmod a-w $(distdir)
+ 	dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
+ 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+-	  && $(mkinstalldirs) $$dc_destdir \
+ 	  && cd $(distdir)/=build \
+ 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+@@ -641,7 +647,9 @@
+ 	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ 	        distuninstallcheck \
+ 	  && chmod -R a-w "$$dc_install_base" \
+-	  && ({   $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
++	  && ({ \
++	       (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
++	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ 	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+diff -NurbBw bogofilter-0.8.0/config.c bogofilter-0.8.0.1/config.c
+--- bogofilter-0.8.0/config.c	Thu Oct 31 06:23:32 2002
++++ bogofilter-0.8.0.1/config.c	Mon Nov 11 02:06:36 2002
+@@ -21,6 +21,7 @@
+ #include "wordlists.h"
+ #include "xmalloc.h"
+ #include "xstrdup.h"
++#include "find_home.h"
+ 
+ #ifndef	DEBUG_CONFIG
+ #define DEBUG_CONFIG(level)	(verbose > level)
+@@ -150,7 +151,7 @@
+ 
+     if ( *filename == '~' )
+     {
+-	char *home = getenv( "HOME" );
++	char *home = find_home(TRUE);
+ 	if ( home == NULL )
+ 	{
+ 	    fprintf( stderr, "Can't find $HOME.\n" );
+diff -NurbBw bogofilter-0.8.0/configure bogofilter-0.8.0.1/configure
+--- bogofilter-0.8.0/configure	Sat Nov  9 19:21:44 2002
++++ bogofilter-0.8.0.1/configure	Mon Nov 11 02:07:43 2002
+@@ -1500,7 +1500,7 @@
+ 
+ # Define the identity of the package.
+  PACKAGE=bogofilter
+- VERSION=0.8.0
++ VERSION=0.8.0.1
+ 
+ 
+ cat >>confdefs.h <<_ACEOF
+@@ -2563,7 +2563,7 @@
+     if depmode=$depmode \
+        source=conftest.c object=conftest.o \
+        depfile=conftest.Po tmpdepfile=conftest.TPo \
+-       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
++       $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 &&
+        grep conftest.h conftest.Po > /dev/null 2>&1 &&
+        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+       am_cv_CC_dependencies_compiler_type=$depmode
+diff -NurbBw bogofilter-0.8.0/find_home.c bogofilter-0.8.0.1/find_home.c
+--- bogofilter-0.8.0/find_home.c	Thu Jan  1 01:00:00 1970
++++ bogofilter-0.8.0.1/find_home.c	Mon Nov 11 02:05:44 2002
+@@ -0,0 +1,56 @@
++/* find_home.c -- library function to figure out the home dir of current user */
++
++/* (C) 2002 by Matthias Andree <matthias.andree@gmx.de>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * General Public License for more details, it is in the file named
++ * COPYING.
++ */
++
++/* $Id: find_home.c,v 1.5 2002/11/11 00:03:25 m-a Exp $ */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include <unistd.h>
++#include <pwd.h>
++#include <sys/types.h>
++
++#include "find_home.h"
++#include "xmalloc.h"
++#include "xstrdup.h"
++
++/* This function will try to figure out the home directory of the user.
++ * 
++ * If read_env is not zero, it will try to obtain the HOME environment
++ * variable and return if it is defined and not empty.
++ * 
++ * Then, it will look up the password entry of the current effective
++ * user id and return the pw_dir field.
++ *
++ * This function returns NULL in case of failure.
++ */
++const char *find_home(int read_env) {
++    char *r;
++    uid_t u;
++    struct passwd *pw;
++
++    if (read_env) {
++	if ((r = getenv("HOME")) != NULL && *r != '\0')
++	    return r;
++    }
++
++    u = geteuid();
++    pw = getpwuid(u);
++    if (pw != NULL) {
++	return pw -> pw_dir;
++    }
++    return NULL;
++}
+diff -NurbBw bogofilter-0.8.0/find_home.h bogofilter-0.8.0.1/find_home.h
+--- bogofilter-0.8.0/find_home.h	Thu Jan  1 01:00:00 1970
++++ bogofilter-0.8.0.1/find_home.h	Mon Nov 11 02:05:44 2002
+@@ -0,0 +1,33 @@
++/* $Id: find_home.h,v 1.7 2002/11/11 00:03:25 m-a Exp $ */
++
++/* find_home.h -- library function to figure out the home dir of current user */
++
++#ifndef FIND_HOME_H
++#define FIND_HOME_H
++
++/* (C) 2002 by Matthias Andree <matthias.andree@gmx.de>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * General Public License for more details, it is in the file named
++ * COPYING.
++ */
++
++/*@null@*/ /*@observer@*/
++const char *
++find_home(int read_env) /*@globals errno@*/;
++
++/*@null@*/ /*@observer@*/
++const char *
++find_home_user(const char *username) /*@globals errno@*/;
++
++/*@only@*/
++char *
++tildeexpand(const char *filename) /*@globals errno@*/;
++
++#endif
+diff -NurbBw bogofilter-0.8.0/main.c bogofilter-0.8.0.1/main.c
+--- bogofilter-0.8.0/main.c	Wed Nov  6 01:07:59 2002
++++ bogofilter-0.8.0.1/main.c	Mon Nov 11 02:28:08 2002
+@@ -26,6 +26,9 @@
+ #include "version.h"
+ #include "common.h"
+ #include "bogofilter.h"
++#include "find_home.h"
++#include "xmalloc.h"
++#include "xstrdup.h"
+ 
+ #define BOGODIR ".bogofilter"
+ 
+@@ -254,6 +257,16 @@
+ {
+     int   exitcode;
+ 
++    if (NULL == getenv("HOME")) {
++	const char *t;
++	if ((t = find_home(FALSE)) != NULL) {
++	    char *t2 = xmalloc(strlen(t) + 6);
++	    strcpy(t2, "HOME=");
++	    strcat(t2, t);
++	    putenv(xstrdup(t2)); /* putenv may leak memory by copying again */
++	    free(t2);
++	}
++    }
+     set_dir_from_env(directory, "HOME", BOGODIR);
+     set_dir_from_env(directory, "BOGOFILTER_DIR", NULL);
+ 
+diff -NurbBw bogofilter-0.8.0/version.h bogofilter-0.8.0.1/version.h
+--- bogofilter-0.8.0/version.h	Sat Nov  9 19:22:01 2002
++++ bogofilter-0.8.0.1/version.h	Mon Nov 11 02:28:09 2002
+@@ -1,2 +1,2 @@
+ #undef  VERSION
+-#define VERSION "0.8.0"
++#define VERSION "0.8.0.1"
	


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211121409.gACE9WNW002162>