Closed qouoq closed 2 years ago
Hey @qouoq, thanks for your report! Is it easy for you to try https://github.com/cantino/mcfly/pull/237 and see if it helpfully prints an error instead of crashing?
I want to take my chapeau off here! Going from an issue to a proposed fix in this amount of time, I'm astounded :no_mouth:
So, err, no, the proposed fix doesn't print a helpful error, in the sense that I don't know which history line is the offender (but it does look like there is only one).
Now, it does work since the history import completes and McFly functions as expected upon installation.
And I guess it doesn't matter to point out the problem line. I'd say the message could be friendlier (such as [newline]History line skipped during import due to parsing error
for example?). The init message is now as follows:
McFly: Importing shell history for the first time. This may take a minute or two...McFly error: Insert did not work (nul byte found in provided data at position: 0)
done.
But in any case, fix is good and I'm proposing to close the issue, unless you want to keep it open until pushed to master?
By the way, since this is my first contact with McFly, I see that timestamps of imported history are all at import time, would it be something reasonable to grab the timestamps from the history file, or maybe is there some existing feature request/ongoing work along these lines?
No problem :)
I just added slightly more verbose logging if you want to try deleting ~/.mcfly and running #237 again.
New init message:
McFly: Importing shell history for the first time. This may take a minute or two...Insert did not work due to 'nul byte found in provided data at position: 0'. Command was ''
done.
Thanks @qouoq!
I get an error on a fresh install. Running
Results in
This happens with the Arch Linux package and the github release, both version 0.5.13, with zsh 5.8.1 (it works if I init the db from .bash_history).
I would venture a guess that my .zsh_history contains something wrong, there's a lot of garbage in it from copy-paste mishaps. It's about 20k lines though, so manually curating it is not something I'd be looking forward to.
--edit Mmh, I'm thinking that doing binary splits of the zsh history could be an approach, although a bit time-consuming (14-15 iterations if I'm not mistaken). Would that be the best way to proceed?