From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 30 13:21:38 2025 Received: (at submit) by debbugs.gnu.org; 30 Mar 2025 17:21:38 +0000 Received: from localhost ([127.0.0.1]:38007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tywLq-0006T8-7w for submit@debbugs.gnu.org; Sun, 30 Mar 2025 13:21:38 -0400 Received: from lists.gnu.org ([2001:470:142::17]:59378) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tywLn-0006Sn-1L for submit@debbugs.gnu.org; Sun, 30 Mar 2025 13:21:36 -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 1tywLg-0004RM-Bt for bug-gnu-emacs@gnu.org; Sun, 30 Mar 2025 13:21:28 -0400 Received: from mr4.vodafonemail.de ([145.253.228.164]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tywLb-0005DW-Mg for bug-gnu-emacs@gnu.org; Sun, 30 Mar 2025 13:21:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743355275; bh=p+3sHyTyJx69dqV8q1YDcXo9nWqO+FfiWbulv5wARx8=; h=Message-ID:Date:User-Agent:From:Content-Language:To:Subject: Content-Type:From; b=OVKk6esukpia2OuDSYaI0llv4bDSEL6l3wseQ789T15TDk9PBbT784KQescYdqPrQ zYuxCS05gP1EAJYjUMlWYBLpEsXhjFsyGF+LUYhOm6/BQPIttoEK2K5u1vMHRdFTgM wVuvP2n5lLipqAeHuLwAZTgNHiGrkyaV9o5KGCsU= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr4.vodafonemail.de (Postfix) with ESMTPS id 4ZQgyz36XWz1xyq for ; Sun, 30 Mar 2025 17:21:15 +0000 (UTC) Received: from [192.168.178.41] (port-92-196-202-44.dynamic.as20676.net [92.196.202.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZQgyv0kYrz92kF for ; Sun, 30 Mar 2025 17:21:03 +0000 (UTC) Message-ID: Date: Sun, 30 Mar 2025 19:20:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Jens Schmidt Content-Language: de-DE-frami, en-US To: bug-gnu-emacs@gnu.org Subject: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-server: smtpa02 X-purgate-type: clean X-purgate: clean X-purgate-size: 6136 X-purgate-ID: 155817::1743355271-2CED53B6-FC4D0BBD/0/0 Received-SPF: pass client-ip=145.253.228.164; envelope-from=jschmidt4gnu@vodafonemail.de; helo=mr4.vodafonemail.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [ Disclaimer: - This is one of my more exotic bug reports, so I won't argue (at least not much) if you close this as "won't fix". - In particular since an Emacs restart, added by Lars in 5be9a9ca, probably has only been meant to be used interactively. - But I do have a valid use case for a non-interactive restart, so I created this bug report ... ] Write the following to a file named test.el: ------------------------- test.el ------------------------- (message "%S:%S" noninteractive command-line-args) (when noninteractive (kill-emacs 0 t)) ------------------------- test.el ------------------------- Then execute that file with ./src/emacs -Q --script test.el I would expect that to inf-loop through the execvp from Fkill_emacs, but instead it prints t:("./src/emacs" "-scriptload" "test.el") to STDOUT and opens a GUI window with the message nil:("/home/jschmidt/work/emacs-master/src/emacs" "-scriptload" "test.el") in its mode line. Here is what I think happens (or at least a simplified version of it, which does not cover e.g. the sorting of command line arguments done by main): 1. The main function in emacs.c converts option "--script" to "-scriptload", setting the noninteractive flag while doing do: if (argmatch (argv, argc, "-script", "--script", 3, &junk, &skip_args)) { noninteractive = 1; /* Set batch mode. */ /* Convert --script to -scriptload, un-skip it, and sort again so that it will be handled in proper sequence. */ /* FIXME broken for --script=FILE - is that supposed to work? */ argv[skip_args - 1] = (char *) "-scriptload"; skip_args -= 2; sort_args (argc, argv); } 2. Later in main, function init_cmdargs stores away the modified argv containing "-scriptload" into initial_argv. 3. When Fkill_emacs gets called with non-nil second argument, it calls function execvp on initial_argv, which contains "-scriptload" instead of "--script". 4. Therefore the next Emacs execution does not process the snippet quoted under 1. above and, hence, does not set the noninteractive flag. As a work-around, one can put a "--batch" option before the "--script" option, then above repro inf-loops as expected (by me). Probably Fkill_emacs should call execvp not on the command line arguments in initial_argv, which already got modified by main, but on a copy of the *real* initial command line arguments as they have been passed into main? I have a patch to that effect, and it also lets above repro inf-loop as expected by me. Thanks as always for caring about exotic and non-exotic bugs and Emacs as a whole! In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0) of 2025-03-30 built on sappc2 Repository revision: a72cfc52cc36b8233969dafb202915d36c4c5a9e Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12201009 System Description: Debian GNU/Linux 12 (bookworm) Configured using: 'configure --with-native-compilation --with-mailutils' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM XRANDR GTK3 ZLIB Important settings: value of $LC_COLLATE: POSIX value of $LC_TIME: POSIX value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr compile comint ansi-osc ansi-color ring comp-run bytecomp byte-compile comp-common rx emacsbug lisp-mnt message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar make-network-process tty-child-frames native-compile emacs) Memory information: ((conses 16 57068 9506) (symbols 48 6816 0) (strings 32 16707 3815) (string-bytes 1 439863) (vectors 16 11584) (vector-slots 8 134675 5392) (floats 8 21 14) (intervals 56 249 0) (buffers 984 11)) From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 30 14:29:30 2025 Received: (at 77389) by debbugs.gnu.org; 30 Mar 2025 18:29:30 +0000 Received: from localhost ([127.0.0.1]:38070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyxPV-0001Yz-VO for submit@debbugs.gnu.org; Sun, 30 Mar 2025 14:29:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41294) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tyxPT-0001Ym-DE for 77389@debbugs.gnu.org; Sun, 30 Mar 2025 14:29:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tyxPM-0005BU-Sp; Sun, 30 Mar 2025 14:29:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uQFVgh+2h23v66dVvr18g8bJNrcWxg4TjYuPyjnXcK4=; b=V6wzK1JSlvLM gPWflA/hTqHrfJlI3uh/gi71p4Mh6rmhfx87aMIbbsv6rmYhPANgif1izy5tY3k5yBCkCc7SSgw/7 E8x6Z2UdVJ8ytbmdshwk1mI4o4qqB4894+pBXaYCy6nhyKemjeyhS9AYf3Vj7mEZJ2Eeb36brMpeP pbRVl+H8CCv5Mm0rwvxGol1UVPPLUjsqVWgT3OQzQ0x58iyPKgYP6Xe3wtX+0DwxKMFzw0uAgF2E1 xqu9t0kzQI5UsaX3ZPgnv//EowYbWldBv3DUfC6BTiotw+fxBZqZFfsmQN9fLteY8ZVQep1YNUUb7 0449646mqtD34rjNt643SA==; Date: Sun, 30 Mar 2025 21:29:16 +0300 Message-Id: <86plhy4bk3.fsf@gnu.org> From: Eli Zaretskii To: Jens Schmidt In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sun, 30 Mar 2025 19:20:58 +0200 > From: Jens Schmidt via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > [ Disclaimer: > > - This is one of my more exotic bug reports, so I won't argue > (at least not much) if you close this as "won't fix". > > - In particular since an Emacs restart, added by Lars in > 5be9a9ca, probably has only been meant to be used > interactively. > > - But I do have a valid use case for a non-interactive restart, > so I created this bug report ... ] Please describe your use case. > Probably Fkill_emacs should call execvp not on the command line > arguments in initial_argv, which already got modified by main, > but on a copy of the *real* initial command line arguments as > they have been passed into main? Yes. And on MS-Windows, it already does. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 01 16:53:12 2025 Received: (at 77389) by debbugs.gnu.org; 1 Apr 2025 20:53:12 +0000 Received: from localhost ([127.0.0.1]:51660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tzibf-0000Lv-DA for submit@debbugs.gnu.org; Tue, 01 Apr 2025 16:53:12 -0400 Received: from mr3.vodafonemail.de ([145.253.228.163]:43000) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tzibb-0000KK-Jw for 77389@debbugs.gnu.org; Tue, 01 Apr 2025 16:53:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743540781; bh=PD+argbe0HczZOU3TcPqIkpiU1NtZPP7dEvhmdG3354=; h=Content-Type:Message-ID:Date:User-Agent:From:Subject:To: References:Content-Language:In-Reply-To:From; b=wAqllaAt3lu33Lbuo4vThIlB37axpSgtq/jm4SltkEpND7SgUALdQFxnqaCpR+qug Rp11cWXd7hsIanVVRMcImydPuBZAukpG0sSGQH7lgeNFqBi+Vwlny08xrGT2lcG6Pk UreHyUBkUYhIJpCrbV/8RKST9qTcW8Fe0w2/h7lI= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr3.vodafonemail.de (Postfix) with ESMTPS id 4ZS0ZP60VTz2GNL; Tue, 1 Apr 2025 20:53:01 +0000 (UTC) Received: from [192.168.178.41] (port-83-236-2-10.dynamic.as20676.net [83.236.2.10]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZS0ZD708Cz8sXc; Tue, 1 Apr 2025 20:52:49 +0000 (UTC) Content-Type: multipart/mixed; boundary="------------0hL0amVHrzdF8dnCZaC3w9I0" Message-ID: <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> Date: Tue, 1 Apr 2025 22:52:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Jens Schmidt Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity To: Eli Zaretskii References: <86plhy4bk3.fsf@gnu.org> Content-Language: de-DE-frami, en-US In-Reply-To: <86plhy4bk3.fsf@gnu.org> X-purgate-server: smtpa05 X-purgate-type: clean X-purgate: clean X-purgate-size: 7197 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------0hL0amVHrzdF8dnCZaC3w9I0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2025-03-30 20:29, Eli Zaretskii wrote: >> Date: Sun, 30 Mar 2025 19:20:58 +0200 >> From: Jens Schmidt via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> [ Disclaimer: >> >> - This is one of my more exotic bug reports, so I won't argue >> (at least not much) if you close this as "won't fix". >> >> - In particular since an Emacs restart, added by Lars in >> 5be9a9ca, probably has only been meant to be used >> interactively. >> >> - But I do have a valid use case for a non-interactive restart, >> so I created this bug report ... ] > > Please describe your use case. TL;DR: 1. Start foo.el in batch mode with "emacs --script foo.el". 2. foo.el reads the user init file and writes a modified copy of it to init-new.el. 3. Then foo.el calls (kill-emacs ... t), thus restarting itself, (hopefully) still in batch mode. 4. The newly started foo.el senses the presence of init-new.el and, hence, processes that in a final step. In the above it is important that steps 2 and 4 are executed from different, newly started Emacs processes which share STDOUT and STDERR. The bigger picture is my package bc-dot-emacs.el bc-dot-emacs.el --- Check Emacs init file syntax https://git.sr.ht/~jschmidt/bc-dot-emacs which I sooner or later wanted to present on emacs-devel for inclusion to ELPA. >> Probably Fkill_emacs should call execvp not on the command line >> arguments in initial_argv, which already got modified by main, >> but on a copy of the *real* initial command line arguments as >> they have been passed into main? > > Yes. And on MS-Windows, it already does. Indeed, I missed that bit. The only other non-Posix case seems to be Android, which a) IIRC does not support non-interactive operation and b) restarts Emacs with some mechanism in Java-land that does not require Emacs itself to keep a copy of the initial arguments. So this leaves the Posix/execvp case, I think, which I hope to have covered in the attached patch. The only thing that bothers me a bit is that there is the following memory-related initialization being executed in main *after* copy_raw_args (or also the present sort_args) have already been allocating memory: #if !defined SYSTEM_MALLOC /* Arrange to get warning messages as memory fills up. */ memory_warnings (0, malloc_warning); /* Call malloc at least once, to run malloc_initialize_hook. Also call realloc and free for consistency. */ free (realloc (malloc (4), 4)); #endif /* not SYSTEM_MALLOC */ Thanks. --------------0hL0amVHrzdF8dnCZaC3w9I0 Content-Type: text/x-patch; charset=UTF-8; name="0001-Use-raw-argv-as-passed-into-main-to-restart-Emacs.patch" Content-Disposition: attachment; filename*0="0001-Use-raw-argv-as-passed-into-main-to-restart-Emacs.patch" Content-Transfer-Encoding: base64 RnJvbSA4ZjQwODUzMjdiOTA0ZmY5Nzc1OGI0OWM5MTkxODljZDRlN2ZhZTRmIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKZW5zIFNjaG1pZHQgPGpzY2htaWR0NGdudUB2b2Rh Zm9uZW1haWwuZGU+CkRhdGU6IFR1ZSwgMSBBcHIgMjAyNSAyMjoxNjo1NiArMDIwMApT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LCAwLCAyLCAiUCIsCiAjaWZkZWYgV0lORE9XU05UCiAg ICAgICBpZiAodzMyX3JlZXhlY19lbWFjcyAoaW5pdGlhbF9jbWRsaW5lLCBpbml0aWFsX3dk KSA8IDApCiAjZWxzZQotICAgICAgaW5pdGlhbF9hcmd2WzBdID0gaW5pdGlhbF9lbWFjc19l eGVjdXRhYmxlOwotICAgICAgaWYgKGV4ZWN2cCAoKmluaXRpYWxfYXJndiwgaW5pdGlhbF9h cmd2KSA8IDEpCisgICAgICByYXdfaW5pdGlhbF9hcmd2WzBdID0gaW5pdGlhbF9lbWFjc19l eGVjdXRhYmxlOworICAgICAgaWYgKGV4ZWN2cCAoKnJhd19pbml0aWFsX2FyZ3YsIHJhd19p bml0aWFsX2FyZ3YpIDwgMSkKICNlbmRpZgogCWVtYWNzX3BlcnJvciAoIlVuYWJsZSB0byBy ZS1leGVjdXRlIEVtYWNzIik7CiAgICAgfQotLSAKMi4zOS41Cgo= --------------0hL0amVHrzdF8dnCZaC3w9I0-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 02 07:43:58 2025 Received: (at 77389) by debbugs.gnu.org; 2 Apr 2025 11:43:58 +0000 Received: from localhost ([127.0.0.1]:55602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tzwVh-0003FQ-P2 for submit@debbugs.gnu.org; Wed, 02 Apr 2025 07:43:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47522) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tzwVf-0003EL-0M for 77389@debbugs.gnu.org; Wed, 02 Apr 2025 07:43:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzwVY-00068k-MI; Wed, 02 Apr 2025 07:43:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=28Pp6VVX8yonHu6n/NOHcAbxgF/DBpEtg/R5dzIe83w=; b=UIAQaeiF/DFn V7DbDa+xplyfW1Up/EU0z5MJs1U3CsUMgV/BWYy6hFIWWwGeTYxYY0WbQ3KqQRq+2D8wYA4RcvHW4 byTp07RuSDqp2aQTfPvYruVrE/zv9gSsDSMT8VRgX7VW8kBuZI4REiRofEbfml9bZ9FcZVjUiZHev L3FjINuaQtWHgqS+odcK1El2580R79qWiwAQeCR8eDXpt1YI28f4k50/EiQvsIr5QYDvu12go5NS7 W/ZkamJJjqMh8BUqFIg1SpUD1Y4HssfeV13KCFoYPllU+2MxVAHARedFK997OJXwkZM7EfRL/GNRi cqGR/Y/oknfjkN64xrsY8A==; Date: Wed, 02 Apr 2025 14:43:47 +0300 Message-Id: <86v7rm23gs.fsf@gnu.org> From: Eli Zaretskii To: Jens Schmidt In-Reply-To: <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> (message from Jens Schmidt on Tue, 1 Apr 2025 22:52:48 +0200) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Tue, 1 Apr 2025 22:52:48 +0200 > From: Jens Schmidt > Cc: 77389@debbugs.gnu.org > > >> - But I do have a valid use case for a non-interactive restart, > >> so I created this bug report ... ] > > > > Please describe your use case. > > TL;DR: > > 1. Start foo.el in batch mode with "emacs --script foo.el". > 2. foo.el reads the user init file and writes a modified copy of > it to init-new.el. > 3. Then foo.el calls (kill-emacs ... t), thus restarting itself, > (hopefully) still in batch mode. > 4. The newly started foo.el senses the presence of init-new.el > and, hence, processes that in a final step. > > In the above it is important that steps 2 and 4 are executed > from different, newly started Emacs processes which share STDOUT > and STDERR. Why do you need to write Lisp to a file, only to have that file read and executed? why not simply execute that Lisp directly in the original session? > The only thing that bothers me a bit is that there is the following > memory-related initialization being executed in main *after* > copy_raw_args (or also the present sort_args) have already been > allocating memory: Why does this bother you? The old session is going down, and the new one will re-execute that part anew, no? What did I miss? From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 02 16:54:44 2025 Received: (at 77389) by debbugs.gnu.org; 2 Apr 2025 20:54:44 +0000 Received: from localhost ([127.0.0.1]:59746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u056i-0002eV-8Z for submit@debbugs.gnu.org; Wed, 02 Apr 2025 16:54:44 -0400 Received: from mr4.vodafonemail.de ([145.253.228.164]:39782) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u056f-0002eD-MW for 77389@debbugs.gnu.org; Wed, 02 Apr 2025 16:54:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743627275; bh=AKtWR9oODgJSD3QR2zJHSLV4G+aQhUDppREAB2t6LpQ=; h=Message-ID:Date:User-Agent:Subject:To:References:From: Content-Language:In-Reply-To:Content-Type:From; b=wOtmhy8WUoWt2JQWv1LI+G/R8n6os+eF73G5a41nVhMgK5PMw/VE26Dtsa8tphDSY XNOX5m9PyQdfBKHbESG6qb8GJXKjHLLIDe42z1AUkskCQLnS2zjKQhxJYZKxOTYWOf JzKFZdoOrL8H8Ndv57Ovi10oZaHtePFBbJajte8s= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr4.vodafonemail.de (Postfix) with ESMTPS id 4ZScYl0zSYz1ySQ; Wed, 2 Apr 2025 20:54:35 +0000 (UTC) Received: from [192.168.178.41] (port-92-199-223-169.dynamic.as20676.net [92.199.223.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZScYb2YM9z904r; Wed, 2 Apr 2025 20:54:24 +0000 (UTC) Message-ID: Date: Wed, 2 Apr 2025 22:54:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity To: Eli Zaretskii References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> From: Jens Schmidt Content-Language: de-DE-frami, en-US In-Reply-To: <86v7rm23gs.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-server: smtpa03 X-purgate-type: clean X-purgate: clean X-purgate-size: 2804 X-purgate-ID: 155817::1743627270-C170693B-0753155C/0/0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2025-04-02 13:43, Eli Zaretskii wrote: >>> Please describe your use case. >> >> TL;DR: >> >> 1. Start foo.el in batch mode with "emacs --script foo.el". >> 2. foo.el reads the user init file and writes a modified copy of >> it to init-new.el. >> 3. Then foo.el calls (kill-emacs ... t), thus restarting itself, >> (hopefully) still in batch mode. >> 4. The newly started foo.el senses the presence of init-new.el >> and, hence, processes that in a final step. >> >> In the above it is important that steps 2 and 4 are executed >> from different, newly started Emacs processes which share STDOUT >> and STDERR. > > Why do you need to write Lisp to a file, only to have that file read > and executed? why not simply execute that Lisp directly in the > original session? Because the state of the original session (most notably the loaded features) influences (and gets influenced by) that Lisp. As a minimal reproducer, consider ~/test.el as: ----- ~/test.el ----- ;; -*- lexical-binding: t -*- (gnus-message "foo") ----- ~/test.el ----- Now the Lisp I want to execute in above foo.el is, grossly simplified, (byte-compile-file "~/test.el"). And the result of that depends on whether gnus-utils has been loaded in the calling Emacs session or not. >> The only thing that bothers me a bit is that there is the following >> memory-related initialization being executed in main *after* >> copy_raw_args (or also the present sort_args) have already been >> allocating memory: > > Why does this bother you? The old session is going down, and the new > one will re-execute that part anew, no? What did I miss? I'm not talking about old or new session here. What bothers me is also independent of this bug, I just came across it while staring at the surrounding code. Namely at the comment in this block: /* Call malloc at least once, to run malloc_initialize_hook. Also call realloc and free for consistency. */ free (realloc (malloc (4), 4)); This sounds like this is initialization that better should be executed *before* any actual call to malloc is done. Which is currently not the case, since, for example, sort_args can call (x)malloc and sort_args is called before the block quoted above. But then I do not really understand what that block is about and my concerns may be completely unsubstantiated. But back to my patch: I did a cursory grep for initial_arg[cv] through current master. From the results I got the impression that instead of setting up a second copy raw_initial_arg[cv] like done in the first patch, one could also try to directly use initial_arg[cv], like in the attached alternative patch. Should I go that route instead or would that be too risky, anyway? Thanks! From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 02 17:21:00 2025 Received: (at 77389) by debbugs.gnu.org; 2 Apr 2025 21:21:01 +0000 Received: from localhost ([127.0.0.1]:59784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u05W8-0003td-I8 for submit@debbugs.gnu.org; Wed, 02 Apr 2025 17:21:00 -0400 Received: from mr6.vodafonemail.de ([145.253.228.166]:33484) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u05W5-0003tI-6V for 77389@debbugs.gnu.org; Wed, 02 Apr 2025 17:20:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743628851; bh=1JXsECNkAnUxqtO8yTKXuyvCLlpfrJ9yzIOE+bx0G+Q=; h=Content-Type:Message-ID:Date:User-Agent:Subject:From:To: References:Content-Language:In-Reply-To:From; b=vR5mg9jNNhTKzophBLI5zFuJfKbLZGOTYbdYCSEbfptsMO2iczU+ypyEffVux+8DI S/9mgh733eOAfL9yQvZrX8Ym7164MuCXIdJ2Jkk7/RPFsXGNNjD2DxJb4EweEoPmrm fCCffHdjvS45IN1Ao1iZDxfdQlph+oC3eZy7eZxE= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr6.vodafonemail.de (Postfix) with ESMTPS id 4ZSd820Yszz1y2T; Wed, 2 Apr 2025 21:20:49 +0000 (UTC) Received: from [192.168.178.41] (port-92-199-223-169.dynamic.as20676.net [92.199.223.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZSd7s2c4Rz9rw0; Wed, 2 Apr 2025 21:20:38 +0000 (UTC) Content-Type: multipart/mixed; boundary="------------3WQslEwRKf42XS0J4Kaj3TDb" Message-ID: Date: Wed, 2 Apr 2025 23:20:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity From: Jens Schmidt To: Eli Zaretskii References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> Content-Language: de-DE-frami, en-US In-Reply-To: X-purgate-server: smtpa01 X-purgate-type: clean X-purgate: clean X-purgate-size: 3248 X-purgate-ID: 155817::1743628844-430B9EA9-DEC91254/0/0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------3WQslEwRKf42XS0J4Kaj3TDb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Forgot to attach the alternative patch, sorry. --------------3WQslEwRKf42XS0J4Kaj3TDb Content-Type: text/x-patch; charset=UTF-8; name="0001-Use-raw-argv-as-passed-into-main-to-restart-Emacs-alternative.patch" Content-Disposition: attachment; filename*0="0001-Use-raw-argv-as-passed-into-main-to-restart-Emacs-alter"; filename*1="native.patch" Content-Transfer-Encoding: base64 RnJvbSA3MDQxNDk2N2M2MDMwNTIwZjk1MzVjNDQ2NjcyZDhiYTZhNzJlNDlhIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKZW5zIFNjaG1pZHQgPGpzY2htaWR0NGdudUB2b2Rh Zm9uZW1haWwuZGU+CkRhdGU6IFdlZCwgMiBBcHIgMjAyNSAyMjo0ODozMSArMDIwMApTdWJq ZWN0OiBbUEFUQ0hdIFVzZSByYXcgYXJndiBhcyBwYXNzZWQgaW50byBtYWluIHRvIHJlc3Rh cnQgRW1hY3MKCi0tLQogc3JjL2VtYWNz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GNvbWUgZmlyc3QuCiAgICBEbyBub3QgY2hhbmdlIHRoZSBvcmRl ciBvZiBlbGVtZW50cyBvZiBlcXVhbCBwcmlvcml0eS4KLS0gCjIuMzkuNQoK --------------3WQslEwRKf42XS0J4Kaj3TDb-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 03 01:11:03 2025 Received: (at 77389) by debbugs.gnu.org; 3 Apr 2025 05:11:03 +0000 Received: from localhost ([127.0.0.1]:60420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0Cr1-0005p6-DC for submit@debbugs.gnu.org; Thu, 03 Apr 2025 01:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33444) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0Cqx-0005oY-SP for 77389@debbugs.gnu.org; Thu, 03 Apr 2025 01:11:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u0Cqp-0001Gj-W5; Thu, 03 Apr 2025 01:10:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kUrhVN1v7A6GxfAWmb9GyLFSslst6eaC6NHmQ/lmJQU=; b=Apa3V/uKSkoe P7erJhkmoaGay84RJaDGhQRlFS94xbK/A2wqdrMZa6/ToF/568KyarcCbOJ5vxZmHieShnYAiDJyx zRs16OOvmRfln/TKhtavD1GpIrPasUHUDD4yG2m924AEcVijzJkTHSAgKtHv2WhMth5NeHYSTsccm 3D0eVqLzAX+5MMjnSV92bpVsCDSkLlJK/1vs+rYRlBuPkD/UdVRYJH2mNckEkgvXk39BeokEyBCiw /n2e4S6fAQdHi2mKKFKYPFPfpWtQ8me7ZmgpEYyk/rgkVSBrONEmBOvuzPzoxvZzpbe1gq69cD6Vy 8T0j3j3YdhS5EwM6dWszpg==; Date: Thu, 03 Apr 2025 08:10:48 +0300 Message-Id: <864iz525k7.fsf@gnu.org> From: Eli Zaretskii To: Jens Schmidt In-Reply-To: (message from Jens Schmidt on Wed, 2 Apr 2025 22:54:23 +0200) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 2 Apr 2025 22:54:23 +0200 > Cc: 77389@debbugs.gnu.org > From: Jens Schmidt > > > Why do you need to write Lisp to a file, only to have that file read > > and executed? why not simply execute that Lisp directly in the > > original session? > > Because the state of the original session (most notably the loaded > features) influences (and gets influenced by) that Lisp. I know the theory, but why is it a problem in practice? We bump into this issue every day, because doing stuff from an Emacs session that runs for some time will always produce results that depend on what happened in that session beforehand. If you really do need to do something in a pristine Emacs, do that in a separate sub-process, then read the results. That's what we do with native-compilation, for example. > >> The only thing that bothers me a bit is that there is the following > >> memory-related initialization being executed in main *after* > >> copy_raw_args (or also the present sort_args) have already been > >> allocating memory: > > > > Why does this bother you? The old session is going down, and the new > > one will re-execute that part anew, no? What did I miss? > > I'm not talking about old or new session here. What bothers me is > also independent of this bug, I just came across it while staring at > the surrounding code. Namely at the comment in this block: > > /* Call malloc at least once, to run malloc_initialize_hook. > Also call realloc and free for consistency. */ > free (realloc (malloc (4), 4)); > > This sounds like this is initialization that better should be > executed *before* any actual call to malloc is done. Which is > currently not the case, since, for example, sort_args can call > (x)malloc and sort_args is called before the block quoted above. > But then I do not really understand what that block is about and > my concerns may be completely unsubstantiated. Yes, we call heap allocation functions before that, so you don't need to worry about that. The purpose of that line is not to initialize malloc, it's something else. > But back to my patch: I did a cursory grep for initial_arg[cv] > through current master. From the results I got the impression > that instead of setting up a second copy raw_initial_arg[cv] > like done in the first patch, one could also try to directly > use initial_arg[cv], like in the attached alternative patch. > Should I go that route instead or would that be too risky, > anyway? That's a possibility, but please make all this copy_raw_args and its calls #ifdef'ed away on WINDOWSNT, since we already do something like that there, just better. Also, these additions need comments to explain why we do this. From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 03 15:52:57 2025 Received: (at 77389) by debbugs.gnu.org; 3 Apr 2025 19:52:57 +0000 Received: from localhost ([127.0.0.1]:35809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0QcT-0006k1-BG for submit@debbugs.gnu.org; Thu, 03 Apr 2025 15:52:57 -0400 Received: from mr3.vodafonemail.de ([145.253.228.163]:32832) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0QcQ-0006jk-Sr for 77389@debbugs.gnu.org; Thu, 03 Apr 2025 15:52:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743709969; bh=1ArwmC05AtImk2VG2eb+own0bJqnM+bUEcrvwX1Pt7Q=; h=Message-ID:Date:User-Agent:Subject:To:References:From: Content-Language:In-Reply-To:Content-Type:From; b=PDkT4BILRlTjRD0g+YK+d4UUkftUWyaeCXu2TO5eKBYCvqKZZ6mJBuKTocSxjmels L+CFHbj/k52CfBVCId76b8mz6usifwl/ePGWNxEdCrQBohIvoWEV5/qnEP1yLDMApk aUKPDDrITIRlOB23hd4vDPyNoHs+xmaCI0IYqqoU= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr3.vodafonemail.de (Postfix) with ESMTPS id 4ZTC810WkMz2G6R; Thu, 3 Apr 2025 19:52:48 +0000 (UTC) Received: from [192.168.178.41] (port-83-236-3-244.dynamic.as20676.net [83.236.3.244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZTC7n44KMz92kF; Thu, 3 Apr 2025 19:52:34 +0000 (UTC) Message-ID: <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> Date: Thu, 3 Apr 2025 21:52:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity To: Eli Zaretskii References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> From: Jens Schmidt Content-Language: de-DE-frami, en-US In-Reply-To: <864iz525k7.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-server: smtpa02 X-purgate-type: clean X-purgate: clean X-purgate-size: 2664 X-purgate-ID: 155817::1743709964-84DF3064-DE182017/0/0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2025-04-03 07:10, Eli Zaretskii wrote: >> Date: Wed, 2 Apr 2025 22:54:23 +0200 >> Cc: 77389@debbugs.gnu.org >> From: Jens Schmidt >> >>> Why do you need to write Lisp to a file, only to have that file read >>> and executed? why not simply execute that Lisp directly in the >>> original session? >> >> Because the state of the original session (most notably the loaded >> features) influences (and gets influenced by) that Lisp. > > If you really do need to do something in a pristine Emacs, do that in > a separate sub-process, then read the results. That's what we do with > native-compilation, for example. Thanks for the discussion, now we are basically at the point where I failed to see a straightforward solution further on and resorted to `(kill-emacs ... t)'. Because: The driving Elisp (foo.el) is only ever to be called as a script. If I wanted to spawn a pristine and equally non-interactive Emacs session from foo.el and present its STDOUT and STDERR together with that of foo.el, then I would need to do so through an async process, right? With all the effort of setting up a sentinel and a filter just to forward the child Emacs's STDOUT and STDERR to, well, STDOUT. Given the effort described above simply calling `kill-process' plus a bit of recursion control seemed the better or at least easier solution to transfer control to a pristine Emacs process. >> But back to my patch: I did a cursory grep for initial_arg[cv] >> through current master. From the results I got the impression >> that instead of setting up a second copy raw_initial_arg[cv] >> like done in the first patch, one could also try to directly >> use initial_arg[cv], like in the attached alternative patch. >> Should I go that route instead or would that be too risky, >> anyway? > > That's a possibility, but please make all this copy_raw_args and its > calls #ifdef'ed away on WINDOWSNT, since we already do something like > that there, just better. Also, these additions need comments to > explain why we do this. Agreed. I checked the grep results in more detail, resulting in the following follow-up questions: - I guess the following files all don't get compiled on Windows and any references to initial_arg[vc] can be safely ignored in these: src/nsterm.m, src/xterm.c, src/xsmfns.c, src/pgtkterm.c - sysdep.c refers to initial_argv[0] in function emacs_perror and it seems it does so for Windows as well. What should I do about that one? Use simply constant "emacs"? Or the result of w32_my_exename (plus any required coding system conversion)? From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 04 06:46:11 2025 Received: (at 77389) by debbugs.gnu.org; 4 Apr 2025 10:46:11 +0000 Received: from localhost ([127.0.0.1]:37188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0eYt-0003Sc-EB for submit@debbugs.gnu.org; Fri, 04 Apr 2025 06:46:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57304) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0eYq-0003SJ-Sg for 77389@debbugs.gnu.org; Fri, 04 Apr 2025 06:46:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u0eYk-0006mo-VZ; Fri, 04 Apr 2025 06:46:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=B+/rAOWnW82BK+uDYibZoBRZv0WBP/m3MuMdZkQ16sE=; b=fChxpGFeoEIk CLTs1O972GzgkWtZdm+GlNcARM9OTF1cd2j8ade5sTjAPK4tyR8Cz8yeG4EKZWPpU2MmrXEizKaZt K9V3RlfP15TDrozEtZ5eYhaoIJ6CteX7FwkHOkW3ZvoftXz/DwvBMFFlRhDS5Zj60AZk9S3s9Lw1P WywclGsUbxgdzMD1qyCaKSeb+GePCUVloTu7/vtkOsZh5QMK3ZoSJKjJ9elPZZEs1epwIGGbOTfoR u9ll4H3zDPG7327v3UH1FsKK8iua0OMeg08wK9aDaeS4GlrpJwjlUZn8HStHUcpFuvmnYqvem5eAI EWeIFh0NDTTnJ3SfNv8eSA==; Date: Fri, 04 Apr 2025 13:46:00 +0300 Message-Id: <8634eoyzkn.fsf@gnu.org> From: Eli Zaretskii To: Jens Schmidt In-Reply-To: <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> (message from Jens Schmidt on Thu, 3 Apr 2025 21:52:33 +0200) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 3 Apr 2025 21:52:33 +0200 > Cc: 77389@debbugs.gnu.org > From: Jens Schmidt > > - I guess the following files all don't get compiled on Windows > and any references to initial_arg[vc] can be safely ignored in > these: src/nsterm.m, src/xterm.c, src/xsmfns.c, src/pgtkterm.c Yes. > - sysdep.c refers to initial_argv[0] in function emacs_perror > and it seems it does so for Windows as well. What should I > do about that one? Use simply constant "emacs"? Or the > result of w32_my_exename (plus any required coding system > conversion)? Why does this matter? Your patch doesn't eliminate initial_argv, so initial_argv[0] still holds the name of the Emacs program, albeit only in the form it was provided by the calling shell. Right? If so, then for reporting errors (and ones that should never happen at that), I don't see any need to jump through hoops. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 04 15:54:40 2025 Received: (at 77389) by debbugs.gnu.org; 4 Apr 2025 19:54:41 +0000 Received: from localhost ([127.0.0.1]:40253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0n7g-0003vZ-He for submit@debbugs.gnu.org; Fri, 04 Apr 2025 15:54:40 -0400 Received: from mr3.vodafonemail.de ([145.253.228.163]:47490) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0n7e-0003vI-H7 for 77389@debbugs.gnu.org; Fri, 04 Apr 2025 15:54:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743796472; bh=9uyZIhIF44dnKDjvbLvPCYUuRrlJF//uPyrdENnjp6I=; h=Message-ID:Date:User-Agent:Subject:To:References:From: Content-Language:In-Reply-To:Content-Type:From; b=Y5C+eOmsbesprQ8RqDW/oRtnBbsnxTB8XEp3XQXCsiAXYrbJEHLCtR6+WiIk8OhNM mKZ1L25ZuoCCMBXTuYP7k64SlvKWOgIax/Gxvp9T3jDGOanfRt8qHo2L+fuP2bMXVQ ArtkWVEdc0c85pRocMx6kEmjWjuqfn93HPKoZN0Y= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr3.vodafonemail.de (Postfix) with ESMTPS id 4ZTq7X50Yzz2GHq; Fri, 4 Apr 2025 19:54:28 +0000 (UTC) Received: from [192.168.178.41] (port-92-199-134-38.dynamic.as20676.net [92.199.134.38]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZTq7K0bSCz918d; Fri, 4 Apr 2025 19:54:17 +0000 (UTC) Message-ID: <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> Date: Fri, 4 Apr 2025 21:54:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity To: Eli Zaretskii References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> <8634eoyzkn.fsf@gnu.org> From: Jens Schmidt Content-Language: de-DE-frami, en-US In-Reply-To: <8634eoyzkn.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-server: smtpa02 X-purgate-type: clean X-purgate: clean X-purgate-size: 1045 X-purgate-ID: 155817::1743796464-59CC3CA9-1B17E344/0/0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2025-04-04 12:46, Eli Zaretskii wrote: >> - sysdep.c refers to initial_argv[0] in function emacs_perror >> and it seems it does so for Windows as well. What should I >> do about that one? Use simply constant "emacs"? Or the >> result of w32_my_exename (plus any required coding system >> conversion)? > > Why does this matter? Your patch doesn't eliminate initial_argv, so > initial_argv[0] still holds the name of the Emacs program, albeit only > in the form it was provided by the calling shell. Right? If so, then > for reporting errors (and ones that should never happen at that), I > don't see any need to jump through hoops. But my patch, at least the second one [1] on message #20 of this bug, plus your earlier request to #ifdef away function and call to copy_raw_args on Windows, would skip the initialization of initial_argv on Windows, no? [1]: https://debbugs.gnu.org/cgi/bugreport.cgi?att=1;bug=77389;filename=0001-Use-raw-argv-as-passed-into-main-to-restart-Emacs-alternative.patch;msg=20 From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 05 02:46:56 2025 Received: (at 77389) by debbugs.gnu.org; 5 Apr 2025 06:46:56 +0000 Received: from localhost ([127.0.0.1]:41276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0xIu-0008Nw-2j for submit@debbugs.gnu.org; Sat, 05 Apr 2025 02:46:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44152) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0xIq-0008Nf-Gh for 77389@debbugs.gnu.org; Sat, 05 Apr 2025 02:46:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u0xIi-0004LH-Cy; Sat, 05 Apr 2025 02:46:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=WvzoqhOCwZywosnWWnTKZCqtryOM3dscCai0sBD1EDg=; b=A+mDGtr8+m1M q7P26edQwceABEnTakNRThSka3OdHPzft45Qw+8LvGK7pB10OAieDJWOuiGbT7vEwn3F3Qr+dnof/ 9y0FW/V865tgO7fU4VkO50Pz5vAJZo5lEfjrWDK443O3ZZj4zmO8bYZl3JxsjFqBzTI9AyuFC3c9k LhXaCpkPhj0U5l2/NmMD4PlK98erJ4akJB5f2VeFmGPCLxDvq2pcSPpyXcF4Myp0xX/zp3bppUMhZ WzeyjL/5n1YI/fLVvsgm8bNNgeQqzBkcHpVDCyIAOeZkH3eFyovRe7PIUheF9wgHzlXPpimwPHSL2 S0L3HH15gLQQS6cFFUIr9A==; Date: Sat, 05 Apr 2025 09:46:38 +0300 Message-Id: <86plhrxfzl.fsf@gnu.org> From: Eli Zaretskii To: Jens Schmidt In-Reply-To: <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> (message from Jens Schmidt on Fri, 4 Apr 2025 21:54:16 +0200) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> <8634eoyzkn.fsf@gnu.org> <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 4 Apr 2025 21:54:16 +0200 > Cc: 77389@debbugs.gnu.org > From: Jens Schmidt > > On 2025-04-04 12:46, Eli Zaretskii wrote: > > >> - sysdep.c refers to initial_argv[0] in function emacs_perror > >> and it seems it does so for Windows as well. What should I > >> do about that one? Use simply constant "emacs"? Or the > >> result of w32_my_exename (plus any required coding system > >> conversion)? > > > > Why does this matter? Your patch doesn't eliminate initial_argv, so > > initial_argv[0] still holds the name of the Emacs program, albeit only > > in the form it was provided by the calling shell. Right? If so, then > > for reporting errors (and ones that should never happen at that), I > > don't see any need to jump through hoops. > > But my patch, at least the second one [1] on message #20 > of this bug, plus your earlier request to #ifdef away > function and call to copy_raw_args on Windows, would skip > the initialization of initial_argv on Windows, no? Ah, I've missed that part. Then the call to 'error' could just use argv[0] instead of initial_argv[0], right? From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 05 08:44:36 2025 Received: (at 77389) by debbugs.gnu.org; 5 Apr 2025 12:44:36 +0000 Received: from localhost ([127.0.0.1]:41914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u12t1-0002kl-Qc for submit@debbugs.gnu.org; Sat, 05 Apr 2025 08:44:36 -0400 Received: from mr6.vodafonemail.de ([145.253.228.166]:48738) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u12sy-0002kT-Rk for 77389@debbugs.gnu.org; Sat, 05 Apr 2025 08:44:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743857066; bh=uxWKRQUkFL+4evIEhzk2lQ7fXGRmmA4KdP7UnXqvH7I=; h=Content-Type:Message-ID:Date:User-Agent:Subject:To:References: From:Content-Language:In-Reply-To:From; b=rilflNu6APBuBJb3dBossWMqvC/jTZgldjI3RK1vs1kiGDS86nS/G6Lv5gBzVeaJn AwiEOOLCdvKGcXTk5KJ/SOETTTqSebS/pI6cpU93BG9C9nF26Ok5AwecANFAs5D5GY kicjTZHLriKbYi6bvlcszH9fstuB6uycRh2v5N7w= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr6.vodafonemail.de (Postfix) with ESMTPS id 4ZVFXn410sz1yCh; Sat, 5 Apr 2025 12:44:24 +0000 (UTC) Received: from [192.168.178.41] (port-83-236-12-216.dynamic.as20676.net [83.236.12.216]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZVFXc3JQwz90qg; Sat, 5 Apr 2025 12:44:13 +0000 (UTC) Content-Type: multipart/mixed; boundary="------------YbYlS1pEQtrVWYiRm0up29mo" Message-ID: <72cf5b81-c75d-4d88-bde0-19cdb4053c33@vodafonemail.de> Date: Sat, 5 Apr 2025 14:44:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity To: Eli Zaretskii References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> <8634eoyzkn.fsf@gnu.org> <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> <86plhrxfzl.fsf@gnu.org> From: Jens Schmidt Content-Language: de-DE-frami, en-US In-Reply-To: <86plhrxfzl.fsf@gnu.org> X-purgate-server: smtpa07 X-purgate-type: clean X-purgate: clean X-purgate-size: 9546 X-purgate-ID: 155817::1743857060-CDF8D32B-5A4B9354/0/0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------YbYlS1pEQtrVWYiRm0up29mo Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2025-04-05 08:46, Eli Zaretskii wrote: >>> Why does this matter? Your patch doesn't eliminate initial_argv, so >>> initial_argv[0] still holds the name of the Emacs program, albeit only >>> in the form it was provided by the calling shell. Right? If so, then >>> for reporting errors (and ones that should never happen at that), I >>> don't see any need to jump through hoops. >> >> But my patch, at least the second one [1] on message #20 >> of this bug, plus your earlier request to #ifdef away >> function and call to copy_raw_args on Windows, would skip >> the initialization of initial_argv on Windows, no? > > Ah, I've missed that part. Then the call to 'error' could just use > argv[0] instead of initial_argv[0], right? Then what do you think about the attached patch? --------------YbYlS1pEQtrVWYiRm0up29mo Content-Type: text/x-patch; charset=UTF-8; name="0001-Use-a-pristine-copy-of-argv-to-restart-Emacs.patch" Content-Disposition: attachment; filename="0001-Use-a-pristine-copy-of-argv-to-restart-Emacs.patch" Content-Transfer-Encoding: base64 RnJvbSAxMWE0ZjZjO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2l0IGEvc3JjL3h0ZXJtLmMgYi9zcmMveHRlcm0uYwppbmRleCBiMjFlZmQ1YTJhMi4u MThhOTIzMWU3NWEgMTAwNjQ0Ci0tLSBhL3NyYy94dGVybS5jCisrKyBiL3NyYy94dGVybS5j CkBAIC0zMDYxOSw3ICszMDYxOSw3IEBAICNkZWZpbmUgTlVNX0FSR1YgMTAKICAgICAgICAg ICBhcmd2W2FyZ2NdID0gMDsKIAogICAgICAgICBhcmdjID0gMDsKLSAgICAgICAgYXJndlth cmdjKytdID0gaW5pdGlhbF9hcmd2WzBdOworICAgICAgICBhcmd2W2FyZ2MrK10gPSBpbml0 aWFsX2FyZ3YwOwogCiAgICAgICAgIGlmICghIE5JTFAgKGRpc3BsYXlfbmFtZSkpCiAgICAg ICAgICAgewotLSAKMi4zOS41Cgo= --------------YbYlS1pEQtrVWYiRm0up29mo-- From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 05 09:04:43 2025 Received: (at 77389) by debbugs.gnu.org; 5 Apr 2025 13:04:43 +0000 Received: from localhost ([127.0.0.1]:41967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u13CV-0003ha-Eu for submit@debbugs.gnu.org; Sat, 05 Apr 2025 09:04:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48756) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u13CS-0003hK-RN for 77389@debbugs.gnu.org; Sat, 05 Apr 2025 09:04:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u13CM-0002zy-4Z; Sat, 05 Apr 2025 09:04:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=lwJW9jtWijfk2JDFt1h8KbpcLmIOuag42D75So9TACo=; b=q8NTK/30Cv2F 5Grzs8EXeRk86auQrhCAvIHDbG15KO9w0aW7ICpmkZN/cLNqFlYrLlSQY9EZwGB7lQ+4mixylpztJ 5orgLxSn2uZcR6vdWAeDUauPN8bHVN8NkJ2GR/9WidGbxi9caQv/yEPLYNR7VG97C04puUXIt8waG JZOybGFP9erXrFuZPG6LzIO2M+6ldJfbfUmaKNht7u9oE0O8CSt54imwxUmQdv13/97JrYtjfBtYD B28dujZ+FTPRLh87O0zn0UqwqbrSEukK3ybDaJb55e/kx1zvkiMFz0d2uULy08lKcOz3VYtiI8HO7 bq3azwTE7BXF2LFk0duy2Q==; Date: Sat, 05 Apr 2025 16:04:30 +0300 Message-Id: <86h632wyht.fsf@gnu.org> From: Eli Zaretskii To: Jens Schmidt In-Reply-To: <72cf5b81-c75d-4d88-bde0-19cdb4053c33@vodafonemail.de> (message from Jens Schmidt on Sat, 5 Apr 2025 14:44:12 +0200) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> <8634eoyzkn.fsf@gnu.org> <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> <86plhrxfzl.fsf@gnu.org> <72cf5b81-c75d-4d88-bde0-19cdb4053c33@vodafonemail.de> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 5 Apr 2025 14:44:12 +0200 > Cc: 77389@debbugs.gnu.org > From: Jens Schmidt > > On 2025-04-05 08:46, Eli Zaretskii wrote: > > >>> Why does this matter? Your patch doesn't eliminate initial_argv, so > >>> initial_argv[0] still holds the name of the Emacs program, albeit only > >>> in the form it was provided by the calling shell. Right? If so, then > >>> for reporting errors (and ones that should never happen at that), I > >>> don't see any need to jump through hoops. > >> > >> But my patch, at least the second one [1] on message #20 > >> of this bug, plus your earlier request to #ifdef away > >> function and call to copy_raw_args on Windows, would skip > >> the initialization of initial_argv on Windows, no? > > > > Ah, I've missed that part. Then the call to 'error' could just use > > argv[0] instead of initial_argv[0], right? > > Then what do you think about the attached patch? LGTM, thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 05 10:50:06 2025 Received: (at 77389) by debbugs.gnu.org; 5 Apr 2025 14:50:06 +0000 Received: from localhost ([127.0.0.1]:44255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u14qU-0001RW-EX for submit@debbugs.gnu.org; Sat, 05 Apr 2025 10:50:06 -0400 Received: from mr4.vodafonemail.de ([145.253.228.164]:37988) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u14qS-0001P9-2f for 77389@debbugs.gnu.org; Sat, 05 Apr 2025 10:50:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1743864597; bh=OdiueSz0bqAg47nXHYx2AIHtV++J91hd5eiQ/TIeWz8=; h=Message-ID:Date:User-Agent:Subject:To:References:From: Content-Language:In-Reply-To:Content-Type:From; b=uunyvCkomQm41T67h4QxkwtDNeyHuO1aPsm6JDHpN+fxiGHM3dalWsHoPGPxPlwKq uYYsy/egfB2/UcM0QCD/2an+kbG3N27O3SjHKdnwU/WAS22yow45+v93PNHL3fbe/g UlczHTK6VaygSDLeOZ0Ku0EiVRKq9UFM08PXO10Q= Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr4.vodafonemail.de (Postfix) with ESMTPS id 4ZVJKd4qsJz1xy7; Sat, 5 Apr 2025 14:49:57 +0000 (UTC) Received: from [192.168.178.41] (port-83-236-12-216.dynamic.as20676.net [83.236.12.216]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZVJKY0jGfz904r; Sat, 5 Apr 2025 14:49:49 +0000 (UTC) Message-ID: <9ee1dbc1-8205-48e0-8552-4c7825d8d1c3@vodafonemail.de> Date: Sat, 5 Apr 2025 16:49:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity To: Eli Zaretskii References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> <8634eoyzkn.fsf@gnu.org> <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> <86plhrxfzl.fsf@gnu.org> <72cf5b81-c75d-4d88-bde0-19cdb4053c33@vodafonemail.de> <86h632wyht.fsf@gnu.org> From: Jens Schmidt Content-Language: de-DE-frami, en-US In-Reply-To: <86h632wyht.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-server: smtpa03 X-purgate-type: clean X-purgate: clean X-purgate-size: 182 X-purgate-ID: 155817::1743864597-C8F6F058-91C1ACBB/0/0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2025-04-05 15:04, Eli Zaretskii wrote: > LGTM, thanks. Like in "Pushed to master and closing this bug"? :-) Or is there still something left I should do? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 05 11:46:31 2025 Received: (at 77389) by debbugs.gnu.org; 5 Apr 2025 15:46:31 +0000 Received: from localhost ([127.0.0.1]:44393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u15j5-0007Ja-6P for submit@debbugs.gnu.org; Sat, 05 Apr 2025 11:46:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47210) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u15j2-0007JF-DQ for 77389@debbugs.gnu.org; Sat, 05 Apr 2025 11:46:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u15iw-0002EP-B9; Sat, 05 Apr 2025 11:46:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=wPGuqQ5GaLIQ2Z26OUNDeYdKJPPDa7NJerX2umU3ua0=; b=YgTWPeKHJR2X Ts3nfNpMs5mN0Ns1veyTPoke4b1XLadAyP3noN8LByScSe1NkNXWrixePGxSRKc1v99GNFfemHiog CDUs2p0xyerU+T/2FcrVwFPazFKyxS/W/nys2yiVlPEQeni5KrVWdPanBrJ/vuT/NYtmNzataEu5+ l9jpD/Tu9hBeNVz2q7RNXti/PMavud8zjl6ABCjQiDffbhqnLv72hwosEE8EToAJs23bqWp3Nmllm VJlBqd2ee7JpIjuykJzFyTUnfBNPYsAjehL+XDwVZjAKjmPK6PCVSdE1fR1Oj4a1b94l8sSeD2oyy G+7fCWTzqS4OtBZ8mCOPQA==; Date: Sat, 05 Apr 2025 18:46:20 +0300 Message-Id: <868qoewr03.fsf@gnu.org> From: Eli Zaretskii To: Jens Schmidt In-Reply-To: <9ee1dbc1-8205-48e0-8552-4c7825d8d1c3@vodafonemail.de> (message from Jens Schmidt on Sat, 5 Apr 2025 16:49:48 +0200) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> <8634eoyzkn.fsf@gnu.org> <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> <86plhrxfzl.fsf@gnu.org> <72cf5b81-c75d-4d88-bde0-19cdb4053c33@vodafonemail.de> <86h632wyht.fsf@gnu.org> <9ee1dbc1-8205-48e0-8552-4c7825d8d1c3@vodafonemail.de> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389 Cc: 77389@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 5 Apr 2025 16:49:48 +0200 > Cc: 77389@debbugs.gnu.org > From: Jens Schmidt > > On 2025-04-05 15:04, Eli Zaretskii wrote: > > > LGTM, thanks. > > Like in "Pushed to master and closing this bug"? :-) > > Or is there still something left I should do? Almost. I'd like to leave some time for others to review and comment. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 13 04:40:47 2025 Received: (at 77389-done) by debbugs.gnu.org; 13 Apr 2025 08:40:48 +0000 Received: from localhost ([127.0.0.1]:38212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u3stT-0000dT-5m for submit@debbugs.gnu.org; Sun, 13 Apr 2025 04:40:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55732) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u3stP-0000cM-Sw for 77389-done@debbugs.gnu.org; Sun, 13 Apr 2025 04:40:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3stJ-0003MM-AD; Sun, 13 Apr 2025 04:40:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=XwmxiDpPHIh1XtAR88NmD+KQt3TkGHTk3riLpnVNtGM=; b=O6ErpPGxDbb2 d4zUAyDeHZaUYAhvc1hfG+4jn3uCp9wNJwWK1JCjhQZ+lhoFolD7h8mKQ6mOGdaZ6Vy9P/XZI1R+X WsaNI/UJEi8nSaE3Ypq072uKu8PepdlfMcaQnbo3dtaaBkrVXUn1M3g9LsUSsQ9PmNP0p18LzKMnx Sa5D9Wl5wZ4qLi73M7SsypNDcspa06WbRT8oLE4dzEOOQdZ5RuVnVUOIECxqt2OWsEoM+mkHd2u5Y EB/krc3mUb4kI8v8zEyXO3MIn86abs+RzA99qMYqBm44wx1G6chLbhqstnUsS2nWy5/YKQC9+kkO8 AixQRHJDpGbdbOYdluBuIw==; Date: Sun, 13 Apr 2025 11:40:32 +0300 Message-Id: <867c3olain.fsf@gnu.org> From: Eli Zaretskii To: jschmidt4gnu@vodafonemail.de In-Reply-To: <868qoewr03.fsf@gnu.org> (message from Eli Zaretskii on Sat, 05 Apr 2025 18:46:20 +0300) Subject: Re: bug#77389: 31.0.50; Restarting Emacs with (kill-emacs ... t) looses noninteractivity References: <86plhy4bk3.fsf@gnu.org> <9ed73d36-4c8e-4204-84bd-42a80fb2e42f@vodafonemail.de> <86v7rm23gs.fsf@gnu.org> <864iz525k7.fsf@gnu.org> <4bce6abf-9426-4b1e-9eb5-220465ef2923@vodafonemail.de> <8634eoyzkn.fsf@gnu.org> <386e6249-ec81-4a58-93fe-57f56fe78ade@vodafonemail.de> <86plhrxfzl.fsf@gnu.org> <72cf5b81-c75d-4d88-bde0-19cdb4053c33@vodafonemail.de> <86h632wyht.fsf@gnu.org> <9ee1dbc1-8205-48e0-8552-4c7825d8d1c3@vodafonemail.de> <868qoewr03.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77389-done Cc: 77389-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 77389@debbugs.gnu.org > Date: Sat, 05 Apr 2025 18:46:20 +0300 > From: Eli Zaretskii > > > Date: Sat, 5 Apr 2025 16:49:48 +0200 > > Cc: 77389@debbugs.gnu.org > > From: Jens Schmidt > > > > On 2025-04-05 15:04, Eli Zaretskii wrote: > > > > > LGTM, thanks. > > > > Like in "Pushed to master and closing this bug"? :-) > > > > Or is there still something left I should do? > > Almost. I'd like to leave some time for others to review and comment. Now installed on master, and closing the bug. From unknown Sat Jun 21 10:38:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 11 May 2025 11:24:14 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator