Bug 195184 - sysutils/logrotate [patch] logrotate can't send email
Summary: sysutils/logrotate [patch] logrotate can't send email
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Many People
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-19 21:05 UTC by rand
Modified: 2015-01-06 10:26 UTC (History)
1 user (show)

See Also:


Attachments
fix and update (1.58 KB, patch)
2015-01-06 10:19 UTC, Kurt Jaeger
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rand 2014-11-19 21:05:56 UTC
The patch to config.h of logrotate specifies "/usr/bin/mailx -s"
	as the mail command, but since logrotate does an exec of that 
	it fails. The code actually adds -s to the argument list, so the 
	correct definition is:
	  #define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
	I've included an updated patch-config.h file for the port.

How-To-Repeat:
Try to enable the "mail" option to logrotate.

Fix:
diff --git a/config.h b/config.h
index ae7f308..7c0a2b3 100644
--- a/config.h
+++ b/config.h
@@ -16,6 +16,13 @@
 #define STATEFILE "/var/log/logrotate.status"
 #endif
 
+#ifdef __FreeBSD__
+    #define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
+    #define COMPRESS_COMMAND "/usr/bin/gzip"
+    #define UNCOMPRESS_COMMAND "/usr/bin/gunzip"
+    #define STATEFILE "/var/run/logrotate.status"
+#endif
+
 /*
  * Default settings for Linux - leave these last.
  */
Comment 1 Kurt Jaeger freebsd_committer freebsd_triage 2015-01-06 10:19:35 UTC
Created attachment 151390 [details]
fix and update
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-01-06 10:25:51 UTC
A commit references this bug:

Author: pi
Date: Tue Jan  6 10:25:14 UTC 2015
New revision: 376419
URL: https://svnweb.freebsd.org/changeset/ports/376419

Log:
  sysutils/logrotate: 3.8.7 -> 3.8.8, fix mail sending

  - Add support for building using autotools/automake.
    Using "./autogen.sh", "./configure" and "make" is now preferred way
    how to build logrotate.
    Old Makefile remains available, but it is deprecated and will be removed
    in the future. Please report any problem related to new build system.
  - Add support for systems which do not support fork (use vfork instead)
    and madvise.
  - Fix bug when wrong log file has been removed in case of dateext and
    dateformat %d-%m-%Y.
  - Do not expect that the name of root account is 'root'.
  - Do not stop rotation with an error when olddir and log file
    are on different devices and copy or copytruncate is used.
  - Return an error code when parent directory of log does not exist,
    "su" directive is not used, logrotate is running as root and missingok
    is not specified. [vcizek]
  - Prepend error printed by compression program with the log name even when
    the compression program exits with zero exit code.

  PR:		195184
  Submitted by:	rand@meridian-enviro.com
  Approved by:	maintainer (timeout)

Changes:
  head/sysutils/logrotate/Makefile
  head/sysutils/logrotate/distinfo
  head/sysutils/logrotate/files/patch-config.h
Comment 3 Kurt Jaeger freebsd_committer freebsd_triage 2015-01-06 10:26:12 UTC
Committed, thanks.