w3m
w3m copied to clipboard
bug: not all url got written in ~/.w3m/history if multiple w3m are running
steps to reproduce the bug:
- open url1 in the first w3m
- open url2 in the second w3m
- quit first w3m
- quit second w3m
- expected both url1 and url2 are in the history file, but actually only url2 got written.
w3m version w3m/0.5.3+git20210330
I looked into this a bit:
The history of the last w3m closed wins. Every closed w3m writes their own version of the history file, overwriting the previous one.
After startup the history is loaded into memory. When opening an URL w3m checks if this URL is already in the history and if so, deletes the old history entry. The URL is then appended to the list. When quitting the current history is written back to the file.
To resolve this issue one would need to sync the history file every time the history is changed. If we assume that multiple w3m instances are not likely to access the history at the same time (writing/reading should be way faster than a user switching between both instances), we could live with a simple locking mechanism where all w3m instances just wait till the lock is lifted.
In any case should this be configurable and not the default - I don't want my w3m to write to the disk every time I open a website.
Any opinions on this?
I'd be willing to invest some time to write a patch for this.
is there a way to force it to write to file via w3m functions or hotkey without exiting w3m
On Tue, Aug 30, 2022 at 10:15:27PM -0700, @gotbletu wrote:
is there a way to force it to write to file via w3m functions or hotkey without exiting w3m
No, and you would not gain much from it, as it would be overwritten when you exit any other instance of w3m.
What you can do, is to open the history (HISTORY, ^h) and save the buffer to a file (SAVE_SCREEN, S).
Good point, thanks
See https://github.com/tats/w3m/pull/247
fixed by https://github.com/tats/w3m/pull/247