Skip to content

Commit 651aef3

Browse files
drafnelgitster
authored andcommitted
Makefile: add a note about the NO_MMAP setting on IRIX and IRIX64
When git is compiled with the MIPSpro 7.4.4m compiler, and NO_PTHREADS is set, and NO_MMAP is _not_ set, then git segfaults when trying to access the first entry in a reflog. If NO_PTHREADS is not set (which implies that the pthread library is linked in), or NO_MMAP _is_ set, then the segfault is not encountered. The conservative choice has been made to set NO_MMAP in the Makefile to avoid this flaw. The GNU C compiler does not produce this behavior. The segfault happens in refs.c:read_ref_at(). The mmap succeeds, and the loop is executed properly until rec is rewound into the first line (reflog entry) of the file. The segfault is caught by test 28 of t1400-update-ref.sh which fails when 'git rev-parse --verify "master@{May 25 2005}"' is called. So, add a comment in the Makefile to describe why NO_MMAP is set and as a hint to those who may be interested in unsetting it. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 817350d commit 651aef3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,12 @@ ifeq ($(uname_S),IRIX)
841841
NO_MEMMEM = YesPlease
842842
NO_MKSTEMPS = YesPlease
843843
NO_MKDTEMP = YesPlease
844+
# When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
845+
# (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
846+
# git dies with a segmentation fault when trying to access the first
847+
# entry of a reflog. The conservative choice is made to always set
848+
# NO_MMAP. If you suspect that your compiler is not affected by this
849+
# issue, comment out the NO_MMAP statement.
844850
NO_MMAP = YesPlease
845851
NO_EXTERNAL_GREP = UnfortunatelyYes
846852
SNPRINTF_RETURNS_BOGUS = YesPlease
@@ -855,6 +861,12 @@ ifeq ($(uname_S),IRIX64)
855861
NO_MEMMEM = YesPlease
856862
NO_MKSTEMPS = YesPlease
857863
NO_MKDTEMP = YesPlease
864+
# When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
865+
# (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
866+
# git dies with a segmentation fault when trying to access the first
867+
# entry of a reflog. The conservative choice is made to always set
868+
# NO_MMAP. If you suspect that your compiler is not affected by this
869+
# issue, comment out the NO_MMAP statement.
858870
NO_MMAP = YesPlease
859871
NO_EXTERNAL_GREP = UnfortunatelyYes
860872
SNPRINTF_RETURNS_BOGUS = YesPlease

0 commit comments

Comments
 (0)