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.<br><br>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.<br>
<br>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.<br>
<br>Chris<br><br><div class="gmail_quote">On Sun, Jan 3, 2010 at 5:06 PM, m. allan noah <span dir="ltr"><<a href="mailto:kitno455@gmail.com">kitno455@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
good call chris- you want to submit a fix?<br>
<br>
allan<br>
<div class="im"><br>
On Sun, Jan 3, 2010 at 4:14 PM, Rainer Dorsch <<a href="mailto:rdorsch@web.de">rdorsch@web.de</a>> wrote:<br>
> Hi Chris,<br>
><br>
> Am Sonntag, 3. Januar 2010 schrieb Chris Bagwell:<br>
>> On Sun, Jan 3, 2010 at 7:01 AM, Rainer Dorsch <<a href="mailto:rdorsch@web.de">rdorsch@web.de</a>> wrote:<br>
>> > For the long options issue:<br>
>> > I rebuild git sane on another machine (also Debian stable aka Debian 5.0)<br>
>> > and<br>
>> > the long options error is still there. Even --help has problems. Which<br>
>> > library is sane using to process the command line options? Does Debian<br>
>> > stable<br>
>> > maybe ship with a different version than your system?<br>
>><br>
>> After running configure, can you look at the file include/sane/config.h?<br>
>> Check if HAVE_GETOPT_H and HAVE_GETOPT_LONG are defined. On debian, I<br>
>> would expect them to be defined. In that case, it uses standard libc<br>
>> version of getopt.<br>
><br>
> As you expected, it is there:<br>
><br>
> rd@blackbox:~/SW.nobackup/sane-backends$ grep HAVE_GETOPT<br>
> include/sane/config.h<br>
> #define HAVE_GETOPT_H 1<br>
> #define HAVE_GETOPT_LONG 1<br>
</div><div class="im">> rd@blackbox:~/SW.nobackup/sane-backends$<br>
><br>
</div><div class="im">>> I do see one suspicious line in lib/getopt.c and lib/getopt1.c. They do a<br>
>> #include <config.h> instead of #include "../include/sane/config.h" and so<br>
>> in certain cases it may be including the wrong config.h file. In that<br>
>> case, it would mistakenly compile a conflicting version of getopt_long()<br>
>> (which can explain the problem your seeing).<br>
><br>
> Hmm...that does solve the problem:<br>
><br>
> I did this modification<br>
><br>
</div>> rd@blackbox:~/SW.nobackup/sane-backends$ git diff<br>
> diff --git a/lib/getopt.c b/lib/getopt.c<br>
> index 9dabb82..b8715e3 100644<br>
> --- a/lib/getopt.c<br>
> +++ b/lib/getopt.c<br>
> @@ -20,7 +20,7 @@<br>
> License along with the GNU C Library; if not, write to the Free<br>
> Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA<br>
> 02111-1307 USA. */<br>
<div class="im">> -# include <config.h><br>
> +# include "../include/sane/config.h"<br>
</div>> #if !defined(HAVE_GETOPT_H) || !defined(HAVE_GETOPT_LONG)<br>
> ^L<br>
> /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.<br>
> diff --git a/lib/getopt1.c b/lib/getopt1.c<br>
> index 5ace00a..082998c 100644<br>
> --- a/lib/getopt1.c<br>
> +++ b/lib/getopt1.c<br>
> @@ -17,7 +17,7 @@<br>
> License along with the GNU C Library; if not, write to the Free<br>
> Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA<br>
> 02111-1307 USA. */<br>
> -#include <config.h><br>
<div class="im">> +#include "../include/sane/config.h"<br>
</div>> #if !defined(HAVE_GETOPT_H) || !defined(HAVE_GETOPT_LONG)<br>
> ^L<br>
> #ifdef HAVE_CONFIG_H<br>
<div class="im">> rd@blackbox:~/SW.nobackup/sane-backends$<br>
><br>
</div><div class="im">> recompiled, set the paths again<br>
><br>
> rd@blackbox:~/SW.nobackup/sane-backends$ export |grep PATH<br>
> declare -x LD_LIBRARY_PATH="/opt/sane-backends-091230/lib"<br>
> declare -x<br>
> PATH="/opt/sane-backends-091230/bin:/usr/local/bin:/usr/bin:/bin:/usr/games"<br>
</div><div class="im">> rd@blackbox:~/SW.nobackup/sane-backends$<br>
><br>
</div><div class="im">> and --help is still not recognized<br>
><br>
</div>> rd@blackbox:~/SW.nobackup/sane-backends$ which scanimage<br>
> /opt/sane-backends-091230/bin/scanimage<br>
<div class="im">> rd@blackbox:~/SW.nobackup/sane-backends$<br>
><br>
</div>> and --help is still not recogniced<br>
><br>
> rd@blackbox:~/SW.nobackup/sane-backends$ scanimage --help<br>
> Usage: scanimage [OPTION]...<br>
<div><div></div><div class="h5">><br>
> Start image acquisition on a scanner device and write image data to<br>
> standard output.<br>
><br>
> Parameters are separated by a blank from single-character options (e.g.<br>
> -d epson) and by a "=" from multi-character options<br>
> (e.g. --device-name=epson).<br>
> -d, --device-name=DEVICE use a given scanner device (e.g. hp:/dev/scanner)<br>
> --format=pnm|tiff file format of output file<br>
> -i, --icc-profile=PROFILE include this ICC profile into TIFF file<br>
> -L, --list-devices show available scanner devices<br>
> -f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output<br>
> can be specified: %d (device name), %v (vendor),<br>
> %m (model), %t (type), %i (index number), and<br>
> %n (newline)<br>
> -b, --batch[=FORMAT] working in batch mode, FORMAT is `out%d.pnm' or<br>
> `out%d.tif' by default depending on --format<br>
> --batch-start=# page number to start naming files with<br>
> --batch-count=# how many pages to scan in batch mode<br>
> --batch-increment=# increase page number in filename by #<br>
> --batch-double increment page number by two, same as<br>
> --batch-increment=2<br>
> --batch-prompt ask for pressing a key before scanning a page<br>
> --accept-md5-only only accept authorization requests using md5<br>
> -p, --progress print progress messages<br>
> -n, --dont-scan only set options, don't actually scan<br>
> -T, --test test backend thoroughly<br>
> -h, --help display this help message and exit<br>
> -v, --verbose give even more status messages<br>
> -B, --buffer-size=# change input buffer size (in kB, default 32)<br>
> -V, --version print version information<br>
</div></div><div class="im">> scanimage: unrecognized option `--help'<br>
> rd@blackbox:~/SW.nobackup/sane-backends$<br>
><br>
</div><div class="im">> Thanks,<br>
> Rainer<br>
><br>
><br>
> --<br>
> Rainer Dorsch<br>
> Lärchenstr. 6<br>
> D-72135 Dettenhausen<br>
> 07157-734133<br>
> email: <a href="mailto:rdorsch@web.de">rdorsch@web.de</a><br>
> jabber: <a href="mailto:rdorsch@jabber.org">rdorsch@jabber.org</a><br>
> GPG Fingerprint: 5966 C54C 2B3C 42CC 1F4F 8F59 E3A8 C538 7519 141E<br>
> Full GPG key: <a href="http://pgp.mit.edu/" target="_blank">http://pgp.mit.edu/</a><br>
><br>
</div>> --<br>
> sane-devel mailing list: <a href="mailto:sane-devel@lists.alioth.debian.org">sane-devel@lists.alioth.debian.org</a><br>
> <a href="http://lists.alioth.debian.org/mailman/listinfo/sane-devel" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/sane-devel</a><br>
> Unsubscribe: Send mail with subject "unsubscribe your_password"<br>
> to <a href="mailto:sane-devel-request@lists.alioth.debian.org">sane-devel-request@lists.alioth.debian.org</a><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
"The truth is an offense, but not a sin"<br>
</font></blockquote></div><br>