GNU bug report logs -
#49839
[PATCH] shepherd: add keep-tty flag to skip setsid
Previous Next
Reported by: muradm <mail <at> muradm.net>
Date: Tue, 3 Aug 2021 01:08:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49839 in the body.
You can then email your comments to 49839 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#49839
; Package
guix-patches
.
(Tue, 03 Aug 2021 01:08:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
muradm <mail <at> muradm.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 03 Aug 2021 01:08:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
* modules/shepherd/service.scm: add keep-tty flag to skip setsid
when using shepherd as user, programs like xorg server,
potentially any
program which ends up interacting with user, require terminal to
remain.
currently, setsid is called unconditionally from exec-command
function,
making it impossible to have such process.
this adds keep-tty flag to make-forkexec-constructor up to
exec-command
function where setsid is actually called.
[shepherd-keep-tty.patch (text/x-patch, inline)]
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 587ff68..1ae9544 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -786,6 +786,7 @@ daemon writing FILE is running in a separate PID namespace."
(log-file #f)
(directory (default-service-directory))
(file-creation-mask #f)
+ (keep-tty #f)
(environment-variables (default-environment-variables)))
"Run COMMAND as the current process from DIRECTORY, with FILE-CREATION-MASK
if it's true, and with ENVIRONMENT-VARIABLES (a list of strings like
@@ -804,7 +805,7 @@ false."
((program args ...)
;; Become the leader of a new session and session group.
;; Programs such as 'mingetty' expect this.
- (setsid)
+ (unless keep-tty (setsid))
(chdir directory)
(environ environment-variables)
@@ -889,6 +890,7 @@ false."
(log-file #f)
(directory (default-service-directory))
(file-creation-mask #f)
+ (keep-tty #f)
(environment-variables
(default-environment-variables)))
"Spawn a process that executed COMMAND as per 'exec-command', and return
@@ -920,6 +922,7 @@ its PID."
#:log-file log-file
#:directory directory
#:file-creation-mask file-creation-mask
+ #:keep-tty keep-tty
#:environment-variables environment-variables))
pid))))
@@ -929,6 +932,7 @@ its PID."
(group #f)
(supplementary-groups '())
(directory (default-service-directory))
+ (keep-tty #f)
(environment-variables
(default-environment-variables))
(file-creation-mask #f)
@@ -949,7 +953,9 @@ When @var{pid-file} is true, it must be the name of a PID file associated with
the process being launched; the return value is the PID read from that file,
once that file has been created. If @var{pid-file} does not show up in less
than @var{pid-file-timeout} seconds, the service is considered as failing to
-start."
+start.
+
+When @var{keep-tty} is true, will not call @code{setsid} for process."
(lambda args
(define (clean-up file)
(when file
@@ -969,6 +975,7 @@ start."
#:log-file log-file
#:directory directory
#:file-creation-mask file-creation-mask
+ #:keep-tty keep-tty
#:environment-variables
environment-variables)))
(if pid-file
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Tue, 10 Aug 2021 12:53:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
muradm <mail <at> muradm.net>
:
bug acknowledged by developer.
(Tue, 10 Aug 2021 12:53:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 49839-done <at> debbugs.gnu.org (full text, mbox):
Hi,
muradm <mail <at> muradm.net> skribis:
> * modules/shepherd/service.scm: add keep-tty flag to skip setsid
>
> when using shepherd as user, programs like xorg server, potentially
> any
> program which ends up interacting with user, require terminal to
> remain.
>
> currently, setsid is called unconditionally from exec-command
> function,
> making it impossible to have such process.
>
> this adds keep-tty flag to make-forkexec-constructor up to
> exec-command
> function where setsid is actually called.
>
> diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
> index 587ff68..1ae9544 100644
> --- a/modules/shepherd/service.scm
> +++ b/modules/shepherd/service.scm
> @@ -786,6 +786,7 @@ daemon writing FILE is running in a separate PID namespace."
> (log-file #f)
> (directory (default-service-directory))
> (file-creation-mask #f)
> + (keep-tty #f)
> (environment-variables (default-environment-variables)))
> "Run COMMAND as the current process from DIRECTORY, with FILE-CREATION-MASK
> if it's true, and with ENVIRONMENT-VARIABLES (a list of strings like
> @@ -804,7 +805,7 @@ false."
> ((program args ...)
> ;; Become the leader of a new session and session group.
> ;; Programs such as 'mingetty' expect this.
> - (setsid)
> + (unless keep-tty (setsid))
I did that slightly differently:
https://git.savannah.gnu.org/cgit/shepherd.git/commit/?id=c43f81794344dbac31bcb8b8f1c0d266f47f14fa
Let me know if it works for you.
Thanks,
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#49839
; Package
guix-patches
.
(Tue, 10 Aug 2021 21:09:03 GMT)
Full text and
rfc822 format available.
Message #13 received at 49839-done <at> debbugs.gnu.org (full text, mbox):
Hi,
Basically it is samething, should work.
Any idea when to expect it in public?
Thanks in advance,
muradm
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hi,
>
> muradm <mail <at> muradm.net> skribis:
>
>> * modules/shepherd/service.scm: add keep-tty flag to skip
>> setsid
>>
>> when using shepherd as user, programs like xorg server,
>> potentially
>> any
>> program which ends up interacting with user, require terminal
>> to
>> remain.
>>
>> currently, setsid is called unconditionally from exec-command
>> function,
>> making it impossible to have such process.
>>
>> this adds keep-tty flag to make-forkexec-constructor up to
>> exec-command
>> function where setsid is actually called.
>>
>> diff --git a/modules/shepherd/service.scm
>> b/modules/shepherd/service.scm
>> index 587ff68..1ae9544 100644
>> --- a/modules/shepherd/service.scm
>> +++ b/modules/shepherd/service.scm
>> @@ -786,6 +786,7 @@ daemon writing FILE is running in a
>> separate PID namespace."
>> (log-file #f)
>> (directory (default-service-directory))
>> (file-creation-mask #f)
>> + (keep-tty #f)
>> (environment-variables (default-environment-variables)))
>> "Run COMMAND as the current process from DIRECTORY, with
>> FILE-CREATION-MASK
>> if it's true, and with ENVIRONMENT-VARIABLES (a list of
>> strings like
>> @@ -804,7 +805,7 @@ false."
>> ((program args ...)
>> ;; Become the leader of a new session and session group.
>> ;; Programs such as 'mingetty' expect this.
>> - (setsid)
>> + (unless keep-tty (setsid))
>
> I did that slightly differently:
>
> https://git.savannah.gnu.org/cgit/shepherd.git/commit/?id=c43f81794344dbac31bcb8b8f1c0d266f47f14fa
>
> Let me know if it works for you.
>
> Thanks,
> Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#49839
; Package
guix-patches
.
(Wed, 11 Aug 2021 09:58:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 49839-done <at> debbugs.gnu.org (full text, mbox):
Hi,
muradm <mail <at> muradm.net> skribis:
> Basically it is samething, should work.
> Any idea when to expect it in public?
There are no planned Shepherd releases currently, we’ll see…
Thanks,
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 08 Sep 2021 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 286 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.