.git/info/exclude w/ CFLF fails in cygwin

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Date: Friday, September 7, 2007 - 9:01 pm

(1.5.3.1 in cygwin, Win XP)
I have cygwin configured to operate in the DOS/text mode, which means
cygwin translates LF to CRLF when writing a file, and CRLF to LF when
reading.  Unfortunately cygwin's fstat() implementation doesn't take the
mode into account when reporting stat.st_size, presumably for the sake
of performance, while read() does actually do the conversion.

That causes the function add_excludes_from_file_1() in dir.c to reject a
.git/info/exclude file with CRLF ending, because the size actually read
is not the same as the size reported by fstat().

The simplest fix I have found is to explicitly open the exclude file in
binary mode, because the rest of the exclude file parsing code actually
deals with CRLF quite fine.

I would submit a patch but I am not sure if this is the appropriate fix.

By the way, parsing .git/config with CRLF in the same environment works
fine because the code reads the file by byte and doesn't do any size
validation.

Any thoughts?
-- 
Jing Xue

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
.git/info/exclude w/ CFLF fails in cygwin, Jing Xue, (Fri Sep 7, 9:01 pm)
Re: .git/info/exclude w/ CFLF fails in cygwin, Robin Rosenberg, (Sat Sep 8, 6:36 am)
Re: .git/info/exclude w/ CRLF fails in cygwin, Jing Xue, (Sun Sep 9, 9:14 am)
Re: .git/info/exclude w/ CRLF fails in cygwin, Robin Rosenberg, (Sun Sep 9, 10:56 am)