From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57129: 29.0.50; Improve behavior of conditionals in Eshell Date: Tue, 16 Aug 2022 16:51:06 +0300 Message-ID: <838rnofgad.fsf__21557.5367373944$1660657949$gmane$org@gnu.org> References: <835yish2l1.fsf@gnu.org> <1871347.6tgchFWduM@nimes> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="349"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jporterbugs@gmail.com, larsi@gnus.org, eggert@cs.ucla.edu, bug-gnulib@gnu.org, 57129@debbugs.gnu.org To: Bruno Haible Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 16 15:52:23 2022 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 1oNwzW-000ASP-CR for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 15:52:22 +0200 Original-Received: from localhost ([::1]:36732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNwzU-0003ra-BW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 09:52:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNwzC-0003mw-Cb for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 09:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNwzC-0006tk-47 for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 09:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNwzB-00044M-WA for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 09:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Aug 2022 13:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57129 X-GNU-PR-Package: emacs Original-Received: via spool by 57129-submit@debbugs.gnu.org id=B57129.166065789015605 (code B ref 57129); Tue, 16 Aug 2022 13:52:01 +0000 Original-Received: (at 57129) by debbugs.gnu.org; 16 Aug 2022 13:51:30 +0000 Original-Received: from localhost ([127.0.0.1]:45409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNwyf-00043c-Kw for submit@debbugs.gnu.org; Tue, 16 Aug 2022 09:51:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNwya-00043M-RZ for 57129@debbugs.gnu.org; Tue, 16 Aug 2022 09:51:28 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34416) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNwyU-0006m3-Ax; Tue, 16 Aug 2022 09:51:18 -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=qTh2SrrgccwmooMEmjvaMRa8VOetjSi706dW5g+p7es=; b=qxuW3pGhxfRZ rjaMQ6lJoYRiWUFYVxTxYGX77RR7xoDOFxutCxFOrpEUenitT35BoDi0SqjETRva/kdY5wPyFOLwn iBxjirbgk96bkY441KdmH1Ujjqq96lz13mQIxVBYYLRt8BA7AtX7o9kt0K3knoMzSO7wvxgnckvL3 LXrLM9nQeCPXSxMBUxONXCB/C3hXvOJQZQR5vmy5zQPPSUPewyo/sEk+VtCnDq5fSIuh3Vl9dLR6s TVd+4n3RRezD7cBue+VhZ8VnZmy9hTAFOukHtoUuKwYT4zxzGmXPvFXXZRXqBL1bevCGIHZym3g1R 4KW0rLjaqQ0iLe0pO3Sh/g==; Original-Received: from [87.69.77.57] (port=4103 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNwyT-0006fG-Qh; Tue, 16 Aug 2022 09:51:18 -0400 In-Reply-To: <1871347.6tgchFWduM@nimes> (message from Bruno Haible on Tue, 16 Aug 2022 15:35:17 +0200) 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" Xref: news.gmane.io gmane.emacs.bugs:239942 Archived-At: > From: Bruno Haible > Cc: larsi@gnus.org, 57129@debbugs.gnu.org, jporterbugs@gmail.com > Date: Tue, 16 Aug 2022 15:35:17 +0200 > > Eli Zaretskii wrote: > > The problem is that callers of > > make-temp-file reasonably expect it to return a new name every call. > > And evidently, it does that on GNU/Linux (not sure how, given that the > > tempname.c code is supposed to be in glibc?). So if there's no > > intention to change gen_tempname on non-glibc platforms so that it > > doesn't repeat the same "random characters" upon each call, I think > > Emacs should call a different function to generate "random" names of > > temporary files, for consistency across platforms if not for other > > reasons. > > You are making incorrect assumptions or hypotheses. They are neither assumptions nor hypotheses. They are what I actually saw by stepping with a debugger into the code. > I am adding the unit test below. It proves that (at least) on Linux, > FreeBSD 11, NetBSD 7, OpenBSD 6.0, macOS, AIX 7.1, Solaris 10, > Cygwin, and native Windows, gen_tempname *does* return a new file > name on each call, with a very high probability. > > So, gen_tempname does *not* repeat the same "random characters" upon each call. Well, it does here, when called from Emacs in the particular scenario of the unit test I was looking into. Looking at your test program, I see that you generate the seconds file name without deleting the first one. When a file by the first generated name already exists, gen_tempname will indeed generate a different name. But in the scenario I described, Emacs creates one temporary file, uses it, then deletes it, and only after that creates another file. In terms of your test program, you need to move the first unlink call to before the second call to gen_tempname. Then your test program will faithfully reproduce what Emacs does in the case in point.