Already reported in: http://www.freebsd.org/cgi/query-pr.cgi?pr=amd64/93413 now I have traced down the problem: After first-time installation of spool directories, e.g. /var/spool/lpd/rattan , as seen in the Handbook, these directories are of course empty. Running first time printout is successful, lpd creates "lock" file in the spool directory, but it has following (strange) attributes: ---xrwS--T 1 root daemon 20 Feb 16 01:03 lock Unfortunately, running printout for the next time does not work - lpr queues the job and nothing happens ! It is due to a sw-bug in /usr/src/usr.sbin/lpr/lpd/printjob.c, in function void printjob(struct printer* pp); i.e. look at the following lines of code: [203] if (stat(pp->lock_file, &stb) == 0 && (stb.st_mode & LFM_PRINT_DIS)) exit(0); Seems OK, but if NO LOCK FILE EXIST, "stb" remains uninitialized ! Unfortunately, this sets "+x" attribute, which is defined elsewhere as #define LFM_PRINT_DIS (S_IXUSR) and it results in executing exit(0) in the line mentioned above, but only for the second time. Further in the code one can find fchmod(lfd,stb.st_mode), which uses uninitialised "stb". Fix: /usr/src/usr.sbin/lpr/lpd/printjob.c: function void printjob(struct printer* pp), line 203: replace those 2 lines mentioned above with: if (stat(pp->lock_file, &stb) == 0) { if (stb.st_mode & LFM_PRINT_DIS) { exit(0); /* printing disabled */ } } else { stb.st_mode = LOCK_FILE_MODE; } rebuild and install lpd. Works for me. Workaround: create lock files after creating spool directories: mkdir /var/spool/lpd/rattan touch /var/spool/lpd/rattan/lock and/or change attributes of lock file: chmod 664 /var/spool/lpd/rattan/lock How-To-Repeat: kill lpd. remove spool directories. recreate spool directories. run lpd. try to print twice (or more).
Responsible Changed From-To: freebsd-amd64->gad over to lpr maintainer
I have a slightly different fix for this, which I have been running with (here at RPI) for awhile now. I always wondered why no one else had noticed this problem. I guess it's just that when most people do notice it, they just fix the permissions without ever figuring out why the permissions were wrong to start with. Thanks for the report. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA
State Changed From-To: open->closed I have committed the change to lpd/printjob.c which should fix this problem. The change had been in 7.x-current for a week without any apparent problems.