[Xapian-tickets] [Xapian] #665: Avoid C library functions not guaranteed to be thread-safe

Xapian nobody at xapian.org
Wed May 8 01:04:48 BST 2024


#665: Avoid C library functions not guaranteed to be thread-safe
-------------------------+-------------------------------
 Reporter:  Olly Betts   |             Owner:  Olly Betts
     Type:  defect       |            Status:  assigned
 Priority:  normal       |         Milestone:  2.0.0
Component:  Library API  |           Version:  git master
 Severity:  normal       |        Resolution:
 Keywords:               |        Blocked By:
 Blocking:               |  Operating System:  All
-------------------------+-------------------------------
Changes (by Olly Betts):

 * priority:  highest => normal
 * milestone:  1.5.0 => 2.0.0

Comment:

 Pushed 6380dda1bdc3b61cb6fb6153765d3ffcd262c2a2 which uses
 `std::from_chars()` to parse string to double when available.

 The main thing left to do is eliminate uses of `getenv()` from library
 code which I think is a longer term goal.  Current uses:

 * `XAPIAN_MAX_CHANGESETS` and `XAPIAN_FLUSH_THRESHOLD` in the glass
 backend.  Probably these can be left alone and they'll just go away when
 glass gets removed.  We can implement a different approach for honey when
 we implement update and replication.
 * `XAPIAN_CJK_NGRAM` (already deprecated in 1.4.11)
 * `XAPIAN_DEBUG_LOG` and `XAPIAN_DEBUG_FLAGS` in debug logging code.
 These only get checked the first time logging occurs so seem less
 problematic, and I struggle to think of a better way to specify these.

 So I don't think there's anything to do for these right now.

 Also to do:

 * Add notes to the thread safety docs about this, including which
 functions may get used which are not guaranteed to be thread-safe (e.g.
 `strerror()`), how to check if they are used (`config.h`?), etc.
 * Add section to the developer docs about what functions to avoid using
 and why
 * Add checks to `xapian-check-patch` to help prevent calls to known
 problematic functions from being introduced into the library code
-- 
Ticket URL: <https://trac.xapian.org/ticket/665#comment:24>
Xapian <https://xapian.org/>
Xapian


More information about the Xapian-tickets mailing list