Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Jeff King
On Fri, Apr 28, 2017 at 03:33:41PM +0200, Johannes Schindelin wrote: > As usual, EOF is defined as -1 in Git for Windows' context, meaning that > we look at the last entry of the sane_ctype array, which returns 0 for any > sane_istest(x,mask) test for x >= 0x80: > > /* Nothing in the

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Johannes Schindelin
Hi Peff, On Fri, 28 Apr 2017, Jeff King wrote: > On Fri, Apr 28, 2017 at 12:44:52PM +0200, Johannes Schindelin wrote: > > > > Also, what is the behavior of ungetc when we pass it EOF? > > > > According to the documentation, it would cast EOF to an unsigned char and > > push that back.

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Johannes Schindelin
Hi Peff, On Fri, 28 Apr 2017, Jeff King wrote: > On Fri, Apr 28, 2017 at 12:41:02PM +0200, Johannes Schindelin wrote: > > > But then, I guess I misunderstood what Coverity complained about: > > maybe the problem was not so much the isspace() call but that EOF is > > not being handled correctly.

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Jeff King
On Fri, Apr 28, 2017 at 12:41:02PM +0200, Johannes Schindelin wrote: > > Why? isspace(EOF) is well-defined. > > So let's look at the man page on Linux: > > These functions check whether c, which must have the value of an > unsigned char or EOF, [...] > > That is the only

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Jeff King
On Fri, Apr 28, 2017 at 12:44:52PM +0200, Johannes Schindelin wrote: > > Also, what is the behavior of ungetc when we pass it EOF? > > According to the documentation, it would cast EOF to an unsigned char and > push that back. Definitely incorrect. > > > It looks like POSIX does what we want

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Johannes Schindelin
Hi Peff, On Thu, 27 Apr 2017, Jeff King wrote: > On Wed, Apr 26, 2017 at 10:20:16PM +0200, Johannes Schindelin wrote: > > > diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c > > index 30681681c13..c0d88f97512 100644 > > --- a/builtin/mailsplit.c > > +++ b/builtin/mailsplit.c > > @@ -232,7

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Johannes Schindelin
Hi Hannes, On Thu, 27 Apr 2017, Johannes Sixt wrote: > Am 26.04.2017 um 22:20 schrieb Johannes Schindelin: > > > diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c > > index 30681681c13..c0d88f97512 100644 > > --- a/builtin/mailsplit.c > > +++ b/builtin/mailsplit.c > > @@ -232,7 +232,7 @@

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-28 Thread Johannes Schindelin
Hi Junio, On Wed, 26 Apr 2017, Junio C Hamano wrote: > Johannes Schindelin writes: > > > Reported via Coverity. > > > > Signed-off-by: Johannes Schindelin > > --- > > builtin/mailsplit.c | 2 +- > > mailinfo.c | 2 +- > > 2

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-27 Thread Jeff King
On Wed, Apr 26, 2017 at 10:20:16PM +0200, Johannes Schindelin wrote: > diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c > index 30681681c13..c0d88f97512 100644 > --- a/builtin/mailsplit.c > +++ b/builtin/mailsplit.c > @@ -232,7 +232,7 @@ static int split_mbox(const char *file, const char

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-27 Thread Johannes Sixt
Am 26.04.2017 um 22:20 schrieb Johannes Schindelin: Reported via Coverity. Signed-off-by: Johannes Schindelin --- builtin/mailsplit.c | 2 +- mailinfo.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/mailsplit.c

Re: [PATCH 10/26] Check for EOF while parsing mails

2017-04-27 Thread Junio C Hamano
Johannes Schindelin writes: > Reported via Coverity. > > Signed-off-by: Johannes Schindelin > --- > builtin/mailsplit.c | 2 +- > mailinfo.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) Good find. I'd retitle with

[PATCH 10/26] Check for EOF while parsing mails

2017-04-26 Thread Johannes Schindelin
Reported via Coverity. Signed-off-by: Johannes Schindelin --- builtin/mailsplit.c | 2 +- mailinfo.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index 30681681c13..c0d88f97512 100644 ---