From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Riza Dindir Newsgroups: gmane.emacs.bugs Subject: bug#73101: Regarding a bug in suspend-emacs Date: Sat, 7 Sep 2024 16:34:45 +0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000069a5800621879863" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35478"; mail-complaints-to="usenet@ciao.gmane.io" To: 73101@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 07 16:44:38 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1smwg1-00093l-UQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Sep 2024 16:44:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smwfU-000276-VQ; Sat, 07 Sep 2024 10:44:04 -0400 Original-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 1smwfT-00026X-Jr for bug-gnu-emacs@gnu.org; Sat, 07 Sep 2024 10:44:03 -0400 Original-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 1smwfT-0003LU-AW for bug-gnu-emacs@gnu.org; Sat, 07 Sep 2024 10:44:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:MIME-Version:To:Subject; bh=qehAw3Op1dBR1EFeSlFrWXdkOdRRIOAqC43YQx5MmMg=; b=Rntp8sCZLYkcif8B2IPfk8yo2cs6nWr2zggmKA7WtzvDY8tVboSDqH4qxqFiHE4WJ+L8cz/Gdqupkrk5ilAvZQrS7eeMsWsWJs2MPI00XanZrPkrVJrhJc25IFIHarqWDjVIlDhW01DLs9eW5dtawc19xS7YVsv5yH9XT2VA4xH+ChhQE5h6KzDZxJkS25t9OGFdih9RVTzr1KVahHrvyRMEjuWB9dN0xiBBM0H8JdQHyubMfOkIhBKjJ4ZSPqSK9oSGJJW67EEPnRQTuXlbDuyCAj2n5GVlR/dvHzIagC8ODo5LS130jHfgJ1pxqfmbmX5bvtPABd0X3HXwBLIxKw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1smwfU-0000Ub-50 for bug-gnu-emacs@gnu.org; Sat, 07 Sep 2024 10:44:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Riza Dindir Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Sep 2024 14:44:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73101 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17257202201815 (code B ref -1); Sat, 07 Sep 2024 14:44:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Sep 2024 14:43:40 +0000 Original-Received: from localhost ([127.0.0.1]:57171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smwf5-0000T6-2N for submit@debbugs.gnu.org; Sat, 07 Sep 2024 10:43:39 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smvb4-0004h0-S5 for submit@debbugs.gnu.org; Sat, 07 Sep 2024 09:35:28 -0400 Original-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 1smvb3-0006cE-NB for bug-gnu-emacs@gnu.org; Sat, 07 Sep 2024 09:35:25 -0400 Original-Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smvb1-0004cf-Jy for bug-gnu-emacs@gnu.org; Sat, 07 Sep 2024 09:35:25 -0400 Original-Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-277dd69d6d6so2244648fac.0 for ; Sat, 07 Sep 2024 06:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725716122; x=1726320922; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=qehAw3Op1dBR1EFeSlFrWXdkOdRRIOAqC43YQx5MmMg=; b=bEib3jvFyyhuUAcus79uN8n+1gjwJENbng0RX76RFqCMfJnRXX53rKEXj+Mja76iav vBOmj722+Rccz7I8QVssnocGTgJjmReGJeBgnehVzmPKxl2PDvAFM/D27h276bAbwsh7 3I/2778PMOLCTQVnv1SyRnMwgpQFB8+tTxdPjJrcQ1SHD+IltvoTP3emW7CQQ7qbHciQ h1dmbMR042DxxoQT7NtSsTWmKb3USV01B5JI+y6yctk8mEfQUkFwrSnPssDFJOOW4iW7 mcG6lzBwmOSaKQwehalpDuQMsB83C3T+jUHVh4rUxBesbK2wY9gvEywKdaowFuzH23zq GKhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725716122; x=1726320922; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qehAw3Op1dBR1EFeSlFrWXdkOdRRIOAqC43YQx5MmMg=; b=WFevAJqYUMsAryWKhyIv97V6HeI3CUtLd5zw8mdxJ8kklEdkeqtRPJNR765kNqbEc5 xbeQ0Cke9lEz8ITenrKfr7OzdjRmB2ZslaT5dqNTRe+Q2OEKkxcAWRTO27GONTkS08QZ ZSiVxciCdunFhGeEz8RAJXp5vqJMBjsQEOIV0Y58zI8ZWwScX1JPJjk8JT36InopzrtH yASseJQj6r9s851WmcbnbldISx3XHR+zAivPm0myBXMXGH0znKY1l+g1Xs99UqtVboaJ k0tvKk1562nrjOgdzK0sXkimQHxSgfwoDQfv0u5N4fYcupscyC2DHZ7RCiViIUFnyyGQ iBIg== X-Gm-Message-State: AOJu0Yy3cTdYUcz47rapjrTghbTx5UWC2dF0ZSS73HZFDwpo3SX8nMFx TJll6aLJ5KUcy5BCsYFXFc8Wg9ry5KGRoIOMnaE4zCQEe0L0bIKPQQPZWdHwuMJUAXGAFNNfMKv WeffbkFWUkmZ/jEg8oL9Lp28dh9K7+f8m3nA= X-Google-Smtp-Source: AGHT+IHkSOTpvTnJfuMWwQb3IDVx0EQJi7F9kwvlrudJQg11tRImckVE7kwqWivAxB8FTNDMYnhaNY4oYcwLGH03yPw= X-Received: by 2002:a05:6870:65aa:b0:278:29f7:3225 with SMTP id 586e51a60fabf-27b824d378emr2571372fac.12.1725716121623; Sat, 07 Sep 2024 06:35:21 -0700 (PDT) Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=riza.dindir@gmail.com; helo=mail-oa1-x33.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 07 Sep 2024 10:43:33 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291391 Archived-At: --00000000000069a5800621879863 Content-Type: text/plain; charset="UTF-8" Hello Note: Sending this a second time, I forgot to confirm my request to register to the bug-gnu-emacs list. I am running Linux with kernel 6.6.47 and am running emacs in xterm, using the -nw command line argument. I am new to emacs and was experimenting with the suspend-emacs command. Following the example on https://www.gnu.org/software/emacs/manual/html_node/elisp/Suspending-Emacs.html . When following the example, I added the suspend-resume-hook to my .emacs.d/init.el file. When I run M-: (suspend-emacs "pwd") it does not show the current working directory. But when I do fg from the terminal that I got into, I see the "Resumed!" message. I asked in the libera chat about that, and also in the gnu-help-emacs list. I have been talking to wasamasa on libera chat (#emacs-beginners) and we pinpointed the problem to the stuff_char function (in https://git.savannah.gnu.org/cgit/emacs.git/tree/src/sysdep.c#n403). We came to this point from stuff_buffered_input ( https://git.savannah.gnu.org/cgit/emacs.git/tree/src/keyboard.c#n11963), and from suspend-emacs function definition (in https://git.savannah.gnu.org/cgit/emacs.git/tree/src/keyboard.c#n11908). The stuff_char function is using ioctl with TIOCSTI. TIOCSTI requires CAP_SYS_ADMIN capability. You can set this capability using sysctl setting dev.tty.legacy_tiocsti to 1. Unless I had set "dev.tty.legacy_tiocsti" to 1 I could not run the suspend-emacs command with an argument string. Either emacs can check the return value of ioctl in stuff_char and if there return value is EPERM, then handle this accordingly, with a message regarding the problem. Or the information relating to the kernel version and CAP_SYS_ADMIN can be added to the infor page os suspend_emacs, along with the information on how to set this capability using sysctl. Kind Regards Riza Dindir --00000000000069a5800621879863 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello

Note: Sending this a s= econd time, I forgot to confirm my request to register to the bug-gnu-emacs= list.

I am running Linux with kernel 6.6.47 a= nd am running emacs in xterm, using the -nw command line argument.

I am new to emacs and was experimenting with the suspe= nd-emacs command. Following the example on https://www.gnu.org/software/emacs/manual/html_node/elisp/Suspending-Ema= cs.html.

When following the example, I added t= he suspend-resume-hook to my .emacs.d/init.el file. When I run M-: (suspend-emacs "pwd") it does not show the current working directory. But when I do fg from=20 the terminal that I got into, I see the "Resumed!" message.
=

I asked in the libera chat about that, and also in the gnu-help-emacs=20 list. I have been talking to wasamasa on libera chat (#emacs-beginners)=20 and we pinpointed the problem to the stuff_char function (in https://git.savannah.gnu.org/cgit/emacs.git/tree/src/sysdep.c#n403<= /a>). We came to this point from stuff_buffered_input (https://git.savannah.gnu.org/cgit/emacs.git/tree/src/keyboard.c#n1196= 3), and from=C2=A0 suspend-emacs function definition (in https://git.savannah.gnu.org/cgit/emacs.git/tree/src/keyboard.c= #n11908).

The stuff_char function is using ioctl with TIOCSTI. TIOCSTI requires CAP_SYS_ADMIN capability. You can set this=20 capability using sysctl setting dev.tty.legacy_tiocsti to 1.

=
Unless I had set "dev.tty.legacy_tiocsti" to 1 I coul= d not run the suspend-emacs command with an argument string.

=
Either emacs can check the return value of ioctl in stuff_char and if there=20 return value is EPERM, then handle this accordingly, with a message=20 regarding the problem.

Or the information=20 relating to the kernel version and CAP_SYS_ADMIN can be added to the=20 infor page os suspend_emacs, along with the information on how to set=20 this capability using sysctl.

Kind Regards
Riza Dindir
--00000000000069a5800621879863--