From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,LONGWORDS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27553 invoked from network); 19 Mar 2023 18:39:04 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Mar 2023 18:39:04 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1679251144; b=nGvOSsahb5f2Gv/kggincAdAXvgYEx2HPz8L4j0Bbfzvxi8ieeQf48i/0WmxYF90u/ouxBYp7j j38RawLQuQXCao2gZZMyjuYP0FW5+u3t4LnG/sAE7RB6xk85uxuZoOHaPsmy7Y2l8MjuGzzvID sIrKsq57K+ADQNe+3+nyYn5NSKcDygnnvnhx8/D7Rf9lDBLlEzY7isrxUutC1h6wjWXh1K/4y8 ujtM2y5YItJ4aeQJnDUxk3ahmpUUjWJFBu4AIXH+dGhyKWeIKmlNwQNopGHTSS4y7Uqn+U6ZKV 3hezrCd8ViGqTjlKDBRwlBG4DMOUP2fv3BBLKOkbpT2zAw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-40133.protonmail.ch) smtp.remote-ip=185.70.40.133; dkim=pass header.d=protonmail.ch header.s=protonmail3 header.a=rsa-sha256; dmarc=pass header.from=protonmail.ch; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1679251144; bh=KbbJ14hlCVLv1fkrR5mB2TUV62si81fiOjXI9uhzowo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Subject:Cc:From:To:DKIM-Signature:Date: DKIM-Signature; b=KSYoI3gt7vsMXvt4gpQGZut2d0i0YjDS4UJ8HHy+Wybs2dGkDFzmi2iFfERAFt0T29IPzhIrVo rXwuPlN8nBS8FxnD/XcYQ4TPeDBUDa597CsBO3VU+nBnIxyapdUDtc25ZUwAUBBPtmF8Vrv8ZK UybSneAU1HHIRFZmY1W8mzgxGQKGrnVTIJHez6VfhftWNFRDT9CN6QItykRxM/ys2vOVmrO1u8 mMj1YC05mbTbRV7r3jjdgT8e2SS+Tbqe4J2rLKX6h0a6KNHENtxiVV1LULB2rxruDHRQrumuBi 8B+5ZWuNA7meBozOWThTby1dM3pDVTodhfs/qnfmwiOzRw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:From: To:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=oqj3mcuFU2aXyVBv9mf8Kvk34ZYJA+8ZkmPm9GYW3J8=; b=X0sxKVp5gRuFhmMP8dS5k9k93b 9z+Q8TKsKyb+YRLWBrXR46vtp3rCoAZzIfMYhfFRXe7d2mvsTFkhwZhyhuCZTQ7LktEJGevnlwbbs u/CFdAjsSDoWUeBpycDQmIvgLyEPZq9juc5MZ1gp3jIa4rwx8QiX65HqoStS+gIRRvEL6lxRqbHTd eOrAl9at3SqLrNE9eiDSsUFT/YDKP2n/38NWQ8Axt3tM8/G/IgJTzAyzSF0Xn/f7DRhIrPtIWlidt l2tuOJNM5MlMaxpTAlL5S8D5wP44txixmV7EsprIoLsZmoiM2TNSJXDXHcoBYzxRy6col0NQD0N7s vrz/llCQ==; Received: by zero.zsh.org with local id 1pdxvr-00044t-Lu; Sun, 19 Mar 2023 18:39:03 +0000 Authentication-Results: zsh.org; iprev=pass (mail-40133.protonmail.ch) smtp.remote-ip=185.70.40.133; dkim=pass header.d=protonmail.ch header.s=protonmail3 header.a=rsa-sha256; dmarc=pass header.from=protonmail.ch; arc=none Received: from mail-40133.protonmail.ch ([185.70.40.133]:55059) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pdxv2-0003NA-3x; Sun, 19 Mar 2023 18:38:12 +0000 Date: Sun, 19 Mar 2023 18:38:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.ch; s=protonmail3; t=1679251091; x=1679510291; bh=oqj3mcuFU2aXyVBv9mf8Kvk34ZYJA+8ZkmPm9GYW3J8=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=jMzFX0QHBUVXLxuR0rhaH5zMZBwh+RchxgpA8BBpMdhjO4W+Am7bLLeMMeCXfoRTB 7L9DlOCjA9NrxTcjpolmvkWBI8YVmvwjr8q7oUcf9wuJv3IPZb9YVEAonATyaZM/BN klsyXnm2bcQfa1x7aKaGFLo0pU75rl83qFSBJlpyLCmxIAIyK2EPo5udVUXDDm7ZLa wipcXBSiVzlAmgnmZ0iKJG5ZtM6MbzJOolCc4Hw3Tyfre0zOM7ymSstOrAhisXzwu/ Vl+SC/Bd7632Op1TIgfVvl6Ya51S8WsBYKmU3wrEbLw3wWh8l+QOE4JrONoQrN9Or3 ow1I0PhMLYXig== To: Bart Schaefer From: Piotr Karbowski Cc: zsh-users@zsh.org Subject: Re: The HIST_EXPIRE_DUPS_FIRST might corrupt and wipe partially history file if many shells exit at the same time Message-ID: In-Reply-To: References: <33a75d10-d765-3d79-a179-943c57659111@protonmail.ch> Feedback-ID: 7579861:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 28974 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Hi, On 19/03/2023 17.53, Bart Schaefer wrote: > On Sun, Mar 19, 2023 at 4:56=E2=80=AFAM Piotr Karbowski > wrote: >> >> They way I can reproduce it sometimes is if multiple zsh shells exit at >> the very same time. It happens when I terminate tmux session that have >> 10+ zsh instances,or when I just reboot my system while I have dozens o= f >> urxvt instances open. >> >> +SAVEHIST=3D'96000' >> +setopt hist_expire_dups_first >> >> I have disabled this feature since due those corruptions. Would love to >> get back to it though, perhaps adding some locking mechanism would help >> here? > > There is a locking mechanism. A couple of things may be happening: > > 1) Your home directory (or ZDOTDIR) is on a remote filesystem with > asynchronous mounting, so the locking mechanism doesn't always work. > You haven't described your system configuration in any detail, but > from what you have said this one seems unlikely. > 2) The locking mechanism doesn't work for some other reason. Make > sure the HIST_SAVE_BY_COPY option is set (it's the default but check > anyway). > 3) When exiting a session (or particularly when rebooting), there may > be a limited amount of time for the processes to clean up and exit > before they are killed. With the combination of options you have, > each shell must re-read the history file to merge it with its local > history before writing it back. With multiple shells and tens of > thousands of lines of history, this might take longer than all the > shells are allowed to stay alive. > > Try putting something in your .zlogout file that writes a timestamp to > a file (different for each shell, e.g., use $$ in the filename). > Since .zlogout runs after history is saved, if you find any of those > files to be missing, that's a clue that #3 is happening. You could > also look to see if a ".zsh_history.new" file is left behind. Thanks for the response and applogies for missing details. I am runnin XFS (on the top of lvm, on the top of dmcrypt). The current setopt is (without the expire dups first) autopushd extendedglob noflowcontrol histignoredups histignorespace interactive interactivecomments promptsubst pushdignoredups pushdminus shinstdin The HIST_SAVE_BY_COPY does not seems to be enabled and I am unable to enable it. Running setopt HIST_SAVE_BY_COPY Does not bring this option into list I can see with running setopt. This is zsh-5.9. Running unsetopt without params does show nohistsavebycopy there, however running setopt histsavebycopy Does nothing, it still remains as nohistsavebycopy in unsetopt output. The question then is -- why this feature remains disabled and cannot be toggled on? Even running zsh -dfi to get a shell without zshrc behave the same way, this feature remains disabled and cannot be toggled on. -- Piotr.