Re: [PATCH 1/6] maintenance: add get_random_minute()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 8, 2023, 00:22 UTC
- Message-ID
- <xmqqzg329ycm.fsf@gitster.g>
- In-Reply-To
- <xmqq4jlabea3.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> Taylor Blau <me@ttaylorr.com> writes: > >> I was wondering where else we call srand() within Git, and it looks like >> the only other spot is in `lock_file_timeout()`. > > lock_file_timeout() should be updated to match git_mkstemps_mode(), > which was taught to use the csprng_bytes() function with 47efda96 > (wrapper: use a CSPRNG to generate random file names, 2022-01-17), > and this new caller may want to do so as well, perhaps? I dunno, > but the caller then does not have to worry about "initializing it > just once".
Of course, the obvious downside is that crypto-secure one may be, unlike for its use in mkstemps(), way overkill for lockfiles and cron dispersion purposes, as these codepaths are not on the target surface.