Bug 81332 - [crash] Sane doesn't work but crashes with canon scanner
[crash] Sane doesn't work but crashes with canon scanner
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: sane-backends (Show other bugs)
8.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-01-08 00:04 EST by Kai Engert (:kaie)
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-01-09 07:23:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Full stacktrace with local variables (3.84 KB, text/plain)
2003-01-08 23:57 EST, Kai Engert (:kaie)
no flags Details

  None (edit)
Description Kai Engert (:kaie) 2003-01-08 00:04:15 EST
Description of problem:
(First of all, I saw a missing link from /usr/lib/sane/libsane-canon.so.1.0.x to
/usr/lib/sane/libsane-canon.so.1 - I fixed that manually. This looks like a
forgotton link and was necessary to make scanimage see my scanner)

The real problem: Using the sane packages that come with RedHat 8.0, using
scanimage on the command line results in a crash. It's not necessary to give any
options. My device is a SCSI Canon CanoScan 300 scanner connected to a SYM53XX
controller. (Machine has been working stable since 2 years).

Up to december, I used RH 7.2, after I upgraded to 8.0, I can no longer scan. I
also tried the latested RawHide sane packages, this didn't improve the
situation, still crashes.

I found a workaround. I downgraded the sane-backends and the other sane packages
to those packages that come with RH 7.3.
RH 8 + sane packages from RH 7.3 works for me.


Version-Release number of selected component (if applicable):
- doesn't work: sane-backends-1.0.8-5.i386.rpm (8.0)
- doesn't work: sane-backends-1.0.9-1.i386.rpm (rawhide)
- works: sane-backends-1.0.7-6.i386.rpm (7.3)


How reproducible:
With a stock 8.0 install, enter scanimage on the command line.
It tries to scan and crashes immediately.


Steps to Reproduce:
1.enter scanimage, hit enter

    
Actual results:
Crash

Expected results:
Scanning works and a scan output file is created


Additional info:
Let me know if you want me to provide you stack traces etc.
Comment 1 Tim Waugh 2003-01-08 05:33:38 EST
Stack trace please.
Comment 2 Kai Engert (:kaie) 2003-01-08 17:00:08 EST
$ gdb scanimage
GNU gdb Red Hat Linux (5.2.1-4)
(gdb) r
Starting program: /usr/bin/scanimage

Program received signal SIGSEGV, Segmentation fault.
0x402b89d2 in sanei_scsi_req_enter2 () from /usr/lib/sane/libsane-canon.so.1
(gdb) bt
#0  0x402b89d2 in sanei_scsi_req_enter2 () from /usr/lib/sane/libsane-canon.so.1
#1  0x402b9630 in sanei_scsi_cmd2 () from /usr/lib/sane/libsane-canon.so.1
#2  0x402ada91 in get_scan_mode () from /usr/lib/sane/libsane-canon.so.1
#3  0x402b4edc in sane_canon_start () from /usr/lib/sane/libsane-canon.so.1
#4  0x40029c3f in sane_dll_start () from /usr/lib/libsane.so.1
#5  0x40029f4f in sane_start () from /usr/lib/libsane.so.1
#6  0x0804ae89 in scan_it ()
#7  0x0804c57d in main ()
#8  0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6


Is it easily possible to build a binary RPM from a source RPM where the
executables contain debug info?
Comment 3 Tim Waugh 2003-01-08 18:00:22 EST
Make a .rpmrc containing:

optflags: i386 -g

and a .rpmmacros containing:

%_topdir        %(mkdir -p /tmp/{BUILD,RPMS/i386,SOURCES,SRPMS,SPECS}; echo "/tmp")
%_srcrpmdir     /tmp/SRPMS

Then rpm -ivh the src.rpm and put this in the /tmp/SPECS/sane-backends.spec file:

%define __spec_install_post /bin/true || :

Then rpmbuild -bb /tmp/SPECS/sane-backends.spec.
Comment 4 Kai Engert (:kaie) 2003-01-08 23:57:11 EST
Created attachment 89228 [details]
Full stacktrace with local variables

Thanks for the explanation, I was able to build a debug RPM and I'm still able
to reproduce the bug. Attached is the output from "gdb - bt full". I tried
twice, both times it crashed with the same stack.
Comment 5 Tim Waugh 2003-01-09 05:47:37 EST
Can you set a breakpoint on sanei_scsi_open, called from sane_canon_start? 
That's where fd gets set, and it certainly shouldn't be -1.  On return from
sanei_scsi_open we hope that its return code was SANE_STATUS_GOOD and s->fd
isn't -1, and we should be back in sane_start (or sane_canon_start, I think the
function changed name.  BTW which version of sane-backends did you recompile?).

$ gdb scanimage
(gdb) b sane_scsi_open
(gdb) up
(if it's in sane_canon_start:)
(gdb) finish
(gdb) p status
(gdb) p s->fd

Comment 6 Kai Engert (:kaie) 2003-01-09 06:51:31 EST
Debugging was slightly more complicated, because of delayed shared module
loading and function pointers, and even after libs are loaded and having set a
breakpoint to sanei_scsi_open, it doesn't stop there. But I was able to do it
manually by running until sane_start and manual stepping.

On return from sanei_scsi_open, status is SANE_STATUS_GOOD.
s->fd is 5.

the call to do_focus(s) is what changes s->fd to -1

do_focus calls get_film_status, then sanei_scsi_cmd2 fails with return code 9
(IO_ERROR ?)
do_focus then calls sanei_scsi_close and sets s->fd = -1
Comment 7 Tim Waugh 2003-01-09 07:23:20 EST
Fixed package is sane-backends-1.0.9-2, which will shortly appear in rawhide. 
Thanks for helping out.
Comment 8 Kai Engert (:kaie) 2003-01-15 13:00:41 EST
Thanks for providing the new package, I finally tried it. While it no longer
crashes, I still have problems.

scanimage does not iniate a scan, but bails out with:
  scanimage: sane_start: Invalid argument

This is when not giving any parameters.
  scanimage --list-devices
does find my scanner.

Another thing that confuses me is that scanimage complains about command line
options that worked before, and that are even mentioned in its own help output.

For example, 
  scanimage --help
lists options --format, --verbose, --test, but when giving any of these options
on the command line, it complains with messages like:
  scanimage: unrecognized option `--verbose'

This newer version of sane seems to have more regressions when compared with the
version shipped with RH 7.3 - I'm going back to that version again.

Please let me know if I can be of further help.
Comment 9 Tim Waugh 2003-01-15 13:23:50 EST
One issue per bug report please.  Otherwise it can't be tracked.

Note You need to log in before you can comment on or make changes to this bug.