Nushell locks the history file
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 818
- Forks
- 249
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 30
Description
Basic Info
Platform
Linux, Ubuntu 20.04
Terminal software
Windows Terminal
Nushell attempts to lock the history file. This means that nushell doesn't work when your home directory is mounted via a remote filesystem that doesn't support file locking, like NFSv3. I would think this could potentially cause issue with multiple instances of nushell via the same user as well.
Steps to reproduce
- Ensure your history file is on a non-locking filesystem, like NFSv3. Either by remotely mounting your home directory, or changing the file location
- run nushell. It will freeze while attempting to lock the file before exiting with an error.
strace
open("/home/net/$user/.config/nushell/history.txt", O_RDWR|O_CREAT|O_CLOEXEC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
flock(5, LOCK_EX) = -1 EIO (Input/output error)
close(5) = 0
ioctl(1, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0
write(2, "Error: ", 7Error: ) = 7
write(2, "\n", 1
) = 1
write(2, " \33[31m\303\227\33[0m I/O error (os erro"..., 36 × I/O error (os error 5)) = 36
write(2, "\n", 1
) = 1
write(2, "\n", 1
) = 1
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7f4376073000, 12288) = 0
exit_group(1) = ?
+++ exited with 1 +++
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing reedline's history-file handling from the reported startup path and reproduce the failure on an NFSv3-like non-locking filesystem. Done means Nushell no longer exits with an I/O error when the history file cannot be locked, while the reported history behavior remains clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100