Re: Announcing bcron version 0.08
Gerrit Pape <[email protected]>
| Newsgroups | gmane.comp.sysutils.bgware |
|---|---|
| Message-ID | <20050421142344.22097.qmail@d30b6c8bbb2207.315fe32.mid.smarden.org> |
On Wed, Apr 20, 2005 at 12:24:08PM -0600, Bruce Guenter wrote: > On Sat, Apr 09, 2005 at 10:37:19AM +0000, Gerrit Pape wrote: > > There also already have been two feature requests ;-) > > see > > http://lists.debian.org/debian-devel/2005/04/threads.html#00280 > > What is being referred to by "fcron-like functionality", and when does > @reboot trigger? I think the following is meant, similar to what anacron provides: * entries based on elapsed system up time, * entries run periodically. It's documented in the fcrontab.5 man page http://fcron.free.fr/doc/fcrontab.5.html The default Debian cron package implements @reboot as a job to be done once when the system starts up, and only when the system starts up, not when the cron service restarts for example. > I don't think I very much like the idea of making cron > both a service manager and a scheduler. There are other ways of doing > that, and the modes of operation should be seperated. I completely agree with you, and don't think @reboot makes sense in a cron system, see also http://lists.debian.org/debian-devel/2005/04/msg00617.html > > We have a namespace restriction for files in /etc/cron.d/ in Debian, and > > bcron-update will be patched accordingly to ignore files with names not > > in this namespace. > > Is it simply a matter of ignoring dotfiles, or something more? It's more. Lots of Debian packages automatically put files into this directory, allowing the user to make local changes. On package upgrade the file shipped in the package may have changed while local changes should be preserved. The new file either is put there with a .dpkg-new extension, or overrides the locally changed one, saving a backup with the extension .dpkg-old; these files must not be processed. The defined Debian namespace is even smaller, it's just lower- and uppercase letters, digits, underscores, and hyphens. See below for the patch I made up. > > /var/spool/cron/ will be root:root and mode 0755, do you see any problem > > with this? > > Shouldn't be a problem. The tools only write files into crontabs and > tmp. I can drop the permissions restrictions on the /var/spool/cron/ > directory itself, as long as the other directories are restricted. > > On the list of things to do is to pre-parse crontabs into a "bcrontabs" > directory. There are no efficiency reasons for doing so, but it does > increase security (by taking the parsing out of the scheduler) and > reliability (by allowing for reporting of parsing errors early in the > process). Good idea. > > Debian adheres to the FHS as standard for placing files into the > > filesystem, and AIUI the FHS suggests /var/run/, see > > http://www.pathname.com/fhs/2.2/fhs-5.13.html > > Ah, and there it is: > Programs that maintain transient UNIX-domain sockets must place > them in this directory. > Of course, calling them transient is confusing to me -- the sockets are > permanent, as long as bcron-spool is running. This confuses me too, but I think they name it transient, because the socket only exists while a service is up, think of runlevels. I cannot find the word 'socket' (non-transient) anywhere else in the document. Regards, Gerrit. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
diff
(text/plain, 1.7 KB)
check Debian cron files namespace
Index: bcron-update.8
===================================================================
RCS file: /cvs/bcron/bcron-update.8,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bcron-update.8
--- bcron-update.8 1 Apr 2005 17:24:36 -0000 1.1.1.1
+++ bcron-update.8 10 Apr 2005 09:27:43 -0000
@@ -15,6 +15,14 @@
.B bcron-update
runs as root in order to be able to read system files that would
potentially be unreadable otherwise.
+.P
+On Debian, if
+.I path
+is a directory,
+.B bcron-spool
+skips files in this directory with names that do not solely consist of
+lower- and uppercase letters ('a'-'z', 'A'-'Z'), digits ('0'-'9'),
+underscores ('_'), and hyphens ('-').
.SH EXAMPLES
To mirror modern vixie-cron's behavior, use:
.EX
Index: bcron-update.c
===================================================================
RCS file: /cvs/bcron/bcron-update.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bcron-update.c
--- bcron-update.c 1 Apr 2005 17:24:36 -0000 1.1.1.1
+++ bcron-update.c 10 Apr 2005 09:27:44 -0000
@@ -136,8 +136,21 @@
while ((e = readdir(a->dir)) != 0) {
struct statcache_entry* se;
const char* name = e->d_name;
+ char *c;
if (name[0] == '.')
continue;
+ /* check Debian cron files namespace */
+ for (c = e->d_name; *c; ++c) {
+ if (*c == '-') continue;
+ if (*c < '0') break;
+ if (*c <= '9') continue;
+ if (*c < 'A') break;
+ if (*c <= 'Z') continue;
+ if (*c == '_') continue;
+ if (*c < 'a') break;
+ if (*c > 'z') break;
+ }
+ if (*c) continue;
if ((se = statcache_get(&a->entries, &name)) == 0) {
/* File is new. */
ministat2(a->path, name, st);