.bash_history truncated after Terminal update #15756

Closed
opened 2026-01-31 04:47:28 +00:00 by claunia · 4 comments
Owner

Originally created by @GPHemsley-RELX on GitHub (Nov 1, 2021).

Windows Terminal version (or Windows build number)

1.11.2921.0

Other Software

Ubuntu 20.04 (WSL1)

Steps to reproduce

I can't say for sure if Windows Terminal is to blame here (as opposed to some overzealous enterprise sanitizing, for example), but I figured I'd file this just in case.

If it is, then I suspect this is vaguely what happened:

  • Install Windows Terminal via the store.
  • Have multiple instances of the same Ubuntu running.
  • Upgrade versions, which forcibly closes Terminal and its running sessions. (#6726)

All I really know is that .bash_history is now empty and a new version of Terminal was recently released.

Expected Behavior

Some copy of .bash_history (from some instance) is present. In other words, whatever it was doing before.

Actual Behavior

.bash_history is truncated and no history from any instance is available.

Originally created by @GPHemsley-RELX on GitHub (Nov 1, 2021). ### Windows Terminal version (or Windows build number) 1.11.2921.0 ### Other Software Ubuntu 20.04 (WSL1) ### Steps to reproduce I can't say for sure if Windows Terminal is to blame here (as opposed to some overzealous enterprise sanitizing, for example), but I figured I'd file this just in case. If it is, then I suspect this is vaguely what happened: * Install Windows Terminal via the store. * Have multiple instances of the same Ubuntu running. * Upgrade versions, which forcibly closes Terminal and its running sessions. (#6726) All I really know is that .bash_history is now empty and a new version of Terminal was recently released. ### Expected Behavior Some copy of .bash_history (from some instance) is present. In other words, whatever it was doing before. ### Actual Behavior .bash_history is truncated and no history from any instance is available.
claunia added the Needs-TriageNeeds-Tag-FixResolution-No-ReproNeeds-Attention labels 2026-01-31 04:47:28 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Nov 2, 2021):

Weird! I don't really know how bash goes about persisting the history. This might be a side effect of the "WSL processes get orphaned when the Terminal is force-updated by the store" issue, #9914.

@therealkenc IIRC you're the WSL triage wizard, any ideas here?

@zadjii-msft commented on GitHub (Nov 2, 2021): Weird! I don't really know how `bash` goes about persisting the history. This might be a side effect of the "WSL processes get orphaned when the Terminal is force-updated by the store" issue, #9914. @therealkenc IIRC you're the WSL triage wizard, any ideas here?
Author
Owner

@zadjii-msft commented on GitHub (Jul 29, 2022):

I'm guessing that this is somehow related to #9914. I don't know when bash writes out .bash_history, and I don't know why it would be empty. That would almost imply that the bash process totally cleared it out, which doesn't make any sense. I'm under the impression that bash just appends to it, always. That's real weird.

There might be something else going on here in ubuntu land. (impossible to say right now because stack exchange is down at the time of writing):

There's enough posts here for me to think this isn't solely a Terminal problem. You still seeing this/?

@zadjii-msft commented on GitHub (Jul 29, 2022): I'm guessing that this is somehow related to #9914. I don't know when `bash` writes out `.bash_history`, and I don't know why it would be _empty_. That would almost imply that the `bash` process totally cleared it out, which doesn't make any sense. I'm under the impression that bash just appends to it, always. That's real weird. There might be something else going on here in ubuntu land. (impossible to say right now because stack exchange is down at the time of writing): * https://askubuntu.com/questions/257249/bash-history-not-being-preserved * https://askubuntu.com/questions/372755/bash-history-not-containing-all-history-and-blank-after-reboot-how-to-resolve * https://superuser.com/questions/1239456/why-is-my-command-history-empty There's enough posts here for me to think this isn't _solely_ a Terminal problem. You still seeing this/?
Author
Owner

@GPHemsley-RELX commented on GitHub (Aug 1, 2022):

I only encountered it that one time, so it's hard to say. At a glance, all of those Stack Exchange posts suggest that it has something to do with permissions, so I wonder if there was some sort of race condition where the WSL drive wasn't properly set up? I don't know if that would be a thing caused by Windows or by all the security management things on my computer, though.

@GPHemsley-RELX commented on GitHub (Aug 1, 2022): I only encountered it that one time, so it's hard to say. At a glance, all of those Stack Exchange posts suggest that it has something to do with permissions, so I wonder if there was some sort of race condition where the WSL drive wasn't properly set up? I don't know if that would be a thing caused by Windows or by all the security management things on my computer, though.
Author
Owner

@zadjii-msft commented on GitHub (Aug 1, 2022):

Huh. Well, if it hasn't happened again, let's just close this out for bookkeeping's sake. If it starts happening again, or someone else starts seeing this, we can reopen and revaluate. Thanks!

@zadjii-msft commented on GitHub (Aug 1, 2022): Huh. Well, if it hasn't happened again, let's just close this out for bookkeeping's sake. If it starts happening again, or someone else starts seeing this, we can reopen and revaluate. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15756