Re: batch -f command does not know working directory info at invocation time
Hi Austin, Austin Hook wrote on Mon, Oct 05, 2009 at 12:55:11PM -0700: [ citations reordered ] $ echo echo hello ee $ batch -f ee Cannot open input file: No such file or directory That looks like a bug to me. The function main() in at.c calls set_cron_cwd(), changing to /var/cron, before opening the job file. Unless i'm quite mistaken, batch(1), at(1) and atq(1) read nothing from stdin(4) except the commands to execute, so i see no point in first saving the input file name to a variable and deferring the call to freopen(3). Actually, the following patch saves one global and one local variable and simplifies the code, in addition to fixing your problem. According to the man pages for at (or batch): The working directory, the environment (except for the variables TERM, TERMCAP, DISPLAY, and _), and the umask are retained from the time of invocation. Right, but that applies to job execution time, not to command line parsing. Relative paths on the command line ought to be used before changing directory in any case. Any OKs to commit the following patch? Ingo Index: at.c === RCS file: /cvs/src/usr.bin/at/at.c,v retrieving revision 1.54 diff -u -p -r1.54 at.c --- at.c5 Sep 2007 08:02:21 - 1.54 +++ at.c5 Oct 2009 20:02:49 - @@ -55,7 +55,6 @@ char *no_export[] = int program = AT; /* default program mode */ char atfile[MAX_FNAME];/* path to the at spool file */ int fcreated; /* whether or not we created the file yet */ -char *atinput = NULL; /* where to get input from */ char atqueue = 0; /* which queue to examine for jobs (atq) */ char vflag = 0;/* show completed but unremoved jobs (atq) */ char force = 0;/* suppress errors (atrm) */ @@ -189,7 +188,7 @@ writefile(const char *cwd, time_t runtim struct passwd *pass_entry; struct tm runtime; int fdes, lockdes, fd2; - FILE *fp, *fpin; + FILE *fp; struct sigaction act; char **atenv; int ch; @@ -290,11 +289,6 @@ writefile(const char *cwd, time_t runtim shell = _PATH_BSHELL; } - if (atinput != NULL) { - fpin = freopen(atinput, r, stdin); - if (fpin == NULL) - perr(Cannot open input file); - } (void)fprintf(fp, #!/bin/sh\n# atrun uid=%lu gid=%lu\n# mail %*s %d\n, (unsigned long)real_uid, (unsigned long)real_gid, MAX_UNAME, mailname, send_mail); @@ -990,8 +984,8 @@ main(int argc, char **argv) if (program == ATRM) { force = 1; interactive = 0; - } else - atinput = optarg; + } else if (freopen(optarg, r, stdin) == NULL) + perr(Cannot open input file); break; case 'q': /* specify queue */
Re: batch -f command does not know working directory info at invocation time
On Mon, Oct 05, 2009 at 12:55 -0700, Austin Hook wrote: According to the man pages for at (or batch): The working directory, the environment (except for the variables TERM, TERMCAP, DISPLAY, and _), and the umask are retained from the time of invocation. But, oddly enough, at the time of actual invocation it seems not to know this information: Script started on Mon Oct 5 12:09:21 2009 $ echo echo hello ee $ batch -f ee Cannot open input file: No such file or directory $ batch -f ~/ee commands will be executed using /bin/ksh job 1254766194.E at Mon Oct 5 12:09:54 2009 $ exit Script done on Mon Oct 5 12:10:00 2009 If the -f option requires a non-relative path spec. for the file, the manual does not say so, as far as I can see. Tested on 4.5 and 4.6. AFAICT from at(1), the code is still mostly T-Rex's implementation. You may want to have a look at https://launchpad.net/~at-ng for a reimplementation from scratch, The client side is mostly done (still using directories and signals for communication with atd) It doesn't build on openBSD though for reasons that will go away when switching to a C/S approach RSN. The server (atd) side will be working soon with communications using Unix domain sockets. Thanks for listening Siggy -- O ascii ribbon campaign - stop html mail - www.asciiribbon.org+ |11 days until|bsb-at-psycho-dot-informationsanarchistik-dot-de| |www.Ubucon.de|or:bsb-at-psycho-dot-i21k-dot-de| +--- ceterum censeo javascriptum esse restrictam + [demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]
Re: batch -f command does not know working directory info at invocation time
On Mon, Oct 5, 2009 at 4:00 PM, Bernd Siggy Brentrup b...@free-it.org wrote: AFAICT from at(1), the code is still mostly T-Rex's implementation. You may want to have a look at https://launchpad.net/~at-ng for a reimplementation from scratch, The client side is mostly done I don't think one small bug is sufficient reason to replace a generally working BSD licensed program with a GPL one.
Re: batch -f command does not know working directory info at invocation time
Hi Ted, better not wake up sleeping dogs :) On Mon, Oct 05, 2009 at 17:14 -0400, you wrote: On Mon, Oct 5, 2009 at 4:00 PM, Bernd Siggy Brentrup b...@free-it.org wrote: AFAICT from at(1), the code is still mostly T-Rex's implementation. You may want to have a look at https://launchpad.net/~at-ng for a reimplementation from scratch, The client side is mostly done I don't think one small bug is sufficient reason to replace a generally working BSD licensed program with a GPL one. The oldest sources by Thomas Koenig (aka T-Rex) I have at hand (3.1.8 iirc) definitely carry a GPL license statement. I'm curious in how far openBSD's source code for at differs to warrant a different license if at all possible. Up to now I only checked the manpage. btw, Debian's at package has collected ~60 open bug reports over the years, dunno if they apply to openBSD's at too. Regards Siggy -- O ascii ribbon campaign - stop html mail - www.asciiribbon.org+ |10 days until|bsb-at-psycho-dot-informationsanarchistik-dot-de| |www.Ubucon.de|or:bsb-at-psycho-dot-i21k-dot-de| +--- ceterum censeo javascriptum esse restrictam + [demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]
Re: batch -f command does not know working directory info at invocation time
On Tue, Oct 06, 2009 at 02:48:59AM +0200, Bernd Siggy Brentrup wrote: Hi Ted, better not wake up sleeping dogs :) On Mon, Oct 05, 2009 at 17:14 -0400, you wrote: On Mon, Oct 5, 2009 at 4:00 PM, Bernd Siggy Brentrup b...@free-it.org wrote: AFAICT from at(1), the code is still mostly T-Rex's implementation. You may want to have a look at https://launchpad.net/~at-ng for a reimplementation from scratch, The client side is mostly done I don't think one small bug is sufficient reason to replace a generally working BSD licensed program with a GPL one. The oldest sources by Thomas Koenig (aka T-Rex) I have at hand (3.1.8 iirc) definitely carry a GPL license statement. I'm curious in how far openBSD's source code for at differs to warrant a different license if at all possible. Up to now I only checked the manpage. http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/at/LEGAL?rev=1.1 btw, Debian's at package has collected ~60 open bug reports over the years, dunno if they apply to openBSD's at too. Regards Siggy -- O ascii ribbon campaign - stop html mail - www.asciiribbon.org+ |10 days until|bsb-at-psycho-dot-informationsanarchistik-dot-de| |www.Ubucon.de|or:bsb-at-psycho-dot-i21k-dot-de| +--- ceterum censeo javascriptum esse restrictam + [demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc] -- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org
Re: batch -f command does not know working directory info at invocation time
On Mon, Oct 05, 2009 at 17:14 -0400, you wrote: On Mon, Oct 5, 2009 at 4:00 PM, Bernd Siggy Brentrup b...@free-it.org wrote: AFAICT from at(1), the code is still mostly T-Rex's implementation. You may want to have a look at https://launchpad.net/~at-ng for a reimplementation from scratch, The client side is mostly done I don't think one small bug is sufficient reason to replace a generally working BSD licensed program with a GPL one. The oldest sources by Thomas Koenig (aka T-Rex) I have at hand (3.1.8 iirc) definitely carry a GPL license statement. I'm curious in how far openBSD's source code for at differs to warrant a different license if at all possible. Up to now I only checked the manpage. btw, Debian's at package has collected ~60 open bug reports over the years, dunno if they apply to openBSD's at too. Really. How interesting. The word on the street is that your stuff is the biggest pile of shit. 400 bug reports, I hear. Or, wait, did you want to start a constructive discussion? It sure doesn't look like it. Let's keep it simple. Why don't you just go away, and stop acting the fool?
Re: batch -f command does not know working directory info at invocation time
Bernd Siggy Brentrup wrote: The oldest sources by Thomas Koenig (aka T-Rex) I have at hand (3.1.8 iirc) definitely carry a GPL license statement. I'm curious in how far openBSD's source code for at differs to warrant a different license if at all possible. Up to now I only checked the manpage. btw, Debian's at package has collected ~60 open bug reports over the years, dunno if they apply to openBSD's at too. Regards Siggy Hello, The full history of the implementation of at available in OpenBSD is online, it has had the same 2-clause BSD license since it was imported from NetBSD 13 years ago, it mentions Thomas Koenig as a copyright holder.. so perhaps he contributed it to the BSD projects prior to joining the Linux conspiracy.. err, community. http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/at/ http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/at/ Importing recent GPL contributions is not likely to happen, presumably a lot has changed over the years.. on OpenBSD for instance.. there is no at daemon, cron(8) is used for this instead. Ironically I did find a Usenet post from 1993 fixing what appears to be this same 'f argument' bug, so who knows? http://groups.google.ca/group/comp.os.linux.misc/browse_thread/thread/ba4e6994b4d52d40/7f3c4b699e385f92 Have fun reading some history. -Brynet.
Re: batch -f command does not know working directory info at invocation time
On Mon, Oct 05, 2009 at 19:35 -0600, Theo de Raadt wrote: On Mon, Oct 05, 2009 at 17:14 -0400, you wrote: On Mon, Oct 5, 2009 at 4:00 PM, Bernd Siggy Brentrup b...@free-it.org wrote: AFAICT from at(1), the code is still mostly T-Rex's implementation. You may want to have a look at https://launchpad.net/~at-ng for a reimplementation from scratch, The client side is mostly done I don't think one small bug is sufficient reason to replace a generally working BSD licensed program with a GPL one. The oldest sources by Thomas Koenig (aka T-Rex) I have at hand (3.1.8 iirc) definitely carry a GPL license statement. I'm curious in how far openBSD's source code for at differs to warrant a different license if at all possible. Up to now I only checked the manpage. btw, Debian's at package has collected ~60 open bug reports over the years, dunno if they apply to openBSD's at too. Really. How interesting. The word on the street is that your stuff is the biggest pile of shit. 400 bug reports, I hear. Or, wait, did you want to start a constructive discussion? It sure doesn't look like it. Let's keep it simple. Why don't you just go away, and stop acting the fool? If you answer your own questions, who is acting like an idiot then? The word goes Theo de Raadt himself is driving away ppl from using openBSD by pissing them of publicly. Bye Siggy -- O ascii ribbon campaign - stop html mail - www.asciiribbon.org+ |10 days until|bsb-at-psycho-dot-informationsanarchistik-dot-de| |www.Ubucon.de|or:bsb-at-psycho-dot-i21k-dot-de| +--- ceterum censeo javascriptum esse restrictam +
Re: batch -f command does not know working directory info at invocation time
The word goes Theo de Raadt himself is driving away ppl from using openBSD by pissing them of publicly. I am more than happy to drive away people who come to our mailing list trying to sell their wares.
Re: batch -f command does not know working directory info at invocation time
On Mon, Oct 05, 2009 at 20:47 -0600, Theo de Raadt wrote: The word goes Theo de Raadt himself is driving away ppl from using openBSD by pissing them of publicly. I am more than happy to drive away people who come to our mailing list trying to sell their wares. What exactly makes you think I'm trying to sell at-ng? Just to save you the hassle of looking it up yourself here's the text from the page I pointed at: | at-ng developers | | This team is about replacing the traditional *nix command suite at, | atq, atrm and batch with revamped versions. It starts from an old | unfinished rewrite from scratch of mine from 2001, for details see | the project page below. | | I'm open to any suggestions, help you may offer, translations c. | Provided you want to participate, join the team; if you only have | features you'd like to see incorporated, feel free to file a | wishlist bug against the project. In my understanding this is a request for input, modulo some hidden meaning I as a non-native english speaker may be missing. If this isn't acceptable on misc, I apologize. Regards Siggy -- O ascii ribbon campaign - stop html mail - www.asciiribbon.org+ |10 days until|bsb-at-psycho-dot-informationsanarchistik-dot-de| |www.Ubucon.de|or:bsb-at-psycho-dot-i21k-dot-de| +--- ceterum censeo javascriptum esse restrictam +