[sane-devel] scanbd integration (was Re: sane-backends release 1.0.26 schedule)
Olaf Meeuwissen
paddy-hack at member.fsf.org
Sun May 7 00:50:06 UTC 2017
Hi Louis,
I already commented rather elaborately on your reply to Allan's follow
up. Here I just pick up on the things specific to this reply of yours.
Louis Lagendijk writes:
> On Sat, 2017-05-06 at 21:20 +0900, Olaf Meeuwissen wrote:
>> Hi Louis,
>>
>> Louis Lagendijk writes:
>>
>> [snip]
>>
>> > I made a patch to dll.c where
>> > - It used the dll.conf with the name pointed out by env. var
>> > SANE_CONFIG_FILE if defined, if not
>> > - it tries to load a dll2.conf if it exists. This is meant to be a
>> > file
>> > dropped in thre sane config dir by scanbd. If that does not exist
>> > - it follows the existing code path.
>>
>> So, if I understand correctly, your patched dll backend tries
>>
>> $SANE_CONFIG_FILE (if defined)
>> $SANE_CONFIG_DIR/dll2.conf (if SANE_CONFIG_DIR is defined)
>> $sysconfdir/dll2.conf
>> $SANE_CONFIG_DIR/dll.conf (if SANE_CONFIG_DIR is defined)
>> $sysconfdir/dll.conf
>>
>> where $sysconfdir is set at ./configure time.Is that right?
>>
> Yes, I am indeed using the $sysconfdir (or SANE_CONFIG_DIR) as search
> path for all config files.
>
> I am using the sanei functions for loading the config, so the logic is
> the same as for loading other config files.
As long as you're using sanei_config_open() to get the file you should
be fine.
>> > I added a #include statement in the config file so dll2.conf can
>> > include dll.conf if so required.
>>
>> How does that work when SANE_CONFIG_DIR is defined?
>
> I need to check this, but I am using sanei_config so it SHOULD (famous
> last words) work. do it would follow the normal search path
> (SANE_CONFIG_DIR if set, otherwise $sysconfdir). I actually implemented
> this by a call to read_conf with the new name from within read_config.
> This would allow even allow an include from an include.
What about the possibility of infinite loops in this case? An a.conf
including b.conf which includes a.conf. The various directories that
may be visited in order to locate a file makes this even more difficult
to track/detect.
> I however just realized that if a user gets the override dll.conf,
> scanbd could use dll.conf explicitely. This removes the need for the
> #include, so i will remove it.
That would eliminate a few questions ;-)
> alan mailed me about one issue: if there is a dll2.conf but scanbd is
> not started, sane would not find any scanners. I don't know what to do
> about that case. Well start scanbd init scripts or the systemd units
> could place/remove the dll2.conf, but that is to much of an hack.
The init system should not be doing this kind of stuff. The package's
post-installation and pre-removal scripts could do this instead.
Hope this helps,
--
Olaf Meeuwissen, LPIC-2 FSF Associate Member since 2004-01-27
GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13 F43E B8A4 A88A F84A 2DD9
Support Free Software https://my.fsf.org/donate
Join the Free Software Foundation https://my.fsf.org/join
More information about the sane-devel
mailing list