From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH v2 1/2] banned.h: mark non-reentrant gmtime, etc as banned
Date: Sun, 6 Dec 2020 15:56:42 +0100 [thread overview]
Message-ID: <20201206145642.GH8396@szeder.dev> (raw)
In-Reply-To: <20201201211138.33850-1-gitster@pobox.com>
On Tue, Dec 01, 2020 at 01:11:37PM -0800, Junio C Hamano wrote:
> From: Jeff King <peff@peff.net>
>
> The traditional gmtime(), localtime(), ctime(), and asctime() functions
> return pointers to shared storage. This means they're not thread-safe,
> and they also run the risk of somebody holding onto the result across
> multiple calls (where each call invalidates the previous result).
>
> All callers should be using their reentrant counterparts.
>
> Signed-off-by: Jeff King <peff@peff.net>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> banned.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/banned.h b/banned.h
> index 60a18d4403..ed11300bb2 100644
> --- a/banned.h
> +++ b/banned.h
> @@ -29,4 +29,13 @@
> #define vsprintf(buf,fmt,arg) BANNED(vsprintf)
> #endif
>
> +#undef gmtime
> +#define gmtime(t) BANNED(gmtime)
> +#undef localtime
> +#define localtime(t) BANNED(localtime)
> +#undef ctime
> +#define ctime(t) BANNED(ctime)
> +#undef asctime
> +#define asctime(t) BANNED(asctime)
> +
> #endif /* BANNED_H */
This patch should be queued on top of topic
'tb/bugreport-no-localtime'. Currently they are on parallel branches:
* 91aef03015 (refs/upstream/jk/banned) banned.h: mark ctime_r() and asctime_r() as banned
* 1fbfdf556f banned.h: mark non-reentrant gmtime, etc as banned
| * 4f6460df55 (refs/upstream/tb/bugreport-no-localtime) builtin/bugreport.c: use thread-safe localtime_r()
|/
* 72ffeb997e Ninth batch
and because of the not-yet-removed localtime() call in
'builtin/bugreport.c' commits 1fbfdf556f and 91aef03015 can't be
built.
next prev parent reply other threads:[~2020-12-06 14:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 23:06 [PATCH] builtin/bugreport.c: use thread-safe localtime_r() Taylor Blau
2020-12-01 0:30 ` [PATCH v2] " Taylor Blau
2020-12-01 2:27 ` Jeff King
2020-12-01 3:15 ` Eric Sunshine
2020-12-01 18:27 ` Junio C Hamano
2020-12-01 18:34 ` Taylor Blau
2020-12-01 21:11 ` [PATCH v2 1/2] banned.h: mark non-reentrant gmtime, etc as banned Junio C Hamano
2020-12-01 21:11 ` [PATCH v2 2/2] banned.h: mark ctime_r() and asctime_r() " Junio C Hamano
2020-12-01 21:16 ` Eric Sunshine
2020-12-01 22:07 ` Junio C Hamano
2020-12-01 22:22 ` Taylor Blau
2020-12-06 14:56 ` SZEDER Gábor [this message]
2020-12-02 1:57 ` [PATCH v2] builtin/bugreport.c: use thread-safe localtime_r() Jeff King
2020-12-01 0:31 ` [PATCH] " Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201206145642.GH8396@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).