Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 927374 - media-gfx/sane-backends-1.2.1[-systemd]: SANED_USER option doesn't work
Summary: media-gfx/sane-backends-1.2.1[-systemd]: SANED_USER option doesn't work
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-20 18:26 UTC by i.Dark_Templar
Modified: 2024-03-20 18:34 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description i.Dark_Templar 2024-03-20 18:26:20 UTC
When setting saned user via SANED_USER option in /etc/conf.d/saned for openrc, it is ignored.

Reproducible: Always

Steps to Reproduce:
1. emerge -1 sane-backends
2. echo 'SANED_USER="saned"' >> /etc/conf.d/saned
3. /etc/init.d/saned restart
4. ps aux | grep saned
Actual Results:  
saned is still running as root

Expected Results:  
saned is running as saned user

It looks like saned is using getopt_long for parsing options, and username is optional for option '-a':

https://gitlab.com/sane-project/backends/-/blob/master/frontend/saned.c?ref_type=heads#L3457

It looks like in that case argument must be in same option, like it's described here:

https://cfengine.com/blog/2021/optional-arguments-with-getopt-long/

Getting rid of whitespace like here helps:

diff --git a/init.d/saned b/init.d/saned
index e7f2ebd..e5328fa 100755
--- a/init.d/saned
+++ b/init.d/saned
@@ -4,7 +4,7 @@
 
 pidfile="/var/run/saned/saned.pid"
 command="/usr/sbin/saned"
-command_args="-a ${SANED_USER:-root}"
+command_args="-a${SANED_USER:-root}"
 
 start_pre() {
        checkpath -d -o ${SANED_USER:-root} ${pidfile%/*}