Date: Mon, 11 Mar 2002 14:20:01 -0800 (PST) From: "Matthew D. Fuller" <fullermd@over-yonder.net> To: freebsd-doc@freebsd.org Subject: Re: docs/31265: crontab(1) doesn't decribe format of allow and deny files. Message-ID: <200203112220.g2BMK1m20979@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR docs/31265; it has been noted by GNATS.
From: "Matthew D. Fuller" <fullermd@over-yonder.net>
To: "Gary W. Swearingen" <swear@blarg.net>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/31265: crontab(1) doesn't decribe format of allow and deny files.
Date: Mon, 11 Mar 2002 16:16:56 -0600
Just to keep it alive...
On Thu, Jan 03, 2002 at 03:40:03PM -0800 I heard the voice of
Gary W. Swearingen, and lo! it spake thus:
>
> I still think that user names must each start at the beginning of a line
> and must be followed immediately by a newline character -- all other
> lines are ignored. (They probably also must be in some user account
> config file(s) but that should go without saying.)
>
> As for the state of the PR, I'm still not aware of anything particularly
> wrong with the original patch and hope that committers will consider
> that patch. I'll consider modifying it in response to criticisms of it
> and suggestions for its improvement, of course.
Yeesh, you people always take the hard way ;p
The Right Solution (IMO, of course) is to fix cron to not make what is a
rather non-intuitive choice in parsing the files, then document the
now-simple one-username-per-line. Something like (untested):
Index: crontab/crontab.1
===================================================================
RCS file: /usr/cvs/src/usr.sbin/cron/crontab/crontab.1,v
retrieving revision 1.9
diff -u -r1.9 crontab.1
--- crontab.1 2000/11/20 20:09:43 1.9
+++ crontab.1 2002/03/11 22:12:53
@@ -58,7 +58,9 @@
file in order to use this command. If neither of these files exists, then
depending on site-dependent configuration parameters, only the super user
will be allowed to use this command, or all users will be able to use this
-command.
+command. The format of these files is one username per line, with no
+leading or trailing whitespace. Lines with other information on them
+will be ignored, and so can be used for comments.
.Pp
The first form of this command is used to install a new crontab from some
named file or standard input if the pseudo-filename ``-'' is given.
Index: lib/misc.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/cron/lib/misc.c,v
retrieving revision 1.9
diff -u -r1.9 misc.c
--- misc.c 2000/05/23 13:44:00 1.9
+++ misc.c 2002/03/11 22:08:14
@@ -392,7 +392,8 @@
rewind(file);
while (fgets(line, MAX_TEMPSTR, file)) {
if (line[0] != '\0')
- line[strlen(line)-1] = '\0';
+ if (line[strlen(line)-1] == '\n')
+ line[strlen(line)-1] = '\0';
if (0 == strcmp(line, string))
return TRUE;
}
> blank lines as being different. Your shell (and my pdksh) seem to
> ignore the empty line so it doesn't show as a blank line.
Well, it's not an empty line that would show as a blank line; that would
require TWO \n's. vis:
[16:09:51] mortis:~/tmp
(ttyp3):{931}% echo hi > out
[16:10:19] mortis:~/tmp
(ttyp3):{932}% echo -n hi > out2
[16:10:22] mortis:~/tmp
(ttyp3):{933}% cat out
hi
[16:10:23] mortis:~/tmp
(ttyp3):{934}% cat out2
hi[16:10:24] mortis:~/tmp
(ttyp3):{935}%
--
Matthew Fuller (MF4839) | fullermd@over-yonder.net
Unix Systems Administrator | fullermd@futuresouth.com
Specializing in FreeBSD | http://www.over-yonder.net/
"The only reason I'm burning my candle at both ends, is because I
haven't figured out how to light the middle yet"
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203112220.g2BMK1m20979>
