Sample Header Ad - 728x90

In zsh 5.9-4+b6 on Debian, are INC_APPEND_HISTORY_TIME and SHARE_HISTORY really mutually exclusive?

2 votes
1 answer
112 views
In my .zshrc, I had
setopt HIST_IGNORE_ALL_DUPS INC_APPEND_HISTORY_TIME AUTO_CD
so that issuing setopt yielded
autocd
histignorealldups
incappendhistorytime
interactive
monitor
shinstdin
zle
However, opening two xterms in parallel and typing in certain commands in one shell and, in parallel, other commands in another shell didn't transfer the commands from the history of one shell to the history of the other. I changed the .zshrc options line to
setopt HIST_IGNORE_ALL_DUPS SHARE_HISTORY INC_APPEND_HISTORY_TIME AUTO_CD
so that, upon reopening the two xterms, setopt yielded
autocd
histignorealldups
incappendhistorytime
interactive
monitor
sharehistory
shinstdin
zle
Only then did the commands typed in in one shell start appearing in the history of another shell (though the history got transferred to the other shell only after any command in the other shell had been issued). In the Manual and Info pages of zshoptions, we read in the para for INC_APPEND_HISTORY_TIME: “[…] This option is only useful if INC_APPEND_HISTORY and SHARE_HISTORY are turned off. The three options should be considered mutually exclusive.” So, apparently, I did the useless thing (having both options simultaneously), and it worked. Is the documentation outdated, or does some other magic happen? To compare, I tried
setopt HIST_IGNORE_ALL_DUPS SHARE_HISTORY AUTO_CD
in .zshrc. This way setopt produced
autocd
histignorealldups
interactive
monitor
sharehistory
shinstdin
zle
and the results were undistinguishable from having both SHARE_HISTORY and INC_APPEND_HISTORY_TIME: the commands typed in concurrently in two different shells merged after being issued (namely, after any next command typed into the shell where we read the history) while the two shells were running. However, the way I interpret the documentation, I'd expect that SHARE_HISTORY without INC_APPEND_HISTORY_TIME would write history commands of a shell to the history file only after the shell is finished; before the shell process terminates, its history would be unavailable for other zsh processes in RAM. That's another mismatch between the documentation and the behavior, isn't it?
Asked by user743115 (1 rep)
Jun 29, 2025, 05:08 PM
Last activity: Jun 30, 2025, 05:44 AM