From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aFBhJ0itU2ItfgAAgWs5BA (envelope-from ) for ; Mon, 11 Apr 2022 06:23:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MMMVJEitU2ITBAEAauVa8A (envelope-from ) for ; Mon, 11 Apr 2022 06:23:36 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 322411906A for ; Mon, 11 Apr 2022 06:23:36 +0200 (CEST) Received: from localhost ([::1]:42372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndlaQ-0005yM-V0 for larch@yhetil.org; Mon, 11 Apr 2022 00:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndla6-0005yE-JM for guix-devel@gnu.org; Mon, 11 Apr 2022 00:23:14 -0400 Received: from mail-ej1-x643.google.com ([2a00:1450:4864:20::643]:33788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ndla4-0001Pc-QC; Mon, 11 Apr 2022 00:23:14 -0400 Received: by mail-ej1-x643.google.com with SMTP id s18so5827878ejr.0; Sun, 10 Apr 2022 21:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=LaNvLrpddBmaKNoBNcyooLpVKrASf6PQmW4VodoPiOU=; b=JfeUymj0Ws0a54zEy3t7Kqe9c/ks20gUs4gJD/wQR7yTwu1ZxxDVXj/PgWib8yG9Vp PwRXMW4wqnAGtQb1ErbqVZlGyKPvqb2njWaAyzjsQPbxnZFN4pGJrfxN4EOy5e8AJ9h6 LGdayLqyYfFsKbGy07oro7nMOJxBfTdNnz+tYGxsMg1SpbV92COREvUqESWeZcl3R0MK /DWsxNrerIPMyU2gN8gDQfDbaEDl3yUy2MJjEYboA9s5dU/Wlgydqj3HULXl5aXGug65 Hh9s2JY+OeTvcYaFtKKcSBxCgtLnQa3hDxPc8/AvkB1575wAA4OIhZY6uBQRQQUGL0gw rwrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=LaNvLrpddBmaKNoBNcyooLpVKrASf6PQmW4VodoPiOU=; b=bi090Z7fCdtk9b9q+CP4A/lTeaAjzr/cM992Xl5zGZfUd4vh48tBIoKJtY8RIkHDNw GYWFrOMUsgdU+idqlDzCNrTIXWYu7xIf7n/LVXafkpOcdpirxpysg3rT+gwxmQAxx/Xm pDnlhbaD+IbU8D8ordKtKJBT1XTml7A8fcTFV6RsVWOqf7IgI1+EIdBBxY8l1ENAQ9At Tj7swYj3Eh778aY7w43WghLQU1TodfK8DaXq5grapSwz1eEXqi/z+Ltecdy4DtiMFvOB nu8RtKdgc8pLzpYzd82hzsGw73Ysz6HSv+1tybgGxHmEcWeD2ojTFibsBO9oMwok+gtF G1Ag== X-Gm-Message-State: AOAM531HbrLyq/JKEN2BLyj0ix4Bjzi6K224pD4H3HFXvs1Sjxce9ceh rCs5X0L0eCk0OtKKL+BbfL1XSTogG1E= X-Google-Smtp-Source: ABdhPJyNux1cmKFk3ErkVp1gVGFgFgt7wGEPf9cd3R1l6zHw6t7A3Jjrw+a2pqPE6vOHhx1I3+NbFw== X-Received: by 2002:a17:907:97cc:b0:6da:a8fb:d1db with SMTP id js12-20020a17090797cc00b006daa8fbd1dbmr28730254ejc.267.1649650987479; Sun, 10 Apr 2022 21:23:07 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id h1-20020a50e101000000b0041cdb91ef08sm10090901edl.38.2022.04.10.21.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Apr 2022 21:23:06 -0700 (PDT) Message-ID: <156738d0efb4fa5ef2af08c5a8b485b4f1044f22.camel@gmail.com> Subject: Re: Sockets in Shepherd, and Emacs, oh my! From: Liliana Marie Prikler To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Mon, 11 Apr 2022 06:23:05 +0200 In-Reply-To: <87o8184qpd.fsf@gnu.org> References: <8de0693f22bf19263406b448f587f6b0eb0195a0.camel@gmail.com> <87o8184qpd.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::643; envelope-from=liliana.prikler@gmail.com; helo=mail-ej1-x643.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1649651016; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=LaNvLrpddBmaKNoBNcyooLpVKrASf6PQmW4VodoPiOU=; b=cA3f5k/fHiiNoDLc5rfhOx0SXEo89lUQ4sKygiDb0g1JPTSbn9AGRn5sK9vQ/3J5lP9AYX ZEeNmllZAwD9SDdeHRvCh+qvYQKWD2DeQChj9mmWopbxIxeQ1a/iIIZGBAzbl2jMXHZ8Od 5ZP9Mt0R2RrhEtGrPZh1mhb3IEFDwFoZlhuqwWaMiz+X0jw2aNw5lm4EP0qwMfe3y2RJfj qra50abmJvCtNXgf9EzmPvklcgv2RG0o86lbKjkUVubPH8zGE7jHjCcmGBgofyoSMCtRx4 TK8Rdkhe2SOMlYjJH2twd6MWMSTZ43aYwiWK4SV0dgwrsQmq5KiJeTXIuAQN9w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649651016; a=rsa-sha256; cv=none; b=YxWyTodr5vWjntO3/2I/oeO54SeCNCD7s6aLEzbzLheKgAZH0m0kinLHR5RvBDmhu+pSpS IbQfOTQvYOjjonGrrQvJIq1SzsOVv976vivZwNSpVUQH9LeGJLGZ/OgHeZzEt9VUtLvnfi Oh1+5JWOcoEwHo/ElsZmbT5L70DOHWVzzv4CS6o+Kl2fxu+F4xBOGyEiVUMpIT/GZq3KZz CnbUC8TRTF1IiVSLrQxTsuweDR+uGkuqA442NDEjhZWqmgBDjyQCA1zSm2DyUg1XZtroP/ 3RRGt7GkwKntW4klfRf7VOjBIz+4YxavZN19pTHtWJP5K9+DVfNxXe3Q0KA8BQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JfeUymj0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.37 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JfeUymj0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 322411906A X-Spam-Score: -5.37 X-Migadu-Scanner: scn0.migadu.com X-TUID: Eauz7aT7V1DE Hi, Am Sonntag, dem 10.04.2022 um 22:40 +0200 schrieb Ludovic Courtès: > Hallo! > > Liliana Marie Prikler skribis: > > > given that Shepherd 0.9.0 adds support for systemd-style socket > > activation and Emacs supports that (if linked against systemd!) I > > wanted to try it out.  Here's my "generic" recipe for constructing > > an Emacs service: > > > > (define* (emacs #:key (name 'server) > >                 (uid (getuid)) > >                 (gid (getgid))) > >   (make > >     #:provides (list > >                 (symbol-append 'emacs@ name)) > >     #:requires '() > >     #:start > >     (make-systemd-constructor > >      (list "emacs" "--fg-daemon") > >      (list (endpoint > >             (make-socket-address AF_UNIX > >                                  (format #f "/run/user/~d/emacs/~s" > >                                          uid name)) > >             #:socket-owner uid > >             #:socket-group gid))) > >     #:stop (make-systemd-destructor))) Addendum: This only worked, because I had the directory already created. For the directory to be created with the correct permissions, you need to add #:socket-directory-permissions #o700. > Fun!  Good to see this put to good use.  :-) > > > There appear to be some bugs, though.  If shepherd launches a > > process via systemd-constructor and it dies before claiming the > > socket, it will become a zombie. > > What do you mean by “claiming the socket”?  Do you have a log file > showing this, or at (better yet) a small reproducer?  You can use > ‘tests/systemd.sh’ as a starting point. Emacs without systemd support simply exits, because Shepherd owns the socket. I think a rather simple command that exits immediately or after sleep 5 ought to do the trick. > > Further, if the process dies after having claimed the socket, > > shepherd will not reset service's entry points and running value.  > > Both should be fixable in my opinion. > > The running value is changed as soon as the child process is started > by ‘make-systemd-constructor’, AFAICS.  But maybe I’m overlooking > something. Sure, but in neither case appears the dying process to be handled correctly. If shepherd doesn't check whether the service takes over, it might even be the same bug, but I didn't check if the correctly spawned emacs becomes a zombie. At the very least I'd argue it'd be cleaned up during manual service restart, which is needed to get your socket back. > Cheers