From 62b040336328d99ade41776bd52b1d7cd7298629 Mon Sep 17 00:00:00 2001 From: dale_mellor Date: Sat, 5 Jul 2003 12:13:19 +0000 Subject: Disabled installation of cron, crontab by default. Fixed up all information files to reflect this. --- BUGS | 6 ++++-- ChangeLog | 24 +++-------------------- NEWS | 16 ++++++++++++++-- README | 59 +++++++++++++++++++++++++++++++++++---------------------- TODO | 10 +++++++--- config.scm.in | 1 - configure.ac | 39 ++++++++++++++++++++------------------ crontab.scm | 19 ++++++++----------- environment.scm | 14 +++++++------- makefile.am | 6 ++++++ mcron.scm | 15 ++++++--------- mcron.texinfo | 6 ++++++ vixie.scm | 9 ++++----- 13 files changed, 122 insertions(+), 102 deletions(-) diff --git a/BUGS b/BUGS index 9eabf92..f501ccb 100644 --- a/BUGS +++ b/BUGS @@ -1,4 +1,4 @@ - -*-text-*- + -*-text-*- * If two users modify their crontabs simultaneously, there will be contention for /var/cron/update between themselves and with the main daemon. @@ -9,5 +9,7 @@ Coordinated Time (UTC). + * As often as not the cron daemon crashes (segfaults) when crontab sends it a - SIGHUP. + SIGHUP. For this reason, the current release does not install cron or + crontab. diff --git a/ChangeLog b/ChangeLog index ae6a219..16394df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,23 +1,7 @@ -2003-06-30 hydro23 > +2003-07-05 Dale Mellor - * mcron.scm: Introduced arbiters to marshall access to updates - structure between main routing and HUP signal action procedure. - - * crontab.scm: When an empty /tmp file is produced for editing, - make it owned by the real user (so he can edit it). - - * mcron.scm, makefile.am: Check explicitly for root user when - running cron personality. Install with only root execute - permission. - - * mcron.scm: Don't create /var/run/cron.pid if the -s option has - been used (this is an undocumented possibility). - - * configure.ac, config.scm.in: Added configure option - --enable-debug to determine whether debugging and traceback should - be turned on. - - * Version bumped to 0.99.2. + * configure.ac, makefile.am: Disabled installation of cron, + crontab programs by default as they are broken. 2003-06-28 Dale Mellor @@ -26,5 +10,3 @@ testing... * Version set at 0.99.1 - - diff --git a/NEWS b/NEWS index 5050482..f112b18 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,23 @@ -Historic moments in the life of mcron. +Historic moments in the life of mcron. -*-text-*- -Copyright (C) 1992, 1993, 1995-2002 Free Software Foundation, Inc. +Copyright (C) 2003 Dale Mellor See the end for copying conditions. Please send bug reports to dale_mellor@users.sourceforge.net. +Saturday, 5th July 2003 + Released version 0.99.1, with installation of cron and crontab disabled by + default (suspect problems with Guile internals are preventing these from + working properly). The CVS tag is release_0-99-1 (no branch has been created + for it). + + +Friday, 4th July 2003 + We have been accepted as a Savannah project. A CVS repository and web home + page have been created. We're still waiting for acceptance as a GNU project. + + ---------------------------------------------------------------------- diff --git a/README b/README index 06ccae1..d6e6524 100644 --- a/README +++ b/README @@ -1,38 +1,51 @@ + -*-text-*- + This is version 0.99.1 of the mcron program, designed and written by Dale Mellor, which replaces and hugely enhances Vixie cron. It is functionally complete, production quality code (did you expect less?), but has not received much testing yet and contains known bugs. It has only been built on a GNU/Linux system, and will most likely fail on others (but you never know...). +Mcron is supposed to be 100% Vixie compatible. However, in the current release +this is broken, and by default only 50% compatibility is installed. + ---------------------------------------------------------------------- IMPORTANT NOTICES Read the BUGS file. -Do not (yet) install this software on a machine which relies for its functioning -on its current set of crontabs. - -The package must be installed by root. - -Before installing this package for the first time, it is necessary to terminate -any running cron daemons on your system. If your old cron is not accurately -Vixie compatible (files in /var/cron/tabs*, /var/cron/allow, /var/cron/deny, -/etc/crontab, /var/run/cron.pid) then you will need to clear out all old -crontabs and make new ones afresh. - -If your old cron is Vixie, or very similar, mcron should fall right into place -where your old cron was (the binaries cron and crontab will be replaced), and -you should be able to continue to use your existing crontabs without noticing -any changes. Bear in mind that if you use /etc/crontab, then changes to this -file will *not* take immediate effect (this is the 1% incompatibility between -mcron and Vixie cron); you may want to add a comment to this file with a note to -this effect. Alternatively, use the new mcron program, it's better! - -If you don't want to clobber your existing cron executables, you can specify the ---program-prefix option to configure with a prefix ending in a non-alphabetic -character, for example "m.", and then run the programs as m.mcron, m.cron and -m.crontab. +By default, the cron and crontab programs are not installed, and mcron will +happiliy coexist alongside any existing cron programs you have on your +system. The Vixie-style programs can be installed by specifying --enable-vixie +to the configure command, in which case you must take heed of the following +notes. + + + Do not (yet) install this software on a machine which relies for its + functioning on its current set of crontabs. + + The package must be installed by root. + + Before installing this package for the first time, it is necessary to + terminate any running cron daemons on your system. If your old cron is not + accurately Vixie compatible (files in /var/cron/tabs*, /var/cron/allow, + /var/cron/deny, /etc/crontab, /var/run/cron.pid) then you will need to clear + out all old crontabs and make new ones afresh. + + If your old cron is Vixie, or very similar, mcron should fall right into + place where your old cron was (the binaries cron and crontab will be + replaced), and you should be able to continue to use your existing crontabs + without noticing any changes. Bear in mind that if you use /etc/crontab, + then changes to this file will *not* take immediate effect (this is the 1% + incompatibility between mcron and Vixie cron); you may want to add a comment + to this file with a note to this effect. Alternatively, use the new mcron + program, it's better! + + If you don't want to clobber your existing cron executables, you can specify + the --program-prefix option to configure with a prefix ending in a + non-alphabetic character, for example "m.", and then run the programs as + m.mcron, m.cron and m.crontab. ---------------------------------------------------------------------- diff --git a/TODO b/TODO index 5f61fcf..b3ca4aa 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + -*-text-*- + Maybe in the near future... * Logging. @@ -16,8 +18,9 @@ There are no plans to actually do the following any time soon... * Full security audit for Vixie mode. - * Move internal functions into a namespace such that configuration files - cannot interfere with mcron itself. + * Move internal functions into a namespace, or provide alternative + environments, such that configuration files cannot interfere with mcron + itself. @@ -28,7 +31,8 @@ Quite likely to happen if version 2.0 ever materializes... * UNIX or TCP socket will allow interrogation and control of a running daemon (should be more reliable, efficient and useful than using the - SIGHUP-/var/cron/update method). + SIGHUP-/var/cron/update method). (I did already try this but, as with + processes, Guile's use of threads falls over.) diff --git a/config.scm.in b/config.scm.in index f31ac1e..bd62764 100644 --- a/config.scm.in +++ b/config.scm.in @@ -24,4 +24,3 @@ (define config-package-string "@PACKAGE_STRING@") (define config-package-bugreport "@PACKAGE_BUGREPORT@") (define config-sendmail "@SENDMAIL@") -(define config-cat "@CAT@") diff --git a/configure.ac b/configure.ac index f56b111..6c98da4 100644 --- a/configure.ac +++ b/configure.ac @@ -20,30 +20,41 @@ else fi AC_SUBST(CONFIG_DEBUG) - + +AC_MSG_CHECKING([whether the (broken) Vixie programs are requested]) +AC_ARG_ENABLE(vixie, + AC_HELP_STRING([--enable-vixie], + [enable installation of cron and crontab programs]), + CONFIG_ENABLE_VIXIE=$enableval, + CONFIG_ENABLE_VIXIE=no) +AC_MSG_RESULT($CONFIG_ENABLE_VIXIE) +AC_SUBST(CONFIG_ENABLE_VIXIE) + + +# We substitute the following commands into the makefile by configure, because +# automake is confused by the ifeq command. + +IFEQ_VIXIE="ifeq (\$(CONFIG_ENABLE_VIXIE), yes)" +AC_SUBST(IFEQ_VIXIE) +ENDIF="endif" +AC_SUBST(ENDIF) + + AC_PROG_CC GUILE_PROGS GUILE_FLAGS # Checks for programs. - # AC_CHECK_PROG(CHMOD, chmod, chmod) -AC_CHECK_PROGS(CHMOD, chmod) -if test "x$ac_cv_prog_CHMOD" = "x"; then - AC_MSG_ERROR(chmod not found) -fi AC_CHECK_PROGS(ED, ed) if test "x$ac_cv_prog_ED" = "x"; then AC_MSG_ERROR(ed not found) fi -AC_CHECK_PROGS(CAT, cat) -if test "x$ac_cv_prog_CAT" = "x"; then - AC_MSG_ERROR(cat not found) -fi AC_CHECK_PROGS(WHICH, which) if test "x$ac_cv_prog_WHICH" = "x"; then AC_MSG_ERROR(which not found) fi + # Now find a sendmail or equivalent. AC_CHECK_PROGS(SENDMAIL, sendmail) @@ -66,14 +77,6 @@ fi SENDMAIL=$ac_cv_prog_SENDMAIL -# Checks for libraries. - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. - -# Checks for library functions. - real_program_prefix=`echo $program_prefix | sed s/NONE//` AC_SUBST(real_program_prefix) diff --git a/crontab.scm b/crontab.scm index 417a900..f7bcf2a 100644 --- a/crontab.scm +++ b/crontab.scm @@ -82,8 +82,7 @@ ;; Iff the real user is root, he can use the -u option to access files of ;; another user. -(define crontab-user - (option-ref options 'user crontab-real-user)) +(define crontab-user (option-ref options 'user crontab-real-user)) @@ -147,12 +146,11 @@ ((option-ref options 'edit #f) (let ((temp-file (string-append "/tmp/crontab." (number->string (getpid)))) - (editor (if (getenv "VISUAL") (getenv "VISUAL") - (if (getenv "EDITOR") (getenv "EDITOR") - "vi")))) - (catch #t - (lambda () (copy-file crontab-file temp-file)) - (lambda (key . args) (with-output-to-file temp-file (lambda () #t)))) + (editor (cond ((getenv "VISUAL") (getenv "VISUAL")) + ((getenv "EDITOR") (getenv "EDITOR")) + (else "vi")))) + (catch #t (lambda () (copy-file crontab-file temp-file)) + (lambda (key . args) (with-output-to-file temp-file noop))) (chown temp-file (getuid) (getgid)) (system (string-append editor " " temp-file)) (read-vixie-file temp-file) @@ -167,7 +165,7 @@ ((option-ref options 'remove #f) (catch #t (lambda () (delete-file crontab-file) (hit-server crontab-user)) - (lambda (key . args) #t))) + noop)) ;; In the case of the replace personality we loop over all the arguments on the @@ -194,6 +192,5 @@ ;; used to put out, for total compatibility. (else - (display - "crontab: usage error: file name must be specified for replace.\n") + (display "crontab: usage error: file name must be specified for replace.\n") (primitive-exit 15))) diff --git a/environment.scm b/environment.scm index e4d59a8..f2a8119 100644 --- a/environment.scm +++ b/environment.scm @@ -36,14 +36,14 @@ ;; to control is added at the end of the list. (define (impose-default-environment env-alist passwd-entry) - (append (list (cons "HOME" (passwd:dir passwd-entry)) - (cons "CWD" (passwd:dir passwd-entry)) - (cons "SHELL" (passwd:shell passwd-entry)) - '("TERM" . #f) - '("TERMCAP" . #f)) + (append `(("HOME" . ,(passwd:dir passwd-entry)) + ("CWD" . ,(passwd:dir passwd-entry)) + ("SHELL" . ,(passwd:shell passwd-entry)) + ("TERM" . #f) + ("TERMCAP" . #f)) env-alist - (list (cons "LOGNAME" (passwd:name passwd-entry)) - (cons "USER" (passwd:name passwd-entry))))) + `(("LOGNAME" . ,(passwd:name passwd-entry)) + ("USER" . ,(passwd:name passwd-entry))))) diff --git a/makefile.am b/makefile.am index 00b54ee..4276ebc 100644 --- a/makefile.am +++ b/makefile.am @@ -41,21 +41,27 @@ mcron.c : config.scm mcron.scm vixie.scm environment.scm email.scm crontab.scm \ @rm -f mcron.escaped.scm > /dev/null 2>&1 install-exec-local: +@IFEQ_VIXIE@ @if [ `id -u` -ne 0 ]; then \ echo "*** MUST BE ROOT TO INSTALL MCRON ***"; \ exit 1; \ fi +@ENDIF@ #full program prefix fpp = $(DESTDIR)$(bindir)/@real_program_prefix@ install-exec-hook: +@IFEQ_VIXIE@ @rm -f $(fpp)cron$(EXEEXT) > /dev/null 2>&1 @$(INSTALL) --mode='u=rwx' mcron$(EXEEXT) $(fpp)cron$(EXEEXT) @rm -f $(fpp)crontab$(EXEEXT) > /dev/null 2>&1 @$(INSTALL) --mode='u=rwxs,og=rx' mcron$(EXEEXT) $(fpp)crontab$(EXEEXT) +@ENDIF@ ./mkinstalldirs -m 'u=rwx' /var/cron ./mkinstalldirs -m 'u=rwx,og=rx' /var/run uninstall-hook: +@IFEQ_VIXIE@ @rm -f $(fpp){cron,crontab}$(EXEEXT) +@ENDIF@ diff --git a/mcron.scm b/mcron.scm index b41a88b..08842cd 100644 --- a/mcron.scm +++ b/mcron.scm @@ -239,8 +239,7 @@ Report bugs to " config-package-bugreport ".\n (display " /var/run/cron.pid.)\n") (primitive-exit 1))) (if (not (option-ref options 'schedule #f)) - (with-output-to-file "/var/run/cron.pid" - (lambda () #t))) + (with-output-to-file "/var/run/cron.pid" noop)) (setenv "MAILTO" #f) (c-set-cron-signals))) @@ -604,19 +603,17 @@ Report bugs to " config-package-bugreport ".\n (use-modules (srfi srfi-2)) (define (process-files-in-system-directory) -;;; (catch #t (lambda () + (catch #t (lambda () (let ((directory (opendir "/var/cron/tabs"))) (do ((file-name (readdir directory) (readdir directory))) ((eof-object? file-name) (closedir directory)) (and-let* ((user (valid-user file-name))) (set! configuration-user user) (read-vixie-file (string-append "/var/cron/tabs/" - file-name))))) -;;; ) -;;; (lambda (key . args) -;;; (display "You do not have permission to access the system crontabs.\n") -;;; (primitive-exit 4))) - ) + file-name)))))) + (lambda (key . args) + (display "You do not have permission to access the system crontabs.\n") + (primitive-exit 4)))) diff --git a/mcron.texinfo b/mcron.texinfo index 4ceb290..089e5fb 100644 --- a/mcron.texinfo +++ b/mcron.texinfo @@ -10,6 +10,12 @@ This file documents the @code{mcron} command for running jobs at scheduled times. +IMPORTANT NOTICE: +IT IS VERY LIKELY THAT THE CRON AND CRONTAB PROGRAMS DESCRIBED IN THIS +MANUAL HAVE NOT BEEN INSTALLED IN YOUR SYSTEM (THEY ARE CURRENTLY +BROKEN). THUS, ONLY THE MCRON PERSONALITY IS CURRENTLY AVAILABLE FOR +USE. + Copyright (C) 2003 Dale Mellor This is free software. See the source files for the terms of the copyright. diff --git a/vixie.scm b/vixie.scm index 2e7df93..5551518 100644 --- a/vixie.scm +++ b/vixie.scm @@ -416,11 +416,10 @@ ((eof-object? line)) ;; If the line ends with \, append the next line. - (do () - ((or (< (string-length line) 1) - (not (char=? (string-ref line - (- (string-length line) 1)) - #\\)))) + (while ((and (>= (string-length line) 1) + (char=? (string-ref line + (- (string-length line) 1)) + #\\))) (let ((next-line (read-line port))) (if (eof-object? next-line) (set! next-line "")) -- cgit v1.2.3