Closed
Description
The motivation for this is to provide a way to obtain the local time in seconds since epoch along with a timezone offset for use in git-actor::Signature
, providing something similar to git2::Signature::now()
.
What is just a few innocent looking lines of code in C ) actually is a can full of worms, best summarized with with this comment:
quininer says
setenv
andgetenv
are not thread-safe, andlocaltime_r
will callgetenv
, which cause to data races ifsetenv
andlocaltime_r
occur at same time.To be more specific,
getenv
will return a pointer, and aftersetenv
the pointer may point to an invalid address.
In order to fix this for gitoxide
, the following should be done
-
prodash
relies on an outdated version oftime
with unsound behaviour to make itslocal-time
feature work.- In
time
0.3 handling this is greatly improved as it exposes the unsound behaviour exploited here in a compiler flag, placing support for this into the hands of the one compiling the binary. This is fair and we should do it like that
- In
- The above allows to remove an exemption from
deny.toml
and upgrade to prodash 16 - configure binary builds to add the
unsound_local_offset
config flag -
Add a(not portable) Wrap thelibc
implementation based on [libgit2
](libgit2-offset]time
implementation for now, knowing that one day it can be done properlyIt's interesting that it also excludes windows, which might work very differently and was never discussed in the the- it doesn't actually, it's a unix-only issue.time
issue
Metadata
Metadata
Assignees
Labels
No labels