[sane-devel] saned problems with 1.0.10-pre3 (incl. segfault)

Lee Howard faxguy@howardsilvan.com
Mon, 27 Jan 2003 13:35:50 -0800


I just built and installed sane-backends-1.0.10-pre3 on a RedHat 7.1 
x86 system (took the 1.0.8 SRPM from the RedHat 8.0 distribution, 
replaced the tarball with 1.0.10-pre3 and rebuilt).  I'm using an Epson 
Perfection 1260 Photo USB scanner (plustek backend), so my 
understanding is that I must use 1.0.10 or manually update 1.0.9 with 
the newest plustek code.

SANE seems to be working fine.  At least, XSane works well both 
independently and from Gimp.  I haven't tried scanning transparencies 
yet, however.

So, next step was to get saned running so that the network workstations 
could use the scanner also.  That's when I ran into trouble.  Now, 
ultimately I'll be using saned from xinetd, but, for debugging purposes 
I am running saned from the command-prompt.  I'm not sure what 
"correct" debugging information should look like, but when I run saned 
from root, it *seems* to go fine.  The server says this:

[root@bilbo saned]# /usr/sbin/saned -d128
[saned] main: starting debug mode (level 128)
[saned] main: trying to get port for service `sane' (getservbyname)
[saned] main: port is 6566
[saned] main: socket ()
[saned] main: setsockopt ()
[saned] main: bind ()
[saned] main: listen ()
[saned] main: waiting for control connection
[saned] saned from sane-backends 1.0.10-pre3 ready
[saned] check_host: access by remote host: 127.0.0.1
[saned] check_host: remote host is IN_LOOPBACK: access accepted
[saned] init: access by lee@127.0.0.1 accepted
[saned] process_request: waiting for request
[saned] process_request: got request 1
[saned] process_request: waiting for request
[saned] process_request: got request 10
[saned] quit: exiting
[root@bilbo saned]#

The client says this:

[lee@bilbo lee]$ scanimage -L
device `plustek:/dev/usb/scanner0' is a Epson Perfection 1260/Photo USB 
flatbed scanner
device `net:localhost:plustek:/dev/usb/scanner0' is a Epson Perfection 
1260/Photo USB flatbed scanner
[lee@bilbo lee]$

When I run saned from user "saned", this is what I see instead.  The 
server says:

bash-2.04$ /usr/sbin/saned -d128
[saned] main: starting debug mode (level 128)
[saned] main: trying to get port for service `sane' (getservbyname)
[saned] main: port is 6566
[saned] main: socket ()
[saned] main: setsockopt ()
[saned] main: bind ()
[saned] main: listen ()
[saned] main: waiting for control connection
[saned] saned from sane-backends 1.0.10-pre3 ready
[saned] check_host: access by remote host: 127.0.0.1
[saned] check_host: remote host is IN_LOOPBACK: access accepted
[saned] init: access by lee@127.0.0.1 accepted
[saned] process_request: waiting for request
[saned] process_request: got request 1
[saned] process_request: waiting for request
[saned] process_request: got request 10
[saned] quit: exiting
bash-2.04$ 
The client says this:

[lee@bilbo lee]$ scanimage -L
device `plustek:/dev/usb/scanner0' is a Epson Perfection 1260/Photo USB 
flatbed scanner
[lee@bilbo lee]

So it appears that saned is not working the same when running as the 
"saned" user.  Whatever the problem is, it can produce a segmentation 
fault as in this example (using a mis-constructed device name).  The 
server says:

bash-2.04$ /usr/sbin/saned -d128
[saned] main: starting debug mode (level 128)
[saned] main: trying to get port for service `sane' (getservbyname)
[saned] main: port is 6566
[saned] main: socket ()
[saned] main: setsockopt ()
[saned] main: bind ()
[saned] main: listen ()
[saned] main: waiting for control connection
[saned] saned from sane-backends 1.0.10-pre3 ready
[saned] check_host: access by remote host: 192.168.0.1
[saned] check_host: remote host is not IN_LOOPBACK
[saned] check_host: local hostname: bilbo.x101.com
[saned] check_host: local hostname (from DNS): bilbo.x101.com
[saned] check_host: local host address (from DNS): 192.168.0.1
[saned] check_host: remote host has same addr as local: access accepted
[saned] init: access by lee@192.168.0.1 accepted
[saned] process_request: waiting for request
[saned] process_request: got request 2
Segmentation fault (core dumped)
bash-2.04$

The client says:

[lee@bilbo lee]$ scanimage --help -d "net:192.168.0.1"
Usage: scanimage [OPTION]...

Start image acquisition on a scanner device and write PNM image data to
standard output.

-d, --device-name=DEVICE   use a given scanner device (e.g. 
hp:/dev/scanner)
     --format=pnm|tiff      file format of output file
-i, --icc-profile=PROFILE  include this ICC profile into TIFF file
-L, --list-devices         show available scanner devices
-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the 
output
                            can be specified: %d (device name), %v 
(vendor),
                            %m (model), %t (type), and %i (index number)
-b, --batch[=FORMAT]       working in batch mode, FORMAT is `out%d.pnm' 
or
                            `out%d.tif' by default depending on --format
     --batch-start=#        page number to start naming files with
     --batch-count=#        how many pages to scan in batch mode
     --batch-increment=#    increase number in filename by an amount of 
#
     --batch-double         increment page number by two for 2sided 
originals
                            being scanned in a single sided scanner
     --accept-md5-only      only accept authorization requests using md5
-n, --dont-scan            only set options, don't actually scan
-T, --test                 test backend thoroughly
-h, --help                 display this help message and exit
-v, --verbose              give even more status messages
-V, --version              print version information
scanimage: open of device net:192.168.0.1 failed: Invalid argument
Type ``scanimage --help -d DEVICE'' to get list of all options for 
DEVICE.

List of available devices:
     plustek:/dev/usb/scanner0
Broken pipe
[lee@bilbo lee]$

This is what happens if the device name is constructed properly.  The 
server says:

bash-2.04$ /usr/sbin/saned -d128
[saned] main: starting debug mode (level 128)
[saned] main: trying to get port for service `sane' (getservbyname)
[saned] main: port is 6566
[saned] main: socket ()
[saned] main: setsockopt ()
[saned] main: bind ()
[saned] main: listen ()
[saned] main: waiting for control connection
[saned] saned from sane-backends 1.0.10-pre3 ready
[saned] check_host: access by remote host: 192.168.0.1
[saned] check_host: remote host is not IN_LOOPBACK
[saned] check_host: local hostname: bilbo.x101.com
[saned] check_host: local hostname (from DNS): bilbo.x101.com
[saned] check_host: local host address (from DNS): 192.168.0.1
[saned] check_host: remote host has same addr as local: access accepted
[saned] init: access by lee@192.168.0.1 accepted
[saned] process_request: waiting for request
[saned] process_request: got request 2
[saned] process_request: access to resource `plustek' accepted
[saned] process_request: waiting for request
[saned] process_request: got request 1
[saned] process_request: waiting for request
[saned] process_request: got request 10
[saned] quit: exiting
bash-2.04$

The client says:

[lee@bilbo lee]$ scanimage --help -d 
"net:192.168.0.1:plustek:/dev/usb/scanner0"
Usage: scanimage [OPTION]...

Start image acquisition on a scanner device and write PNM image data to
standard output.

-d, --device-name=DEVICE   use a given scanner device (e.g. 
hp:/dev/scanner)
     --format=pnm|tiff      file format of output file
-i, --icc-profile=PROFILE  include this ICC profile into TIFF file
-L, --list-devices         show available scanner devices
-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the 
output
                            can be specified: %d (device name), %v 
(vendor),
                            %m (model), %t (type), and %i (index number)
-b, --batch[=FORMAT]       working in batch mode, FORMAT is `out%d.pnm' 
or
                            `out%d.tif' by default depending on --format
     --batch-start=#        page number to start naming files with
     --batch-count=#        how many pages to scan in batch mode
     --batch-increment=#    increase number in filename by an amount of 
#
     --batch-double         increment page number by two for 2sided 
originals
                            being scanned in a single sided scanner
     --accept-md5-only      only accept authorization requests using md5
-n, --dont-scan            only set options, don't actually scan
-T, --test                 test backend thoroughly
-h, --help                 display this help message and exit
-v, --verbose              give even more status messages
-V, --version              print version information
scanimage: open of device net:192.168.0.1:plustek:/dev/usb/scanner0 
failed: Error during device I/O
Type ``scanimage --help -d DEVICE'' to get list of all options for 
DEVICE.

List of available devices:
     plustek:/dev/usb/scanner0
[lee@bilbo lee]$

Here's the gdb output for that core I produced above (looks like a 
problem with strcpy()) :

[root@bilbo saned]# file core
core: ELF 32-bit LSB core file of 'saned' (signal 11), Intel 80386, 
version 1, from 'saned'
[root@bilbo saned]# gdb /usr/sbin/saned core
GNU gdb Red Hat Linux (5.2-2)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and 
you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for 
details.
This GDB was configured as "i386-redhat-linux"...(no debugging symbols 
found)...
Core was generated by `/usr/sbin/saned -d128'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libsane.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libsane.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /usr/lib/libjpeg.so.62...done.
Loaded symbols for /usr/lib/libjpeg.so.62
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /usr/lib/sane/libsane-plustek.so.1...done.
Loaded symbols for /usr/lib/sane/libsane-plustek.so.1
Reading symbols from /usr/lib/sane/libsane-net.so.1...done.
Loaded symbols for /usr/lib/sane/libsane-net.so.1
#0  0x0804ada3 in strcpy () at strcpy:-1
-1	strcpy: No such file or directory.
	in strcpy
(gdb) bt
#0  0x0804ada3 in strcpy () at strcpy:-1
#1  0x08050a80 in _IO_stdin_used ()
#2  0x0804b7d2 in strcpy () at strcpy:-1
#3  0x4009f657 in __libc_start_main (main=0x804b420 <strcpy+7224>, 
argc=2, ubp_av=0xbffff9c4,     init=0x80492e0 <_init>, fini=0x804e8f0 
<_fini>, rtld_fini=0x4000dcd4 <_dl_fini>,     stack_end=0xbffff9bc) at 
../sysdeps/generic/libc-start.c:129
(gdb) quit
[root@bilbo saned]# 
Thanks.

Lee.