[PATCH v2 4/4] banned.h: mark strncpy() as banned

2018-07-24 Thread Jeff King
The strncpy() function is less horrible than strcpy(), but is still pretty easy to misuse because of its funny termination semantics. Namely, that if it truncates it omits the NUL terminator, and you must remember to add it yourself. Even if you use it correctly, it's sometimes hard for a reader

[PATCH v2 3/4] banned.h: mark sprintf() as banned

2018-07-24 Thread Jeff King
The sprintf() function (and its variadic form vsprintf) make it easy to accidentally introduce a buffer overflow. If you're thinking of using them, you're better off either using a dynamic string (strbuf or xstrfmt), or xsnprintf if you really know that you won't overflow. The last sprintf() call

[PATCH v2 2/4] banned.h: mark strcat() as banned

2018-07-24 Thread Jeff King
The strcat() function has all of the same overflow problems as strcpy(). And as a bonus, it's easy to end up accidentally quadratic, as each subsequent call has to walk through the existing string. The last strcat() call went away in f063d38b80 (daemon: use cld->env_array when re-spawning,

[PATCH v2 1/4] automatically ban strcpy()

2018-07-24 Thread Jeff King
There are a few standard C functions (like strcpy) which are easy to misuse. E.g.: char path[PATH_MAX]; strcpy(path, arg); may overflow the "path" buffer. Sometimes there's an earlier constraint on the size of "arg", but even in such a case it's hard to verify that the code is correct. If

[PATCH v2 0/4] fail compilation with strcpy

2018-07-24 Thread Jeff King
On Thu, Jul 19, 2018 at 04:32:59PM -0400, Jeff King wrote: > This is a patch series to address the discussion in the thread at: > > https://public-inbox.org/git/20180713204350.ga16...@sigill.intra.peff.net/ > > Basically, the question was: can we declare strcpy banned and have a > linter save

Re: [PATCH 0/1] t7406: avoid failures solely due to timing issues

2018-07-24 Thread Torsten Bögershausen
On Mon, Jul 23, 2018 at 12:10:24PM -0700, Junio C Hamano wrote: > "Johannes Schindelin via GitGitGadget" > writes: > > > This fixes a regression test that produces false positives occasionally: > > https://git-for-windows.visualstudio.com/git/_build/results?buildId=14035=logs > > > > [jc:

[PATCH] gitk: fix MacOS 10.14 "Mojave" crash on launch

2018-07-24 Thread Eric Sunshine
On MacOS, a "wish" application started from the terminal opens in the background, thus doesn't match user expectation that a newly-launched application ought to be placed in the foreground. To address this shortcoming, both gitk and git-gui use Apple Events to send a message to "System Events"

Re: [PATCH v2] Makefile: add a DEVOPTS flag to get pedantic compilation

2018-07-24 Thread Beat Bolli
On 23.07.18 20:53, Junio C Hamano wrote: > Beat Bolli writes: > >> In the interest of code hygiene, make it easier to compile Git with the >> flag -pedantic. >> >> Pure pedantic compilation with GCC 7.3 results in one warning per use of >> the translation macro `N_`: >> >> warning: array

<    1   2