Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

history isn't shown if your system clock is set wrong #6606

Open
ridiculousfish opened this issue Feb 14, 2020 · 2 comments
Open

history isn't shown if your system clock is set wrong #6606

ridiculousfish opened this issue Feb 14, 2020 · 2 comments
Assignees
Labels
bug Something that's not working as intended
Milestone

Comments

@ridiculousfish
Copy link
Member

ridiculousfish commented Feb 14, 2020

fish wants to use a single history file, but also ignore item from other sessions that were ran after this session was started. To achieve this it compares the item's timestamp against the current clock. The problem is that if the clock is invalid or set backwards, then old items may appear new and will be ignored.

The real problem is that fish ever re-reads the file. What ought to happen is that fish uses whatever is in the file at session startup or when history merge is run, and then ignores the timestamp.

Credit to @travankor for pointing this out.

@mqudsi
Copy link
Contributor

mqudsi commented Feb 15, 2020

But that implies that we will be forced to ingest all history (or at least all that we can ever reference in the session without merging) and load it into memory? A more reliable alternative to the timestamps is a strictly globally monotonic session id identifier, but a more reasonable approach might be to just remember the length of the file/the seek position at startup.

@ridiculousfish
Copy link
Member Author

ridiculousfish commented Feb 16, 2020

No, it does not need to read the file, it only has to mmap it with MAP_PRIVATE. The file will still be lazily paged-in on demand. The open/lseek approach would also work; in fact, it might be even better since it would avoid the issue where truncated mapped files cause SIGBUS.

@zanchey zanchey added the bug Something that's not working as intended label Feb 17, 2020
@zanchey zanchey added this to the fish-future milestone Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants