[sane-devel] long option format not recognized (Was: Epson Perfection 610 Issue with 150 dpi scan)

Chris Bagwell chris at cnpbagwell.com
Mon Jan 4 00:39:49 UTC 2010


There was a typo in first part of Rainer's email.  Later on it shows its
still not working.... although its safe fix I should probably submit.

I've now been able to reproduce the issue with --help not working with the
epson2 backend. The problem occurs when we reach driver specific help and so
may be specific to epson2.  The all_options doesn't seem to contain the
--help option and probably anything from basic_options[] array.

Since basic_options[] (which includes --help) is copied to all_options[]
after filling in backend options, I suspect something returned by epson2
backend is causing a NULL to be placed in middle and causing getopt_long()
to stop processing early.  I couldn't find anything obvious like missing
options inits from browsing the code.  I guess it will need to be brute
forced debugged to find where the NULL is coming from.

Chris

On Sun, Jan 3, 2010 at 5:06 PM, m. allan noah <kitno455 at gmail.com> wrote:

> good call chris- you want to submit a fix?
>
> allan
>
> On Sun, Jan 3, 2010 at 4:14 PM, Rainer Dorsch <rdorsch at web.de> wrote:
> > Hi Chris,
> >
> > Am Sonntag, 3. Januar 2010 schrieb Chris Bagwell:
> >> On Sun, Jan 3, 2010 at 7:01 AM, Rainer Dorsch <rdorsch at web.de> wrote:
> >> > For the long options issue:
> >> > I rebuild git sane on another machine (also Debian stable aka Debian
> 5.0)
> >> > and
> >> > the long options error is still there. Even --help has problems. Which
> >> > library is sane using to process the command line options? Does Debian
> >> > stable
> >> > maybe ship with a different version than your system?
> >>
> >> After running configure, can you look at the file include/sane/config.h?
> >> Check if HAVE_GETOPT_H and HAVE_GETOPT_LONG are defined.   On debian, I
> >> would expect them to be defined.  In that case, it uses standard libc
> >> version of getopt.
> >
> > As you expected, it is there:
> >
> > rd at blackbox:~/SW.nobackup/sane-backends$ grep HAVE_GETOPT
> > include/sane/config.h
> > #define HAVE_GETOPT_H 1
> > #define HAVE_GETOPT_LONG 1
> > rd at blackbox:~/SW.nobackup/sane-backends$
> >
> >> I do see one suspicious line in lib/getopt.c and lib/getopt1.c.  They do
> a
> >> #include <config.h> instead of #include "../include/sane/config.h" and
> so
> >> in certain cases it may be including the wrong config.h file.  In that
> >> case, it would mistakenly compile a conflicting version of getopt_long()
> >> (which can explain the problem your seeing).
> >
> > Hmm...that does solve the problem:
> >
> > I did this modification
> >
> > rd at blackbox:~/SW.nobackup/sane-backends$ git diff
> > diff --git a/lib/getopt.c b/lib/getopt.c
> > index 9dabb82..b8715e3 100644
> > --- a/lib/getopt.c
> > +++ b/lib/getopt.c
> > @@ -20,7 +20,7 @@
> >    License along with the GNU C Library; if not, write to the Free
> >    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> >    02111-1307 USA.  */
> > -# include <config.h>
> > +# include "../include/sane/config.h"
> >  #if !defined(HAVE_GETOPT_H) || !defined(HAVE_GETOPT_LONG)
> >  ^L
> >  /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
> > diff --git a/lib/getopt1.c b/lib/getopt1.c
> > index 5ace00a..082998c 100644
> > --- a/lib/getopt1.c
> > +++ b/lib/getopt1.c
> > @@ -17,7 +17,7 @@
> >    License along with the GNU C Library; if not, write to the Free
> >    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> >    02111-1307 USA.  */
> > -#include <config.h>
> > +#include "../include/sane/config.h"
> >  #if !defined(HAVE_GETOPT_H) || !defined(HAVE_GETOPT_LONG)
> >  ^L
> >  #ifdef HAVE_CONFIG_H
> > rd at blackbox:~/SW.nobackup/sane-backends$
> >
> > recompiled, set the paths again
> >
> > rd at blackbox:~/SW.nobackup/sane-backends$ export |grep PATH
> > declare -x LD_LIBRARY_PATH="/opt/sane-backends-091230/lib"
> > declare -x
> >
> PATH="/opt/sane-backends-091230/bin:/usr/local/bin:/usr/bin:/bin:/usr/games"
> > rd at blackbox:~/SW.nobackup/sane-backends$
> >
> > and --help is still not recognized
> >
> > rd at blackbox:~/SW.nobackup/sane-backends$ which scanimage
> > /opt/sane-backends-091230/bin/scanimage
> > rd at blackbox:~/SW.nobackup/sane-backends$
> >
> > and --help is still not recogniced
> >
> > rd at blackbox:~/SW.nobackup/sane-backends$ scanimage --help
> > Usage: scanimage [OPTION]...
> >
> > Start image acquisition on a scanner device and write image data to
> > standard output.
> >
> > Parameters are separated by a blank from single-character options (e.g.
> > -d epson) and by a "=" from multi-character options
> > (e.g. --device-name=epson).
> > -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), %i (index number), and
> >                           %n (newline)
> > -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 page number in filename by #
> >    --batch-double         increment page number by two, same as
> >                           --batch-increment=2
> >    --batch-prompt         ask for pressing a key before scanning a page
> >    --accept-md5-only      only accept authorization requests using md5
> > -p, --progress             print progress messages
> > -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
> > -B, --buffer-size=#        change input buffer size (in kB, default 32)
> > -V, --version              print version information
> > scanimage: unrecognized option `--help'
> > rd at blackbox:~/SW.nobackup/sane-backends$
> >
> > Thanks,
> > Rainer
> >
> >
> > --
> > Rainer Dorsch
> > Lärchenstr. 6
> > D-72135 Dettenhausen
> > 07157-734133
> > email: rdorsch at web.de
> > jabber: rdorsch at jabber.org
> > GPG Fingerprint: 5966 C54C 2B3C 42CC 1F4F  8F59 E3A8 C538 7519 141E
> > Full GPG key: http://pgp.mit.edu/
> >
> > --
> > sane-devel mailing list: sane-devel at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> > Unsubscribe: Send mail with subject "unsubscribe your_password"
> >             to sane-devel-request at lists.alioth.debian.org
> >
>
>
>
> --
> "The truth is an offense, but not a sin"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20100103/a945d332/attachment.htm>


More information about the sane-devel mailing list