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.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30044 invoked from network); 29 Jul 2020 14:33:42 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 29 Jul 2020 14:33:42 -0000 Received: (qmail 17673 invoked by alias); 29 Jul 2020 14:33:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: Sender: zsh-workers@zsh.org X-Seq: 46281 Received: (qmail 9488 invoked by uid 1010); 29 Jul 2020 14:33:29 -0000 X-Qmail-Scanner-Diagnostics: from cadetblue.birch.relay.mailchannels.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25884. spamassassin: 3.4.4. Clear:RC:0(23.83.209.28):SA:0(-2.0/5.0):. Processed in 3.481316 secs); 29 Jul 2020 14:33:29 -0000 X-Envelope-From: perette@barella.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf1.mailchannels.net designates 23.83.209.28 as permitted sender) X-Sender-Id: a2hosting|x-authuser|perette@barella.org X-Sender-Id: a2hosting|x-authuser|perette@barella.org X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|perette@barella.org X-MailChannels-Auth-Id: a2hosting X-Whistle-Keen: 13d5f21967eb53e0_1596033164723_3199474711 X-MC-Loop-Signature: 1596033164723:553828133 X-MC-Ingress-Time: 1596033164723 To: zsh-workers@zsh.org From: Perette Barella Subject: zsh: corrupt history file Message-ID: Date: Wed, 29 Jul 2020 10:32:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AuthUser: perette@barella.org Research on Google suggests the 'corrupt history file' problem is rare. In my experience, it is not; I get these _all_ _the_ _time_. I've identified one source of corruption: $HISTFILE. Korn shell *uses* but does not *require* this variable be set. If unset, it uses ~/.sh_history as a default. `zsh` *requires* this variable be set, or there is no persistent history feature. However, once set, if the user enters `ksh` (shelling out from an editor, for instance; or starting another shell to run a few experiments to compare behavior and increase understanding, or try commands to ensure a solution is portable for a script), then Korn shell does what it's told and appends its commands to the .zsh_history file. And a `corrupt history file` ensues. This does not happen with bash; although bash uses $HISTFILE it seems to use a similar history format to zsh. ksh does some unusual encoding. A solution to this is to add to .kshrc a `HISTFILE=$HOME/.sh_history` and to .zshrc a `HISTFILE=$HOME/.zsh_history`, so that if invoking different shells they do not corrupt each other's history files. This issue should be noted in the man page, either with $HISTFILE's explanation, or in the BUGS section. When corruption *does* occur, it is compounded by zsh's behavior: all sessions sitting at prompts, will ignore their next command and display the corruption error message. Then they starts working normally again, history and all. It sucks that I lost the past, but having every window drop one command gets super frustrating; essentially, this error isn't just effecting the history, it's effecting the future. Even if the past has to be lost, it would be much less frustrating to have zsh *execute the inputted command*, then display the error before prompting for the next command. For me, this is the real irritation, usually more than losing any history. Perette Barella