sow@uunet.uu.net (Sven-Ove Westberg) (12/20/88)
> I have a problem running at and atrun on our sun3 under Sun UNIX 4.2 > Release 3.5 > the script is never executed, and when I run atrun by hand, I get an error: > like this one: > 88.334.0000.09: bad spool header > 88.335.1105.48: bad spool header It is a bug in the c-compiler, c-library or atrun. The problem is that Suns scanf requires thet it is atleast one character left to this expession '%*[^\n]'. I include a diff from bsd4.3 atrun to fix this problem. ------- atrun.c ------- *** /tmp/da8191 Tue Dec 13 09:02:45 1988 --- atrun.c Sun Oct 16 00:27:10 1988 *************** *** 177,186 **** * Grab the 4-line header out of the spoolfile. */ if ( ! (fscanf(infile,"# owner: %127s%*[^\n]\n",owner) != 1) || ! (fscanf(infile,"# jobname: %127s%*[^\n]\n",jobname) != 1) || ! (fscanf(infile,"# shell: %3s%*[^\n]\n",shell) != 1) || ! (fscanf(infile,"# notify by mail: %3s%*[^\n]\n",mailvar) != 1) ) { fprintf(stderr, "%s: bad spool header\n", spoolfile); exit(1); --- 177,186 ---- * Grab the 4-line header out of the spoolfile. */ if ( ! (fscanf(infile,"# owner: %127s\n",owner) != 1) || ! (fscanf(infile,"# jobname: %127s\n",jobname) != 1) || ! (fscanf(infile,"# shell: %3s\n",shell) != 1) || ! (fscanf(infile,"# notify by mail: %3s\n",mailvar) != 1) ) { fprintf(stderr, "%s: bad spool header\n", spoolfile); exit(1); Sven-Ove Westberg, CAD, University of Lulea, S-951 87 Lulea, Sweden. ARPA: sow%cad.luth.se@ucbvax.berkeley.edu (only dumb ARPA mailers)
dudek@uunet.uu.net (Glen Dudek) (12/23/88)
felix@ai.sri.com (Francois Felix INGRAND) writes: >I have a problem running at and atrun on our sun3 under Sun UNIX 4.2 >Release 3.5 >... I called Sun about this one, and they said: "use /usr/lib/atrun from the Sun OS 3.4 distribution." This does indeed fix the problem. Interestingly enough, I compiled the 4.3BSD atrun to try and fix this, and it died with exactly the same error. I fixed it by changing the scanf calls slightly to make the format less strict about string lengths. I suspect that Sun incorporated the 'at' distribution from 4.3BSD, but their scanf is slightly different. This indicates something about Sun QA, I'm afraid... Glen Dudek dudek@ksr.com
jim@alberta.uucp (Jim Easton) (12/30/88)
felix@ai.sri.com (Francois Felix INGRAND) writes: > I have a problem running at and atrun on our sun3 under Sun UNIX 4.2 > Release 3.5 > > the script is never executed, and when I run atrun by hand, I get an error: > like this one: > 88.334.0000.09: bad spool header > 88.335.1105.48: bad spool header We had the same problem with atrun. The cause of its not working is a bug in fscanf. There were 4 read statements in atrun as follows; /* * Grab the 4-line header out of the spoolfile. */ if ( (fscanf(infile,"# owner: %127s%*[^\n]\n",owner) != 1) || (fscanf(infile,"# jobname: %127s%*[^\n]\n",jobname) != 1) || (fscanf(infile,"# shell: %3s%*[^\n]\n",shell) != 1) || (fscanf(infile,"# notify by mail: %3s%*[^\n]\n",mailvar) != 1) ) { fprintf(stderr, "%s: bad spool header\n", spoolfile); exit(1); } The intent was to read a string from the line and then flush the line to the line feed however there was nothing to flush (ie. the next character was a <LF> and it did not flush it. The next read got the line feed instead of the next line as it was meant to and it declared an error. Since we don't have the source for fscanf our fix was to remove the flush - as follows; /* * Grab the 4-line header out of the spoolfile. */ if ( /* UofA001 */ (fscanf(infile,"# owner: %127s\n",owner) != 1) || (fscanf(infile,"# jobname: %127s\n",jobname) != 1) || (fscanf(infile,"# shell: %3s\n",shell) != 1) || (fscanf(infile,"# notify by mail: %3s\n",mailvar) != 1) ) { fprintf(stderr, "%s: bad spool header\n", spoolfile); exit(1); } Jim Easton (..!alberta!jim)