From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id qPOMMbLDHmYIdgAA62LTzQ:P1 (envelope-from ) for ; Tue, 16 Apr 2024 20:30:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id qPOMMbLDHmYIdgAA62LTzQ (envelope-from ) for ; Tue, 16 Apr 2024 20:30:10 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=fabionatali.com header.s=gm1 header.b=VcoKj4Ho; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713292210; a=rsa-sha256; cv=none; b=Xuk4QmF6/YYcLVFXzABDjFHH+7x898lPPIEdG364YvbMQjYeJ/lM6FtdY2ppuj/AXua3m8 hOOeSU6+cseZSfy3tij24RKv8f5vVeTQ3SvdJSP3nD6NSP7my9uk9n8M8El/flwPzx4etk duyoLh1PNGZBmHybuM5bb3BDOL0DkamQq+roijXOs6sEt3d2g5QpzS7uH0X7oiuMxLhgmr M2U6wcAaKpUlVfQWX0whpIv3olzdB+Wj6aDx12uuqc1bjInCCmohQES+QzTnZNcpkmF55v mowSPm9oL7x+Q6bUVLDEBrE7fC0mmbCh3rkgoEd/NEJgJNhZ2csJq1Z+N0+Q4g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=fabionatali.com header.s=gm1 header.b=VcoKj4Ho; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713292210; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=yuBusvqZ4wHFzTxpP51udoUcr7SZw7+C6jvRQYXo/5w=; b=UQFD7Sz4ulE4FICclgOWlZRnWYpoRf1H7z5weW6Yv2vpeeMqDjMJAULPhURhKfBe/wYZ9R A2u1LMyqZRMdDy2LH7q5/TyI/4Acnybs4b2yNTH/CANGpbmh9edBj9BeI9GcgLIiCDvhkZ 9ZJtclIc4QtpCzg+tkxxlYZVnTEncy0jymEycAy3kSf928haLqBvE/AqiC6wiA+IWcBE79 pNZukgGy4GNBhbjNalyVNLOXnV+9Pp9RRMaJg1t3afO043zazsza/ZudcRpYUPRlC7wmNm xzYfPsqvtSPlRNHRHGkld0audCNKD4tEy53FbQtoMPxsebG0cXr2NHSIYxTIFA== 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 61E5770690 for ; Tue, 16 Apr 2024 20:30:10 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwnZ6-00078z-Aw; Tue, 16 Apr 2024 14:29:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwnZ3-00078l-Ln for guix-patches@gnu.org; Tue, 16 Apr 2024 14:29:53 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwnZ2-0008So-LD for guix-patches@gnu.org; Tue, 16 Apr 2024 14:29:53 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwnZE-0003gx-Sd for guix-patches@gnu.org; Tue, 16 Apr 2024 14:30:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#68289] [PATCH] services: xorg: Add xorg-start-command-xinit procedure. References: <4fdf0d9993bb3375797ca807d894f66920bd81d2.1704553618.git.~@wolfsden.cz> In-Reply-To: <4fdf0d9993bb3375797ca807d894f66920bd81d2.1704553618.git.~@wolfsden.cz> Resent-From: Fabio Natali Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 16 Apr 2024 18:30:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68289 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68289@debbugs.gnu.org, ~@wolfsden.cz Received: via spool by 68289-submit@debbugs.gnu.org id=B68289.171329217313989 (code B ref 68289); Tue, 16 Apr 2024 18:30:04 +0000 Received: (at 68289) by debbugs.gnu.org; 16 Apr 2024 18:29:33 +0000 Received: from localhost ([127.0.0.1]:45014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwnYh-0003d9-Ds for submit@debbugs.gnu.org; Tue, 16 Apr 2024 14:29:33 -0400 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]:33025) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwnYf-0003cJ-2I for 68289@debbugs.gnu.org; Tue, 16 Apr 2024 14:29:30 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id B0A01240002; Tue, 16 Apr 2024 18:29:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fabionatali.com; s=gm1; t=1713292149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yuBusvqZ4wHFzTxpP51udoUcr7SZw7+C6jvRQYXo/5w=; b=VcoKj4HoobckWBgcwpxUZxk/MrrRmvpCkOcgrFWs1RUgp+Y2cptCBbyqRaVFciOy5kUG/s HHJ8kiHt+2oPzSjsl4y79SWXSNw35iLTP0WxOLcqQZNrl2ZFtEUf8QTh21p0Q1aA7rGDSy kqxwhyWZWwab473pJzQC3bNIMKIAjcJpD2jCJhmUjNLw3ZQ26G28DetDnAxLr9WoCjIbTA ABsz5GFTdL5C6Awz8VAFi+nJBAPYWnHoKkm2box3XtLL32q/4HSuNR453MmGccROnCyJ2/ 7XaE4rZrPqeMUw3VxFhvPz47mZPuqo3/TpuDcdDwLPkBJ40mJ5GWFwiG7fuSXw== Date: Tue, 16 Apr 2024 19:29:09 +0100 Message-ID: <87o7a9upoq.fsf@fabionatali.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: me@fabionatali.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Fabio Natali X-ACL-Warn: , Fabio Natali via Guix-patches From: Fabio Natali via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -6.98 X-Migadu-Queue-Id: 61E5770690 X-Migadu-Spam-Score: -6.98 X-Migadu-Scanner: mx10.migadu.com X-TUID: 6NzleEqT1PtC Hi Tomas, Thanks for patch 68289 re `xorg-start-command-xinit'. I think it'd be great to have a command like that in Guix. In a clumsy attempt to review the patch, I've compared it with the code for `startx' that I found here=E2=81=B0. My comments, including some general observations that might help other reviewers, follow. tl;dr: - I hope someone more Xorg savvy than me can have a look. - Other than a couple of questions (below), things look alright to me. - I haven't tested the patch on my system yet, but I plan to do it soon. Thanks, have a great day, Fabio. =E2=81=B0 https://gitlab.freedesktop.org/xorg/app/xinit/-/blob/master/start= x.cpp `(determine-unused-display n)' maps closely to this code block: ,---- | XCOMM Automatically determine an unused $DISPLAY | d=3D0 | while true ; do | [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] || break | d=3D$(($d + 1)) | done | defaultdisplay=3D":$d" | unset d `---- `(determine-vty)' is similar to the block below, but `startx' relies on the `tty' command from Coreutils. Do you think there might be any advantage in using it in `(determine-vty)'? A slight simplification perhaps? ,---- | #ifdef __linux__ | XCOMM When starting the defaultserver start X on the current tty to a= void | XCOMM the startx session being seen as inactive: | XCOMM "https://bugzilla.redhat.com/show_bug.cgi?id=3D806491" | tty=3D$(tty) | if expr "$tty" : '/dev/tty[0-9][0-9]*$' > /dev/null; then | tty_num=3D$(echo "$tty" | grep -oE '[0-9]+$') | vtarg=3D"vt$tty_num -keeptty" | fi | #endif `---- `(enable-xauth server-auth-file display)' maps closely to: ,---- | XCOMM create a file with auth information for the server. ':0' is a d= ummy. | xserverauthfile=3D$HOME/.serverauth.$$ | trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM | xauth -q -f "$xserverauthfile" << EOF | add :$dummy . $mcookie | EOF | #if defined(__APPLE__) || defined(__CYGWIN__) | xserverauthfilequoted=3D$(echo ${xserverauthfile} | sed "s/'/'\\\\''/= g") | serverargs=3D${serverargs}" -auth '"${xserverauthfilequoted}"'" | #else | serverargs=3D${serverargs}" -auth "${xserverauthfile} | #endif | | XCOMM now add the same credentials to the client authority file | XCOMM if '$displayname' already exists do not overwrite it as another | XCOMM server may need it. Add them to the '$xserverauthfile' instead. | for displayname in $authdisplay $hostname$authdisplay; do | authcookie=3D`XAUTH list "$displayname" @@ | | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/= null; | if [ "z${authcookie}" =3D "z" ] ; then | XAUTH -q << EOF | add $displayname . $mcookie | EOF `---- The patch saves the server's auth file in `/tmp' whereas `startx' uses the home directory. I wonder if this might make any difference in terms of security. Related, how can we be sure that `(mkstemp "/tmp/serverauth.XXXXXX")' will be setting the right file permissions? Here's the two relevant bits: ,---- | (server-auth-port (mkstemp "/tmp/serverauth.XXXXXX")) | (server-auth-file (port-filename server-auth-port)) `---- ,---- | xserverauthfile=3D$HOME/.serverauth.$$ | trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM `---- Finally, on a purely cosmetic side, any reason to have `(define X (xorg-wrapper config))' outside the G-expression, while the other definitions are inside? --=20 Fabio Natali https://fabionatali.com