Opened 14 years ago
Last modified 8 years ago
#26194 assigned defect
Segmentation violation in scanimage
Reported by: | hanche | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.9.1 |
Keywords: | Cc: | ||
Port: | sane-backends |
Description
The command output speaks for itself:
; scanimage -L device `genesys:libusb:038:003' is a Pentax DSmobile 600 flatbed scanner ; scanimage -d genesys:libusb:038:003 --mode Lineart -x 57 -y 100 > foo segmentation violation
Again, under the debugger:
; gdb scanimage (gdb) run -d genesys:libusb:038:003 --mode Lineart -x 57 -y 100 Starting program: /opt/local/bin/scanimage -d genesys:libusb:038:003 --mode Lineart -x 57 -y 100 Reading symbols for shared libraries .+++++++++...... done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x000000000025d274 0x000000010014438f in sane_genesys_open () (gdb) back #0 0x000000010014438f in sane_genesys_open () #1 0x0000000100018491 in sane_dll_open () #2 0x00000001000043c6 in main () (gdb)
So the problem appears to be in the genesys module.
FWIW, I am on 10.6.4 (MacBook Pro 13 inch). I installed macports, ran port selfupdate and built all my ports from the bottom within the past week.
Attachments (3)
Change History (15)
comment:1 Changed 14 years ago by jmroot (Joshua Root)
Owner: | changed from macports-tickets@… to aguynamedryan+sane@… |
---|
comment:2 follow-up: 3 Changed 14 years ago by aguynamedryan+macports@…
First off, thanks for the great problem description. Lots of good detail in there. Unfortunately I don't have access to your particular scanner so I'm going to have to ask you to run a few commands for me.
We'll start with the most basic. Just to make certain that we're both looking at the same version of SANE, will you please tell me the output of:
scanimage -V
Also, please run the following command and attach the resulting debug.log file to this ticket:
export SANE_DEBUG_DLL=127 Thanks! export SANE_DEBUG_GENESYS=127 scanimage -d genesys:libusb:038:003 --mode Lineart -x 57 -y 100 2> debug.log
This might help me figure out how far sane_genesys_open
gets before the problem occurs.
As a final shot in the dark, assuming you have only the one scanner attached to your computer, will you please tell me what happens when you run:
scanimage --mode Lineart -x 57 -y 100
comment:3 Changed 14 years ago by aguynamedryan+macports@…
Replying to aguynamedryan+macports@…:
My history embarrassing formatting issues continues. That second command should be:
export SANE_DEBUG_DLL=127 export SANE_DEBUG_GENESYS=127 scanimage -d genesys:libusb:038:003 --mode Lineart -x 57 -y 100 2> debug.log
And the thanks should be at the bottom, like so:
Thanks!
Changed 14 years ago by hanche
comment:4 Changed 14 years ago by hanche
; scanimage -V scanimage (sane-backends) 1.0.21; backend version 1.0.21
I ran scanimage the way you requested and attached debug.log. Running scanimage without specifying the device leads to a segmentation violation as well. I will attach the resulting log as debug2.log.
Changed 14 years ago by hanche
Attachment: | debug2.log added |
---|
comment:5 follow-up: 6 Changed 14 years ago by hanche
I just realized that one more bit of information may be relevant. In debug.log, it appears that genesys tries attaching the device twice, succeeding the first time and then failing the second time. I have noticed something odd: I run Hardware Growler, and it notifies me that the built-in card reader is detached, then reattached whenever I try scanimage. I can see this in kernel.log as well:
Aug 24 01:13:06 mach kernel[0]: com_apple_driver_AppleUSBCardReaderUMC:: Stop::Controller Reset Aug 24 01:13:06 mach kernel[0]: USBMSC Identifier (non-unique): 000000009833 0x5ac 0x8403 0x9833
This may be totally beside the point, but I thought it odd enough it might bear mentioning.
comment:6 follow-up: 7 Changed 14 years ago by aguynamedryan+macports@…
Replying to hanche@…:
When I run scanimage -L
on my Mac I get a similar message regarding AppleUSBCardReaderUMC. I am pretty sure this is not our culprit. I'll do more thorough investigation about this tomorrow just to be sure.
Based on the output in debug2.log, it looks like the genesys' init_options function is where the segmentation violation occurs. I've poked around in the code and init_options has undergone a fair bit of change over the last few years. There also seems to be very little overall discussion of using Pentax DSMobile 600 scanners with SANE. I'm wondering if there was a bug introduced recently and no one has run into it until now since so few appear to use the DSMobile.
Is this the first time you've used the DSMobile with SANE? If you have used the scanner with SANE before, what was the last working version you used with this scanner? Knowing the version number will help me narrow down which changes might be causing the problem.
comment:7 follow-up: 8 Changed 14 years ago by hanche
Replying to aguynamedryan+macports@…:
Is this the first time you've used the DSMobile with SANE?
Yes, it is.
comment:8 follow-up: 9 Changed 14 years ago by aguynamedryan+macports@…
Replying to hanche@…:
I double-checked and the AppleUSBCardReaderUMC message appears even if the scanner successfully scanned in some images.
Bottom line is I can't debug this issue because I don't have the right scanner.
From what I'm seeing my gut tells me that this is an upstream problem. Here is how I would go about tracking down the cause of this problem:
- Hit the SANE mailing lists and forums and see if anyone else has a DSMobile
- If they do, see if they are having the same issue
- If you have access to a Linux box, throw SANE on it and try your scanner there
- If it works then we'll have to figure out what causes the failure on Mac and not Linux
- If it doesn't work, it might be easier to try patching/recompiling the source under Linux
- As I mentioned above, the init_options function in genesys.c is where the problem occurs. Start your debugging journey in that function.
If you'd like you're welcome to email me for some offline guidance on debugging SANE. I've done a bit of contribution to SANE before so I know a bit about how it works. That said, I'm not nearly the expert some of the upstream developers are.
If/when you do have a patch, send it my way and I'll throw it into the port ASAP so you don't have to wait for the next release from the SANE developers.
I'll also keep my eye out and release an update to the port as soon as sane-backends 1.0.22 is out in the hopes that there's a fix in there somewhere.
comment:9 Changed 14 years ago by hanche
Replying to aguynamedryan+macports@…:
- If you have access to a Linux box, throw SANE on it and try your scanner there
scanimage -L doesn't even see the scanner on Linux. I'll try your other suggestions.
Changed 11 years ago by WolfgangFahl (Wolfgang Fahl)
Attachment: | result.txt added |
---|
debug output 2014-03-29
comment:11 Changed 11 years ago by WolfgangFahl (Wolfgang Fahl)
with the latest MacPorts
scanimage (sane-backends) 1.0.22; backend version 1.0.22
there is still a segmentation fault
export SANE_DEBUG_DLL=127 /opt/local/bin/scanimage --help -d epson2:net:2.0.0.72 > /tmp/result.txt 2>&1 Segmentation fault: 11
result.txt is attached above
the workaround is to comment out all unnecessary drivers in etc/sane.d/dll.conf. A fix for this port might be to simply comment out pixma by default.
comment:12 Changed 8 years ago by mf2k (Frank Schima)
Owner: | changed from aguynamedryan+sane@… to macports-tickets@… |
---|---|
Status: | new → assigned |
See #52241.
Please remember to cc the maintainer.