[PATCH] Man page for --cmdpart feature.

2014-09-15 Thread Clemens Fruhwirth
---
 man/start-stop-daemon.8 | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8
index a70cd3d..85aedb2 100644
--- a/man/start-stop-daemon.8
+++ b/man/start-stop-daemon.8
@@ -134,6 +134,12 @@ short length limit (assuming more than 15 characters is 
non-portable).
 Check for processes owned by the user specified by \fIusername\fP or
 \fIuid\fP. Note: using this matching option alone will cause all processes
 matching the user to be acted on.
+.TP
+.BR \-\-cmdpart " \fIprocess-argument-part\fP"
+Check for processes that have \fIprocess-argument-part\fP as first
+argument in the list of remaining unchecked process arguments. This
+option can be specified multiple times and so more than the first
+arguments of processes can be checked.
 .
 .SS Generic options
 .TP
@@ -363,3 +369,15 @@ Demonstration of a custom schedule for stopping \fBfood\fP:
 start\-stop\-daemon \-\-stop \-\-oknodo \-\-user food \-\-name food \\
\-\-pidfile /run/food.pid \-\-retry=TERM/30/KILL/5
 .fi
+.PP
+With interpreted scripts, multiple invocations of --cmdpart help to
+instances of the interpreter running different scripts. This only
+matches bash instances that run "my script.sh":
+.IP
+.nf
+start\-stop\-daemon \-\-start \\
+   \-\-cmdpart /bin/bash \\
+   \-\-cmdpart "/bin/my script.sh" \\
+   \-\-exec /bin/bash \\
+   "/bin/my script.sh"
+.fi
-- 
2.1.0


-- 
To UNSUBSCRIBE, email to debian-dpkg-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/1410787226-10801-1-git-send-email-clem...@endorphin.org



Re: xattrs support

2014-09-15 Thread Guillem Jover
Hi!

On Fri, 2014-09-12 at 13:44:03 -0400, Mimi Zohar wrote:
> On Fri, 2014-09-12 at 12:12 +0400, Dmitry Falko wrote: 
> > I have a question on support xattrs in dpkg-dep. As far as I know in 
> > version 1.27.1 (Ubuntu 14.04) supports the creation of tar archives 
> > preserving extended attributes, perhaps it makes sense to add ability to 
> > create packages containing files with extended attributes. May be 
> > special options?
> 
> I'm very interested in having xattrs included in deb packages.  Which
> xattrs in particular are you interested in?  Part of the problem is that
> fake-root creates the directory structure, but wouldn't be able to copy
> the security xattrs. Reading security xattrs is permitted, but writing
> security xattrs requires privilege.

The other problem is that dpkg does not use tar on unpack, it uses its
own internal tar extractor so that it can handle directly the files
being unpacked, which will refuse any unknown tar file type.

In any case, yes dpkg should eventually support something like that,
but it would need to be outside of the filesystem, as in it would need
to be tracked in the dpkg files database, and possibly be applied on
the filesystem, because there's no guarantee the current filesystem
will have xattr support.

My idea is to add some kind of manifest file at build time, most
probably based on the new mtree(5) format. I think I migth have code
around parsing that, but I'd need to check. Let me get 1.17.14 out of
the way and I can come back to you with more concrete plans and code.

Thanks,
Guillem


-- 
To UNSUBSCRIBE, email to debian-dpkg-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140915141613.ga16...@gaara.hadrons.org



Re: [PATCH] Add --cmdpart to filter processes by argv elements.

2014-09-15 Thread Guillem Jover
Hi!

On Wed, 2014-09-10 at 22:29:10 +0200, Clemens Fruhwirth wrote:
> The user can supplies a list of strings by using --cmdpart multiple
> times, such as
> 
> $ start-stop-daemon --cmdpart /usr/bin/python --cmdpart mydaemon.py 
> 
> This list is prefix-matched against the argv list of existing
> processes. Only matching processes are considered to be the daemon in
> question. As by the example above, the main intended use case is
> allowing start-stop-daemon to detect running scripts.

Ah! Yes, I started working on a solution for this some time ago, that
instead would be automatic, by reading the executable and detecting
if it's an interpreted script, which would then check the arguments
and match the first one against that.

I think I have the interpreter detection done, just need to plug it
into the rest, but I'd have to look for the code, let me get 1.17.14
out of the way and I'll come back to you with more concrete plans or
code.

> This is only implemented for Linux ATM, making use of
> /proc/pid/cmdline.

I'm afraid that would be a non-starter.

Thanks,
Guillem


-- 
To UNSUBSCRIBE, email to debian-dpkg-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140915142145.gb16...@gaara.hadrons.org



Re: [PATCH] Add --cmdpart to filter processes by argv elements.

2014-09-15 Thread Clemens Fruhwirth
Hi Guillem!

On 15 September 2014 16:21, Guillem Jover  wrote:
> Hi!
>
> On Wed, 2014-09-10 at 22:29:10 +0200, Clemens Fruhwirth wrote:
>> The user can supplies a list of strings by using --cmdpart multiple
>> times, such as
>>
>> $ start-stop-daemon --cmdpart /usr/bin/python --cmdpart mydaemon.py 
>>
>> This list is prefix-matched against the argv list of existing
>> processes. Only matching processes are considered to be the daemon in
>> question. As by the example above, the main intended use case is
>> allowing start-stop-daemon to detect running scripts.
>
> Ah! Yes, I started working on a solution for this some time ago, that
> instead would be automatic, by reading the executable and detecting
> if it's an interpreted script,

Reliability concerns aside, see
http://www.in-ulm.de/~mascheck/various/shebang/ , I am not sure that I
prefer an automatic solution. My approach while more cumbersome is
arguably more powerful as it's not just for scripts but can be reused
to regular daemons that run more than one instance. IIRC maradns used
to spawn a daemon for each network interface, and you could tell apart
the instances by the "-c $cfgfile" they got. This patch plus a bit of
argument reordering allows for separate control of each instance.

>> This is only implemented for Linux ATM, making use of
>> /proc/pid/cmdline.
>
> I'm afraid that would be a non-starter.

Since your patch has exactly the same problem -- extracting the argv
from running processes -- would you mind basing your automatic
detection on my patch -- just fill cmdparts_c/cmdparts_v with your
detecting results -- and completing other OS implementations for
"static bool pid_has_cmdparts(pit_t pid)"? I, for my part, have zero
interest in contributing to non-GPL OS implementations.
--
Fruhwirth Clemens http://clemens.endorphin.org


-- 
To UNSUBSCRIBE, email to debian-dpkg-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/CAG6gW_sru+Mv=rdqi6v70rv8nt3dou4zblnkzg-gfzs2vlg...@mail.gmail.com