Brad Sawatzky <[EMAIL PROTECTED]> wrote:

Hi,

> AFAICT, the fact that the Source menu for other backends work at all over
> the netowrk is simply due to good fortune.

It is indeed highly probable that the epson backend is a special case
that exposes the bug.

>> Per the SANE standard, the descriptors have to remain available at the
>> same location until the device is closed. If it wasn't the case, it'd
>> be a major pain for the frontends to keep track of the options. (it
>> could be done with more API calls, though, but that's added complexity
>> for no benefit)
>
> Then the net backend is breaking the SANE standard.  s->local_opt.desc[] is
> not a complete copy of the descriptors since memcpy merely duplicates the
> pointer to the .constraint union member, but not the underlying data
> (option (a) in the previous message).

No, it's not breaking the standard. I know it's subtle, but only the
descriptor itself has to be constant in memory. Anything (except the
option name) contained in the descriptor is volatile and can be
modified by the backend at will upon a SET_VALUE operation, with the
backend returning RELOAD_OPTIONS in the info output parameter when
that happens.

The net backend then spies on the info value and invalidates its
cached copy when RELOAD_OPTIONS is indicated. In turn, the frontend
will reload the options by calling sane_get_option_descriptor() for
each and every option descriptor it cares about. Upon the first call,
the net backend will be faced with its invalidated cache and reload
the options from the remote backend.

You have to realize that it's no different from how any other backend
works; other backends will immediately modify the descriptors in
memory in just the same way. The only difference is that the
descriptors and their content are statically allocated in the backends
(most of them anyway) and not in the net backend.

So in a local setup, any pointer contained in an option descriptor
remains valid even if the pointer in the option descriptor changed in
the meantime. In the net backend, it can just end up pointing at
whatever.

saned+net is a hell of a hack that is sometimes borderline wrt the
standard but it doesn't violate the standard :) I've fixed the net
backend, so now it will no longer reload the options behind the
frontend's back as it used to (be able to) do on a GET/SET_VALUE
operation.


I'd like to know if you can reproduce the problem with another
frontend, like quiteinsane. XSane is derived from xscanimage so
chances are this bug (assuming it's in the frontend) also exists in
xscanimage.

> PS: I worry I'm spamming bugs.debian.org with these details.  If I should
>     be communicating directly with upstream please tell what is the best way 
> to
>     do that and I'll stop hassling you :-)

I am upstream and acting as the saned+net maintainer these days, so
it's OK :)

JB.

-- 
 Julien BLACHE - Debian & GNU/Linux Developer - <[EMAIL PROTECTED]> 
 
 Public key available on <http://www.jblache.org> - KeyID: F5D6 5169 
 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to