Package: cron Version: 3.0pl1-106 Severity: wishlist Tags: patch When cron sends email, it includes the hostname in the subject. Except, it abbreviates it to the part before the first ".". That seems kind of pointless for me except as a matter of overzealous brevity. Moreover, I have systems in different domains with the same first part of the hostname. So I would like cron to report the whole thing.
This isn't a big deal as I can easily distinguish the mails by their email addresses, but it's nice for the subject to be clear. Anyway, up to you. I'm appending a patch. Nobody else was using the function first_word, so I removed it. Andrew --- cron.h.orig 2010-02-18 18:01:19.000000000 +0000 +++ cron.h 2010-02-18 18:01:21.000000000 +0000 @@ -235,7 +235,6 @@ char *env_get __P((char *, char **)), *arpadate __P((time_t *)), *mkprints __P((unsigned char *, unsigned int)), - *first_word __P((char *, char *)), **env_init __P((void)), **env_copy __P((char **)), **env_set __P((char **, char *)); --- do_command.c.orig 2010-02-18 18:00:49.000000000 +0000 +++ do_command.c 2010-02-18 18:01:42.000000000 +0000 @@ -511,7 +511,7 @@ fprintf(mail, "From: root (Cron Daemon)\n"); fprintf(mail, "To: %s\n", mailto); fprintf(mail, "Subject: Cron <%...@%s> %s\n", - usernm, first_word(hostname, "."), + usernm, hostname, e->cmd); # if defined(MAIL_DATE) fprintf(mail, "Date: %s\n", --- misc.c.orig 2010-02-18 18:01:31.000000000 +0000 +++ misc.c 2010-02-18 18:01:04.000000000 +0000 @@ -580,40 +580,6 @@ } -/* two warnings: - * (1) this routine is fairly slow - * (2) it returns a pointer to static storage - */ -char * -first_word(s, t) - register char *s; /* string we want the first word of */ - register char *t; /* terminators, implicitly including \0 */ -{ - static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */ - static int retsel = 0; - register char *rb, *rp; - - /* select a return buffer */ - retsel = 1-retsel; - rb = &retbuf[retsel][0]; - rp = rb; - - /* skip any leading terminators */ - while (*s && (NULL != strchr(t, *s))) { - s++; - } - - /* copy until next terminator or full buffer */ - while (*s && (NULL == strchr(t, *s)) && (rp < &rb[MAX_TEMPSTR])) { - *rp++ = *s++; - } - - /* finish the return-string and return it */ - *rp = '\0'; - return rb; -} - - /* warning: * heavily ascii-dependent. */ -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.32-trunk-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages cron depends on: ii adduser 3.112 add and remove users and groups ii debianutils 3.2.2 Miscellaneous utilities specific t ii libc6 2.10.2-5 Embedded GNU C Library: Shared lib ii libpam0g 1.1.1-1 Pluggable Authentication Modules l ii libselinux1 2.0.89-4 SELinux runtime shared libraries ii lsb-base 3.2-23 Linux Standard Base 3.2 init scrip Versions of packages cron recommends: ii exim4 4.71-3 metapackage to ease Exim MTA (v4) ii exim4-daemon-light [mail-tran 4.71-3 lightweight Exim MTA (v4) daemon pn lockfile-progs <none> (no description available) Versions of packages cron suggests: pn anacron <none> (no description available) pn checksecurity <none> (no description available) ii logrotate 3.7.8-4 Log rotation utility -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org