[Xapian-tickets] [Xapian] #651: Protect writable fds by setting filepos very high
Xapian
nobody at xapian.org
Thu Feb 23 02:10:13 GMT 2023
#651: Protect writable fds by setting filepos very high
---------------------------+-------------------------------
Reporter: Olly Betts | Owner: Olly Betts
Type: enhancement | Status: assigned
Priority: normal | Milestone: 1.5.0
Component: Backend-Glass | Version:
Severity: normal | Resolution:
Keywords: | Blocked By:
Blocking: | Operating System: All
---------------------------+-------------------------------
Comment (by Olly Betts):
> The only alternative to caching I can see if to build a lot of FS-
specific knowledge into the library and check the type of FS and things
like the block size if necessary, which sounds like a bad idea.
We could potentially just have a list of offsets to try seeking to
(generated in advanced), and use the largest which is seekable. It works
best if we use the highest offset supported, but it isn't vital.
Probably we could binary chop the candidate list (a failed lseek()
presumably leaves the offset unchanged, though the man page doesn't
clearly say so AFAICS on Linux at least) so probably we'd only need 3 or 4
lseek() calls per table opened to write (which would allow up to 7 or 15
values).
--
Ticket URL: <https://trac.xapian.org/ticket/651#comment:16>
Xapian <https://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list