zsh-users
 help / color / mirror / code / Atom feed
* Weird history behavior
@ 2022-06-07 19:23 Adam Cooper
  2022-06-08  5:02 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Cooper @ 2022-06-07 19:23 UTC (permalink / raw)
  To: zsh-users

Hi,

After installing xmonad on an Arch Linux system, my zsh history has begun to misbehave. HISTFILE is read from .zshenv after logging into the console, but once I start xmonad and a terminal, HISTFILE is empty. The other environment variables from .zshenv have their expected values.

I should note that I don't know whether switching from LightDM/XFCE to
xmonad has anything to do with this issue. I mention it only because of
the timing.

Here is a link to my .zshenv: https://git.theadamcooper.com/adam/dotfiles/src/branch/master/arch/zsh/.zshenv

Any ideas would be welcome. Thanks!

-- Adam Cooper


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird history behavior
  2022-06-07 19:23 Weird history behavior Adam Cooper
@ 2022-06-08  5:02 ` Bart Schaefer
  2022-06-08 16:55   ` Adam Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2022-06-08  5:02 UTC (permalink / raw)
  To: Zsh Users

On Tue, Jun 7, 2022 at 12:24 PM Adam Cooper <adam@theadamcooper.com> wrote:
>
> After installing xmonad on an Arch Linux system, my zsh history has begun to misbehave. HISTFILE is read from .zshenv after logging into the console, but once I start xmonad and a terminal, HISTFILE is empty.
[...]
> Here is a link to my .zshenv: https://git.theadamcooper.com/adam/dotfiles/src/branch/master/arch/zsh/.zshenv

Well, there's this:
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"

Once that's in the environment, $HOME/.zshenv isn't going to be read
any more, rather, the dot-files in $ZDOTDIR are going to be read
instead ... so you should look there.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird history behavior
  2022-06-08  5:02 ` Bart Schaefer
@ 2022-06-08 16:55   ` Adam Cooper
  2022-06-08 16:58     ` Roman Perepelitsa
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Adam Cooper @ 2022-06-08 16:55 UTC (permalink / raw)
  To: Zsh Users

On Jun 07 10:02PM, Bart Schaefer wrote:
>On Tue, Jun 7, 2022 at 12:24 PM Adam Cooper <adam@theadamcooper.com> wrote:
>>
>> After installing xmonad on an Arch Linux system, my zsh history has begun to misbehave. HISTFILE is read from .zshenv after logging into the console, but once I start xmonad and a terminal, HISTFILE is empty.
>[...]
>> Here is a link to my .zshenv: https://git.theadamcooper.com/adam/dotfiles/src/branch/master/arch/zsh/.zshenv
>
>Well, there's this:
>export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
>
>Once that's in the environment, $HOME/.zshenv isn't going to be read
>any more, rather, the dot-files in $ZDOTDIR are going to be read
>instead ... so you should look there.

My reading of the docs tells me that (in the absence of /etc/zsh/zshenv) ~/.zshenv is read first, and if ZDOTDIR is set there, the remaining configuration files will be read from ZDOTDIR. (Moving .zshenv into ZDOTDIR resulted in zsh displaying a menu with options for configuring zsh from the start.)

Evidence-wise, when I first log in to tty1, HISTFILE is set, as is HISTSIZE (conspicuously set to 9998), so I conclude .zshenv is being read. When I then run startx to enter xmonad, HISTFILE is unset, while HISTSIZE remains set. The only other configuration file, ZDOTDIR/.zshrc, is read correctly.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird history behavior
  2022-06-08 16:55   ` Adam Cooper
@ 2022-06-08 16:58     ` Roman Perepelitsa
  2022-06-08 17:03     ` Bart Schaefer
  2022-06-08 17:07     ` Bart Schaefer
  2 siblings, 0 replies; 6+ messages in thread
From: Roman Perepelitsa @ 2022-06-08 16:58 UTC (permalink / raw)
  To: Zsh Users

On Wed, Jun 8, 2022 at 6:56 PM Adam Cooper <adam@theadamcooper.com> wrote:
>
> My reading of the docs tells me that (in the absence of /etc/zsh/zshenv) ~/.zshenv is read first

This is incorrect. Where do you see that?

Roman.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird history behavior
  2022-06-08 16:55   ` Adam Cooper
  2022-06-08 16:58     ` Roman Perepelitsa
@ 2022-06-08 17:03     ` Bart Schaefer
  2022-06-08 17:07     ` Bart Schaefer
  2 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2022-06-08 17:03 UTC (permalink / raw)
  To: Zsh Users

On Wed, Jun 8, 2022 at 9:55 AM Adam Cooper <adam@theadamcooper.com> wrote:
>
> My reading of the docs tells me that (in the absence of /etc/zsh/zshenv) ~/.zshenv is read first, and if ZDOTDIR is set there, the remaining configuration files will be read from ZDOTDIR.

That's correct under the assumption that ZDOTDIR is not already
exported into the environment, but if you export it, then everything
is read from there by child shells, including $ZDOTDIR/.zshenv

> (Moving .zshenv into ZDOTDIR resulted in zsh displaying a menu with options for configuring zsh from the start.)

That's because zsh-newuser-install is looking for some comment lines
in $ZDOTDIR/.zshrc

> Evidence-wise, when I first log in to tty1, HISTFILE is set, as is HISTSIZE (conspicuously set to 9998), so I conclude .zshenv is being read. When I then run startx to enter xmonad, HISTFILE is unset, while HISTSIZE remains set. The only other configuration file, ZDOTDIR/.zshrc, is read correctly.

This sounds like either xmonad is removing HISTFILE from the
environment, or some /etc init file is doing so, and it's not put back
because $HOME/.zshenv is skipped in favor of $ZDOTDIR/.zshenv


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird history behavior
  2022-06-08 16:55   ` Adam Cooper
  2022-06-08 16:58     ` Roman Perepelitsa
  2022-06-08 17:03     ` Bart Schaefer
@ 2022-06-08 17:07     ` Bart Schaefer
  2 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2022-06-08 17:07 UTC (permalink / raw)
  To: Zsh Users

On Wed, Jun 8, 2022 at 9:55 AM Adam Cooper <adam@theadamcooper.com> wrote:
>
> (Moving .zshenv into ZDOTDIR resulted in zsh displaying a menu with options for configuring zsh from the start.)

Incidentally you don't want to move .zshenv into $ZDOTDIR, because you
need one in $HOME to assign to ZDOTDIR in the first place.

Personally I think you're overdoing the "export" statements, you
shouldn't need most of those values in the environment if you're
assigning them in ~/.zshenv ... only a few values (XDG stuff and PATH,
for example) need to be exported for other applications to see them.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-08 17:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 19:23 Weird history behavior Adam Cooper
2022-06-08  5:02 ` Bart Schaefer
2022-06-08 16:55   ` Adam Cooper
2022-06-08 16:58     ` Roman Perepelitsa
2022-06-08 17:03     ` Bart Schaefer
2022-06-08 17:07     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).