Bug 374259 - >2 GB history file tries to overflow lseek
Summary: >2 GB history file tries to overflow lseek
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: history (show other bugs)
Version: 16.04.3
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 146483 333472 362197 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-28 17:11 UTC by Luke-Jr
Modified: 2022-01-12 17:31 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2016-12-28 17:11:22 UTC
I was trying to use the unlimited history option to buffer a very long output, but it seems once the /tmp file gets past 2 GB, konsole just breaks entirely and floods .xsession-errors :/

lseek(78, -2147483536, SEEK_SET)        = -1 EINVAL (Invalid argument)
write(2, "HistoryFile::get.seek: Invalid argument\n", 40) = 40
write(2, "getHist(...,0,-2147483536): invalid args.\n", 42) = 42

(Additionally, probably Konsole shouldn't flood errors when something fails...)
Comment 1 Kurt Hindenburg 2017-02-13 01:29:36 UTC
*** Bug 333472 has been marked as a duplicate of this bug. ***
Comment 2 Kurt Hindenburg 2017-02-13 01:30:11 UTC
*** Bug 362197 has been marked as a duplicate of this bug. ***
Comment 3 Kurt Hindenburg 2017-02-13 01:43:10 UTC
known issue - easy fix would be use something other than short int - better would be to handle/limit huge files
Comment 4 Luke-Jr 2017-02-13 03:13:35 UTC
(In reply to Kurt Hindenburg from comment #3)
> better would be to ...limit huge files

That wouldn't be a fix. I set unlimited because I actually want unlimited.
Comment 5 Bugs Kde Org 2017-03-10 23:37:56 UTC
I will be satisfied with 2^63-1 bytes = 9223372036854775807 (64-bit signed).

@Luke-Jr Would that be enough for you?
Comment 6 Luke-Jr 2017-03-11 01:39:29 UTC
(In reply to Bugs Kde Org from comment #5)
> I will be satisfied with 2^63-1 bytes = 9223372036854775807 (64-bit signed).
> 
> @Luke-Jr Would that be enough for you?

I was going to say "I don't think more is possible", but then I discovered fpos_t and fgetpos/fsetpos...

But yes, 63-bit should be more than enough for a long time. :)
Comment 7 Kurt Hindenburg 2017-06-18 23:38:19 UTC
Git commit 0ede8bde1f61501b495c88a5fee9f6884e92ad4a by Kurt Hindenburg.
Committed on 18/06/2017 at 22:54.
Pushed by hindenburg into branch 'master'.

Allow unlimited scrollback/history to extend pass 32bit/2GB limit

Revamp the file-based "unlimited" scrollback code to remove limits
caused by 32bit file offsets. Use Qt's I/O functions which are
buffered and use 64bit offsets. Use Qt's map instead of direct mmap
to ensure consistency. Prevent wrap-around of readWriteBalance.

Patch from FreeBSD committed by rezny

https://github.com/freebsd/freebsd-ports-kde/blob/master/x11/konsole/files/patch-src_History.cpp
https://github.com/freebsd/freebsd-ports-kde/blob/plasma5/x11/konsole/files/patch-fix_infinite_scrollback

M  +41   -51   src/History.cpp
M  +7    -8    src/History.h

https://commits.kde.org/konsole/0ede8bde1f61501b495c88a5fee9f6884e92ad4a
Comment 8 ninjalj 2022-01-12 17:31:27 UTC
*** Bug 146483 has been marked as a duplicate of this bug. ***