Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service
@ 2021-07-08  9:45 amak79
  2021-07-08 10:07 ` [PR PATCH] [Updated] " amak79
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: amak79 @ 2021-07-08  9:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4689 bytes --]

There is a new pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3288 bytes --]

From 480f56a2b7e10b67ed5b1bb6325f45f5455857eb Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

---
 srcpkgs/sane/files/saned/log/run |  2 ++
 srcpkgs/sane/files/saned/run     |  3 +++
 srcpkgs/sane/template            | 29 +++++++++++++++++++++--------
 3 files changed, 26 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/log/run
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/log/run b/srcpkgs/sane/files/saned/log/run
new file mode 100644
index 000000000000..103a945feb70
--- /dev/null
+++ b/srcpkgs/sane/files/saned/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec vlogger -t saned
diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..85e8d1d0ae12
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r conf ] && . ./conf
+exec saned ${OPTS:- -l -u _saned}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..13362b252ae1 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,39 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi avahi-libs-devel)"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# supplementary group 'lp' required to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+# enable support for escl (airscan) backend
+if [ "$build_option_avahi" ]; then
+	makedepends+=" libcurl-devel"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +51,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
@ 2021-07-08 10:07 ` amak79
  2021-07-08 11:24 ` amak79
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-08 10:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3356 bytes --]

From b42c581a1fd37d6b59bfded3ccf763f093234021 Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

---
 srcpkgs/sane/files/saned/log/run |  2 ++
 srcpkgs/sane/files/saned/run     |  3 +++
 srcpkgs/sane/template            | 33 ++++++++++++++++++++++++--------
 3 files changed, 30 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/log/run
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/log/run b/srcpkgs/sane/files/saned/log/run
new file mode 100644
index 000000000000..103a945feb70
--- /dev/null
+++ b/srcpkgs/sane/files/saned/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec vlogger -t saned
diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..85e8d1d0ae12
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r conf ] && . ./conf
+exec saned ${OPTS:- -l -u _saned}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..a982791d3416 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,43 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi avahi-libs-devel)"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# supplementary group 'lp' required to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
+
+# enable support for escl (airscan) backend
+if [ "$build_option_avahi" ]; then
+	makedepends+=" libcurl-devel"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +55,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
  2021-07-08 10:07 ` [PR PATCH] [Updated] " amak79
@ 2021-07-08 11:24 ` amak79
  2021-07-09 20:47 ` [PR REVIEW] " Piraty
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-08 11:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3365 bytes --]

From 23eb7a2f1ccb0a02e3e418ec68029b77149415c5 Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

---
 srcpkgs/sane/files/saned/log/run |  2 ++
 srcpkgs/sane/files/saned/run     |  3 +++
 srcpkgs/sane/template            | 33 ++++++++++++++++++++++++--------
 3 files changed, 30 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/log/run
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/log/run b/srcpkgs/sane/files/saned/log/run
new file mode 100644
index 000000000000..103a945feb70
--- /dev/null
+++ b/srcpkgs/sane/files/saned/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec vlogger -t saned
diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..85e8d1d0ae12
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r conf ] && . ./conf
+exec saned ${OPTS:- -l -u _saned}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..36e4ddd8d46b 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,43 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi avahi-libs-devel)"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+# enable support for escl (airscan) backend
+if [ "$build_option_avahi" ]; then
+	makedepends+=" libcurl-devel"
+fi
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +55,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR REVIEW] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
  2021-07-08 10:07 ` [PR PATCH] [Updated] " amak79
  2021-07-08 11:24 ` amak79
@ 2021-07-09 20:47 ` Piraty
  2021-07-09 20:54 ` Piraty
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Piraty @ 2021-07-09 20:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

New review comment by Piraty on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#discussion_r667203288

Comment:
`-u _saned` isn't optional...

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR REVIEW] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (2 preceding siblings ...)
  2021-07-09 20:47 ` [PR REVIEW] " Piraty
@ 2021-07-09 20:54 ` Piraty
  2021-07-10  0:45 ` [PR PATCH] [Updated] " amak79
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Piraty @ 2021-07-09 20:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

New review comment by Piraty on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#discussion_r667204442

Comment:
add this to `vopt_if avahi` , leave a comment somewhere like `escl only available if avahi is enabled` (at least in the commit, not necessarily in the template)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (3 preceding siblings ...)
  2021-07-09 20:54 ` Piraty
@ 2021-07-10  0:45 ` amak79
  2021-07-14  5:30 ` amak79
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-10  0:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3341 bytes --]

From b19736fafce5dbd7389d4f69dba0297f84ca3b5d Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

Avahi support is now optional. The escl backend is only available
if Avahi is enabled.
---
 srcpkgs/sane/files/saned/log/run |  2 ++
 srcpkgs/sane/files/saned/run     |  3 +++
 srcpkgs/sane/template            | 28 ++++++++++++++++++++--------
 3 files changed, 25 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/log/run
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/log/run b/srcpkgs/sane/files/saned/log/run
new file mode 100644
index 000000000000..103a945feb70
--- /dev/null
+++ b/srcpkgs/sane/files/saned/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec vlogger -t saned
diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..ca5f48abd27c
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r conf ] && . ./conf
+exec saned -l -u _saned ${OPTS}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..8be3278ab92d 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,38 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi avahi-libs-devel libcurl-devel)"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +50,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (4 preceding siblings ...)
  2021-07-10  0:45 ` [PR PATCH] [Updated] " amak79
@ 2021-07-14  5:30 ` amak79
  2021-07-17  4:04 ` ericonr
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-14  5:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

New comment by amak79 on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-879603021

Comment:
Is `srcpkgs/sane/files/saned/log/run` necessary? `saned` logs to syslog by default.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (5 preceding siblings ...)
  2021-07-14  5:30 ` amak79
@ 2021-07-17  4:04 ` ericonr
  2021-07-17  7:29 ` amak79
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ericonr @ 2021-07-17  4:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-881813960

Comment:
> Is srcpkgs/sane/files/saned/log/run necessary? saned logs to syslog by default.

Probably not, then. But if you still want a logger, use a symlink to `/usr/bin/vlogger` instead :)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (6 preceding siblings ...)
  2021-07-17  4:04 ` ericonr
@ 2021-07-17  7:29 ` amak79
  2021-07-18  2:38 ` [PR PATCH] [Updated] " amak79
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-17  7:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

New comment by amak79 on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-881849163

Comment:
I would rather not use a symlink because `ps` will only display `./run` for the command instead of `vlogger -t saned`.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (7 preceding siblings ...)
  2021-07-17  7:29 ` amak79
@ 2021-07-18  2:38 ` amak79
  2021-07-20 19:20 ` [PR REVIEW] " ericonr
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-18  2:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3000 bytes --]

From 22d11edb28c781368e2f2680ef0d227e024eb848 Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

Avahi support is now optional. The escl backend is only available
if Avahi is enabled.
---
 srcpkgs/sane/files/saned/run |  3 +++
 srcpkgs/sane/template        | 28 ++++++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..ca5f48abd27c
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r conf ] && . ./conf
+exec saned -l -u _saned ${OPTS}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..8be3278ab92d 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,38 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi avahi-libs-devel libcurl-devel)"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +50,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR REVIEW] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (8 preceding siblings ...)
  2021-07-18  2:38 ` [PR PATCH] [Updated] " amak79
@ 2021-07-20 19:20 ` ericonr
  2021-07-20 19:20 ` ericonr
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ericonr @ 2021-07-20 19:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#discussion_r673411606

Comment:
```suggestion
[ -r ./conf ] && . ./conf
```

For consistency :)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR REVIEW] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (9 preceding siblings ...)
  2021-07-20 19:20 ` [PR REVIEW] " ericonr
@ 2021-07-20 19:20 ` ericonr
  2021-07-21  0:56 ` [PR PATCH] [Updated] " amak79
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ericonr @ 2021-07-20 19:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#discussion_r673410829

Comment:
This isn't adding `libcurl` for the avahi build. You need:

```suggestion
 $(vopt_if avahi 'avahi-libs-devel libcurl-devel')"
```

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (10 preceding siblings ...)
  2021-07-20 19:20 ` ericonr
@ 2021-07-21  0:56 ` amak79
  2021-07-21 21:27 ` ericonr
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-21  0:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3004 bytes --]

From 3238ad1c2b55a33c3c6a6e9717d7b1b721c6a2d6 Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

Avahi support is now optional. The escl backend is only available
if Avahi is enabled.
---
 srcpkgs/sane/files/saned/run |  3 +++
 srcpkgs/sane/template        | 28 ++++++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..18016ad066c4
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r ./conf ] && . ./conf
+exec saned -l -u _saned ${OPTS}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..11f1929d26d6 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,38 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi 'avahi-libs-devel libcurl-devel')"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +50,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (11 preceding siblings ...)
  2021-07-21  0:56 ` [PR PATCH] [Updated] " amak79
@ 2021-07-21 21:27 ` ericonr
  2021-07-22  3:36 ` amak79
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ericonr @ 2021-07-21 21:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-884511791

Comment:
> I don't know how to properly fix this other than to have a ./finish script clean up any lingering saned processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

I think documenting this limitation in the commit and maybe the service file itself is necessary, as a start. Not sure how to go about actually fixing it... Have you considered opening an issue upstream?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (12 preceding siblings ...)
  2021-07-21 21:27 ` ericonr
@ 2021-07-22  3:36 ` amak79
  2021-07-22 18:53 ` ericonr
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-22  3:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

New comment by amak79 on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-884635564

Comment:
> Have you considered opening an issue upstream?

No. I would rather drop the runit service from the PR if it can't be accepted as it is.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (13 preceding siblings ...)
  2021-07-22  3:36 ` amak79
@ 2021-07-22 18:53 ` ericonr
  2021-07-23  1:58 ` [PR PATCH] [Updated] " amak79
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: ericonr @ 2021-07-22 18:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-885154197

Comment:
> No. I would rather drop the runit service from the PR if it can't be accepted as it is.

I think it still can; just remember to document the current limitation, at least.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (14 preceding siblings ...)
  2021-07-22 18:53 ` ericonr
@ 2021-07-23  1:58 ` amak79
  2021-07-23  2:06 ` amak79
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-23  1:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3135 bytes --]

From c3065df44ec52d21ce6134e521a60e29cbe8ec0f Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

Avahi support is now optional. The escl backend is only available
if Avahi is enabled.

When SANE is built with Avahi support, saned will spawn a second
process that sv can't stop. This issue should be taken upstream.
---
 srcpkgs/sane/files/saned/run |  3 +++
 srcpkgs/sane/template        | 28 ++++++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..18016ad066c4
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r ./conf ] && . ./conf
+exec saned -l -u _saned ${OPTS}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..11f1929d26d6 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,38 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi 'avahi-libs-devel libcurl-devel')"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +50,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (15 preceding siblings ...)
  2021-07-23  1:58 ` [PR PATCH] [Updated] " amak79
@ 2021-07-23  2:06 ` amak79
  2021-07-23 13:13 ` [PR PATCH] [Updated] " amak79
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-23  2:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

New comment by amak79 on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-885350916

Comment:
The commit message has been updated to mention the issue with the runit service.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (16 preceding siblings ...)
  2021-07-23  2:06 ` amak79
@ 2021-07-23 13:13 ` amak79
  2021-08-13  2:27 ` amak79
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-07-23 13:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3254 bytes --]

From 046ca39ec84cecf221f453ed65da88dfc05c7eaa Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

Avahi support is now optional. The escl backend is only available
if Avahi is enabled.

When SANE is built with Avahi support, saned will spawn a second
process that is related to Avahi functionality. This process can't
be stopped by sv and will remain after the main saned process is
terminated. This issue should be reported upstream.
---
 srcpkgs/sane/files/saned/run |  3 +++
 srcpkgs/sane/template        | 28 ++++++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..18016ad066c4
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r ./conf ] && . ./conf
+exec saned -l -u _saned ${OPTS}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..11f1929d26d6 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,38 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi 'avahi-libs-devel libcurl-devel')"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +50,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (17 preceding siblings ...)
  2021-07-23 13:13 ` [PR PATCH] [Updated] " amak79
@ 2021-08-13  2:27 ` amak79
  2021-08-13  2:29 ` amak79
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-08-13  2:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

New comment by amak79 on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-898122752

Comment:
Issue reported upstream: https://gitlab.com/sane-project/backends/-/issues/499

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (18 preceding siblings ...)
  2021-08-13  2:27 ` amak79
@ 2021-08-13  2:29 ` amak79
  2021-08-24  8:01 ` [PR PATCH] [Updated] " amak79
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-08-13  2:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]

New comment by amak79 on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-898122752

Comment:
> Have you considered opening an issue upstream?

Issue reported upstream: https://gitlab.com/sane-project/backends/-/issues/499

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (19 preceding siblings ...)
  2021-08-13  2:29 ` amak79
@ 2021-08-24  8:01 ` amak79
  2021-10-26  9:49 ` amak79
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-08-24  8:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 3286 bytes --]

From 41b3f8f7f76004262e89fe8b5481cfcf512e403d Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: update to 1.0.32, add libcurl for escl backend, add
 runit service

Avahi support is now optional. The escl backend is only available
if Avahi is enabled.

When SANE is built with Avahi support, saned will spawn a child process
that is related to Avahi functionality. This process can't be stopped
by sv and will remain after the main saned process is terminated.
Reported upstream: https://gitlab.com/sane-project/backends/-/issues/499
---
 srcpkgs/sane/files/saned/run |  3 +++
 srcpkgs/sane/template        | 28 ++++++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..18016ad066c4
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r ./conf ] && . ./conf
+exec saned -l -u _saned ${OPTS}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 35dac1cc846a..11f1929d26d6 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -1,28 +1,38 @@
 # Template file for 'sane'
 pkgname=sane
-_gitlab_release_hash=8bf1cae2e1803aefab9e5331550e5d5d
-version=1.0.31
-revision=3
+_gitlab_release_hash=104f09c07d35519cc8e72e604f11643f
+version=1.0.32
+revision=1
 wrksrc="sane-backends-${version}"
 build_style=gnu-configure
 configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi 'avahi-libs-devel libcurl-devel')"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="GPL-2.0-or-later, SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
-checksum=4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa
+checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3"
+fi
 
 post_build() {
 	# generate udev file
@@ -40,6 +50,8 @@ post_install() {
 	vlicense LICENSE # License clarification
 	vlicense COPYING # GPL-2.0
 	sed -n "1,43 p" "${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Updated] sane: update to 1.0.32, add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (20 preceding siblings ...)
  2021-08-24  8:01 ` [PR PATCH] [Updated] " amak79
@ 2021-10-26  9:49 ` amak79
  2021-10-28  4:20 ` [PR PATCH] [Merged]: sane: " ericonr
  2021-10-28  4:20 ` ericonr
  23 siblings, 0 replies; 25+ messages in thread
From: amak79 @ 2021-10-26  9:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]

There is an updated pull request by amak79 against master on the void-packages repository

https://github.com/amak79/void-packages sane
https://github.com/void-linux/void-packages/pull/31851

sane: update to 1.0.32, add libcurl for escl backend, add runit service
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Update SANE to 1.0.32
* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

A patch file from https://github.com/void-linux/void-packages/pull/31851.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sane-31851.patch --]
[-- Type: text/x-diff, Size: 2969 bytes --]

From dc2b59b0e5f4ce64a2a1f160eac0393412561317 Mon Sep 17 00:00:00 2001
From: amak <amak.git@outlook.com>
Date: Thu, 8 Jul 2021 18:42:06 +1000
Subject: [PATCH] sane: add libcurl for escl backend, add runit service

Avahi support is now optional. The escl backend is only available
if Avahi is enabled.

When SANE is built with Avahi support, saned will spawn a child process
that is related to Avahi functionality. This process can't be stopped
by sv and will remain after the main saned process is terminated.
Reported upstream: https://gitlab.com/sane-project/backends/-/issues/499
---
 srcpkgs/sane/files/saned/run |  3 +++
 srcpkgs/sane/template        | 16 ++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/sane/files/saned/run

diff --git a/srcpkgs/sane/files/saned/run b/srcpkgs/sane/files/saned/run
new file mode 100644
index 000000000000..18016ad066c4
--- /dev/null
+++ b/srcpkgs/sane/files/saned/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+[ -r ./conf ] && . ./conf
+exec saned -l -u _saned ${OPTS}
diff --git a/srcpkgs/sane/template b/srcpkgs/sane/template
index 4e8cdab17d61..c21c9ea8aed1 100644
--- a/srcpkgs/sane/template
+++ b/srcpkgs/sane/template
@@ -9,20 +9,26 @@ configure_args="--disable-locking --enable-ipv6 --enable-pthread
  --with-usb --docdir=/usr/share/doc/sane ac_cv_func_mmap_fixed_mapped=yes
  $(vopt_with snmp)"
 hostmakedepends="pkg-config python3"
-makedepends="avahi-libs-devel libjpeg-turbo-devel tiff-devel libgphoto2-devel
- v4l-utils-devel libusb-devel openssl-devel libxml2-devel
- $(vopt_if snmp net-snmp-devel)"
+makedepends="libjpeg-turbo-devel tiff-devel libgphoto2-devel v4l-utils-devel
+ libusb-devel openssl-devel libxml2-devel $(vopt_if snmp net-snmp-devel)
+ $(vopt_if avahi 'avahi-libs-devel libcurl-devel')"
 depends="$(vopt_if snmp net-snmp)"
 conf_files="/etc/sane.d/*.conf"
 short_desc="Scanner Access Now Easy"
 maintainer="Piraty <piraty1@inbox.ru>"
 license="custom:GPL-2.0-or-later-with-SANE-exception"
 homepage="http://www.sane-project.org/"
+changelog="https://gitlab.com/sane-project/backends/-/raw/master/NEWS"
 distfiles="https://gitlab.com/sane-project/backends/uploads/${_gitlab_release_hash}/sane-backends-${version}.tar.gz"
 checksum=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
 noshlibprovides="avoid false detection of device drivers"
 
-build_options="snmp"
+# additional group 'lp' is required by saned to access some all-in-one devices
+system_accounts="_saned"
+_saned_groups="lp,scanner"
+
+build_options="avahi snmp"
+build_options_default="avahi"
 
 # tests broken on 32bit.  https://gitlab.com/sane-project/backends/-/issues/157
 if [ "$XBPS_TARGET_WORDSIZE" = "32" ]; then
@@ -47,6 +53,8 @@ post_install() {
 	sed -n \
 		-e "/\/* sane - Scanner Access Now Easy./,/dynamic linking to load backends on demand./p" \
 		"${wrksrc}/backend/dll.c" > "${DESTDIR}/usr/share/licenses/sane/SANE-EXCEPTION"
+
+	vsv saned
 }
 
 libsane_package() {

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PR PATCH] [Merged]: sane: add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (21 preceding siblings ...)
  2021-10-26  9:49 ` amak79
@ 2021-10-28  4:20 ` ericonr
  2021-10-28  4:20 ` ericonr
  23 siblings, 0 replies; 25+ messages in thread
From: ericonr @ 2021-10-28  4:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4500 bytes --]

There's a merged pull request on the void-packages repository

sane: add libcurl for escl backend, add runit service
https://github.com/void-linux/void-packages/pull/31851

Description:
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->
Changes

* Make Avahi support optional
* Add libcurl for eSCL (AirScan) backend when Avahi is enabled
* Add `_saned` user/group
* Add a runit service for `saned`

There is an issue with the runit service when SANE is built with Avahi support. `saned` will spawn a second process (pid 1429) which can be seen below:
```
$ ps
1428 _saned   _saned    0.0  0.0  16164  6088 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
1429 _saned   _saned    0.0  0.0  16164   548 ?        S    18:57:06 00:00:00 saned -l -u _saned -d128
```
```
$ svlogtail
2021-07-08T08:57:06.35901 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: searching for config file
2021-07-08T08:57:06.35906 daemon.debug: Jul  8 18:57:06 saned[1428]: read_config: done reading config
2021-07-08T08:57:06.35909 daemon.debug: Jul  8 18:57:06 saned[1428]: saned (AF-indep+IPv6) from sane-backends 1.0.32 starting up
2021-07-08T08:57:06.35911 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: trying to get port for service "sane-port" (getaddrinfo)
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36066 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] socket () using IPv6
2021-07-08T08:57:06.36069 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] setsockopt ()
2021-07-08T08:57:06.36070 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] bind () to port 6566
2021-07-08T08:57:06.36072 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [1] listen ()
2021-07-08T08:57:06.36076 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] socket () using IPv4
2021-07-08T08:57:06.36077 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] setsockopt ()
2021-07-08T08:57:06.36079 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind () to port 6566
2021-07-08T08:57:06.36080 daemon.debug: Jul  8 18:57:06 saned[1428]: do_bindings: [0] bind failed: Address already in use
2021-07-08T08:57:06.36083 daemon.debug: Jul  8 18:57:06 saned[1428]: Dropped privileges to uid 993 gid 990
2021-07-08T08:57:06.36084 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: spawning Avahi process
2021-07-08T08:57:06.36101 daemon.debug: Jul  8 18:57:06 saned[1428]: run_standalone: waiting for control connection
2021-07-08T08:57:06.36204 daemon.debug: Jul  8 18:57:06 saned[1429]: saned_avahi_callback: AVAHI_CLIENT_CONNECTING
```
The second process is related to Avahi functionality. `sv` will stop the main process (pid 1428) but the second process remains. This doesn’t occur when SANE is built without Avahi support. This is why I made Avahi support optional.

I don't know how to properly fix this other than to have a `./finish` script clean up any lingering `saned` processes, but I’m not sure how safe that is. If there is no acceptable solution I can drop the runit service from this PR.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: sane: add libcurl for escl backend, add runit service
  2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
                   ` (22 preceding siblings ...)
  2021-10-28  4:20 ` [PR PATCH] [Merged]: sane: " ericonr
@ 2021-10-28  4:20 ` ericonr
  23 siblings, 0 replies; 25+ messages in thread
From: ericonr @ 2021-10-28  4:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/31851#issuecomment-953489836

Comment:
Thanks!

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2021-10-28  4:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08  9:45 [PR PATCH] sane: update to 1.0.32, add libcurl for escl backend, add runit service amak79
2021-07-08 10:07 ` [PR PATCH] [Updated] " amak79
2021-07-08 11:24 ` amak79
2021-07-09 20:47 ` [PR REVIEW] " Piraty
2021-07-09 20:54 ` Piraty
2021-07-10  0:45 ` [PR PATCH] [Updated] " amak79
2021-07-14  5:30 ` amak79
2021-07-17  4:04 ` ericonr
2021-07-17  7:29 ` amak79
2021-07-18  2:38 ` [PR PATCH] [Updated] " amak79
2021-07-20 19:20 ` [PR REVIEW] " ericonr
2021-07-20 19:20 ` ericonr
2021-07-21  0:56 ` [PR PATCH] [Updated] " amak79
2021-07-21 21:27 ` ericonr
2021-07-22  3:36 ` amak79
2021-07-22 18:53 ` ericonr
2021-07-23  1:58 ` [PR PATCH] [Updated] " amak79
2021-07-23  2:06 ` amak79
2021-07-23 13:13 ` [PR PATCH] [Updated] " amak79
2021-08-13  2:27 ` amak79
2021-08-13  2:29 ` amak79
2021-08-24  8:01 ` [PR PATCH] [Updated] " amak79
2021-10-26  9:49 ` amak79
2021-10-28  4:20 ` [PR PATCH] [Merged]: sane: " ericonr
2021-10-28  4:20 ` ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).