Hello LPRng-ers,
I think I've found a bug in checkpc from lprng-3.7.3 (this didn't
exist in 3.6.12, which I was running previously). I'd bet this is also
the cause of the problem mentioned in a previous message "LPRng: lprng
3.7.3 rpm (checkpc) nad later lpd STARTALL problems", though I'm
making some assumptions about what the rpm itself is doing on install,
so don't hold me to it.
I'm running Slackware Linux 7.1 with gdbm-1.8.0 and the as-delievred
2.2.16 #97 kernel. LPRng was built with the following options:
./configure --prefix=/usr --sysconfdir=/etc --with-userid=daemon
--with-groupid=lp --with-initpath=no
First, the workaround:
Rebuilding with the same options plus "--disable-gdbm" appears to
fix the problem, so this seems to have something to do with file
locking and gdbm under Linux. The stack trace below also implies that
the problem is with related to gdbm.
Below are some notes about what I found while trying to figure this
out. I hope they're useful in tracking this down.
After setting up the tutorial printcap and lpd.perms files from
<http://www.lprng.org/tutorialconfig.htm>, checkpc -f -V hangs on
a flock() call.
The normal output looks like this:
# checkpc -f -V
LPRng-3.7.3, Copyright 1988-2000 Patrick Powell, <[EMAIL PROTECTED]>
Checking for configuration files '/etc/lpd.conf'
found '/etc/lpd.conf', mod 0100644
Checking for printcap files '/etc/printcap'
found '/etc/printcap', mod 0100644
Checking for lpd only printcap files '/etc/lpd_printcap'
DaemonUID 2, DaemonGID 7
Using Config file '/etc/lpd.conf'
LPD lockfile '/var/run/lpd.printer'
checking '/var/run/lpd.printer' file
.names
:lp=lp
:lp2=lp2
.all
:lp
:lp2
#Printcap Information
lp
:force_localhost
:lp=/tmp/lp
:sd=/var/spool/lpd/lp
lp2
:force_localhost
:lp=/tmp/lp2
:sd=/var/spool/lpd/lp2
Checking printcap info
Checking printer 'lp'
Checking directory: '/var/spool/lpd/lp'
directory '/var'
directory '/var/spool'
directory '/var/spool/lpd'
directory '/var/spool/lpd/lp'
checking 'control.lp' file
checking 'status.lp' file
checking 'status' file
checking 'log' file
checking 'acct' file
The strace output ends (or doesn't end, in this case) like so:
[ intro output deleted ]
write(2, " checking \'acct\' file\n", 23) = 23
open("acct", O_RDONLY|O_NOCTTY) = 5
fstat(5, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
stat("acct", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
close(5) = 0
unlink("lpq") = -1 ENOENT (No such file or
directory)
unlink("db.lp") = 0
open(".", O_RDONLY|O_NONBLOCK|0x10000) = 5
fstat(5, {st_mode=S_IFDIR|0700, st_size=1024, ...}) = 0
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
umask(0) = 077
open("db.lp", O_RDWR|O_APPEND|O_CREAT|O_NOCTTY, 0600) = 6
umask(077) = 0
fstat(6, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
flock(6, LOCK_EX) = 0
flock(6, LOCK_EX) = 0
flock(6, LOCK_EX) = 0
flock(6, LOCK_EX) = 0
[ and on forever ]
And gdb shows this from that point in the program:
checking 'log' file
checking 'acct' file
Program received signal SIGINT, Interrupt.
0x400c1ce1 in flock () from /lib/libc.so.6
(gdb) backtrace
#0 0x400c1ce1 in flock () from /lib/libc.so.6
#1 0x8050009 in Do_lock (fd=6, block=1) at ./common/lockfile.c:103
#2 0x805f8e3 in Open_gdbm (db_create=1) at ./common/getqueue.c:2452
#3 0x805a624 in Scan_queue (spool_control=0x8080a70, sort_order=0x8080554,
pprintable=0x0,
pheld=0x0, pmove=0x0, only_pr_and_move=0, create_db=1, write_db=0) at
./common/getqueue.c:98
#4 0x804b25f in Scan_printer () at ./common/checkpc.c:459
#5 0x804a9ff in main (argc=3, argv=0xbffff894, envp=0xbffff8a4) at
./common/checkpc.c:226
#6 0x40039aa7 in __libc_start_main () from /lib/libc.so.6
Best of luck in quashing this bug, and thanks for LPRng!
--
Doug Morris
System Administrator
Day Management AG
http://www.daynetwork.com/
-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body. For the impatient,
to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED]
with: | example:
subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED]
If you have major problems, send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------