From nobody Sun Apr 07 11:05:02 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VC8Wl0krbz5GZGW for ; Sun, 7 Apr 2024 11:05:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VC8Wk675nz51gl for ; Sun, 7 Apr 2024 11:05:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712487906; a=rsa-sha256; cv=none; b=VDPHf9OaToUGSobeQdM+NJ9qrPMuNDhq8cc5GMbH9DV+fDv4X3D/WMeWDHby40x7WY/6oQ 3jp3GeKH0g0NcEaEdmRH+UzEy1WeC61SaNyOp5eOygnTFSgkQV8qarlu9kGAG6trJfryHz Qbe9rapX3Q2N1E+JkzrabgGjI7r9ULn9vF+AHpdYDq0eL8olTdM0ML+6Aj3oiyUV4ptD07 EUsdSpyazaBKp6qz+rzXoxwTKIDz4SyTF3OEe8crSbbtNXdEjPAGwJEgGUIZZDcdx17DBw dciyylDiZ21177v7xoF0Huqh74+DC7ZFimgwQC5nTNMvQYuGO2YMXrrBqsP9Ng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712487906; 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=9WksyGGK4dxjecQm7L66AGfw3zf1ye66aDUzD9GsHW8=; b=SWgpnu7dKSP+q5hNKoh4LDWHbWdRprlJVNizK6tktPQniq5tjl12FbQnlQjfN3ne4CD618 U8qcoxVARDGuKevhBamSKuaY526L81UniOl9RvzM2a8pjL1u1rx7BBuDRCbnwG9DbRDbEh 3W2fmYw0xdD0aKfdpAVeRWcuTbshPhpKrfivCy6brda9MtVJYU2+uwj7fE9KLvyswsH3JB r1vk+hvT671omrYB33VGPKD+nSB2fUPlWl0pBdsM/bLSVBtrmssykR7DsrpSXGXXezLwvt PIuB8jYpVc8HmYLP3OVOH4dnWXs9+C/V5BLHWPI97fvHYGZPTYXX2c3qgj71qw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VC8Wk5l6WzPZC for ; Sun, 7 Apr 2024 11:05:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 437B56XH086587 for ; Sun, 7 Apr 2024 11:05:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 437B56sU086576 for bugs@FreeBSD.org; Sun, 7 Apr 2024 11:05:06 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 278230] sh: Multiple instances overwrite each other's history Date: Sun, 07 Apr 2024 11:05:02 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: sstj6a2b@eseipi.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278230 Bug ID: 278230 Summary: sh: Multiple instances overwrite each other's history Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: sstj6a2b@eseipi.net Created attachment 249800 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D249800&action= =3Dedit sh: Reload HISTFILE before saving history if necessary A basic persistent history for sh(1) was implemented in 988b1bb0c54e, but it doesn't work well when multiple shells coexist at the same time. In additio= n to the common and obvious situation with two terminal emulators running simultaneously (where history from one session will be overwritten entirely= by another), let's consider the following use case: someone starts an X/Wayland session from a login sh(1) interactively. Then, after logging out, HISTFILE will contain commands from the tty session only, but not from any other she= lls that may have been used. Steps to reproduce: 1) Start two sh(1) instances. 2) Run "exit 1" in the 1st one. Now the last line of the HISTFILE is "exit = 1". 3) Run "exit 2" in the 2nd one. HISTFILE doesn't contain "exit 1" anymore, = only "exit 2". It happens because sh(1) dumps only history events it has in memory, i.e. t= hose loaded from HISTFILE at start plus the ones entered by user in the current session, but doesn't care that HISTFILE content may have changed in the meantime. I wrote a patch that seems to solve the problem for me, but not sure if this can be considered as expected behavior for anyone else. --=20 You are receiving this mail because: You are the assignee for the bug.=