[PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup
OpenSSL version 0.9.6b and before defined the function HMAC_cleanup. Newer versions define HMAC_CTX_cleanup. Check for HMAC_CTX_cleanup and fall back to HMAC_cleanup when the newer function is missing. Signed-off-by: Reuben Hawkins --- Makefile | 6 ++ configure.ac | 4 git-compat-util.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/Makefile b/Makefile index 57e33f2..2ce1f1f 100644 --- a/Makefile +++ b/Makefile @@ -341,6 +341,9 @@ all:: # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt. # # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC in librt. +# +# Define NO_HMAC_CTX_CLEANUP if your OpenSSL is version 0.9.6b or earlier to +# cleanup the HMAC context with the older HMAC_cleanup function. GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -1061,6 +1064,9 @@ ifndef NO_OPENSSL ifdef NEEDS_CRYPTO_WITH_SSL OPENSSL_LIBSSL += -lcrypto endif + ifdef NO_HMAC_CTX_CLEANUP + BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP + endif else BASIC_CFLAGS += -DNO_OPENSSL BLK_SHA1 = 1 diff --git a/configure.ac b/configure.ac index c3293b9..9c66c3e 100644 --- a/configure.ac +++ b/configure.ac @@ -924,6 +924,10 @@ AC_CHECK_LIB([iconv], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) # +# Define NO_HMAC_CTX_CLEANUP=YesPlease if HMAC_CTX_cleanup is missing. +AC_CHECK_LIB([crypto], [HMAC_CTX_cleanup], + [], [GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP], [YesPlease])]) +# # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. GIT_CHECK_FUNC(clock_gettime, [HAVE_CLOCK_GETTIME=YesPlease], diff --git a/git-compat-util.h b/git-compat-util.h index 400e921..2fdca2d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -213,6 +213,9 @@ extern char *gitbasename(char *); #ifndef NO_OPENSSL #include #include +#ifdef NO_HMAC_CTX_CLEANUP +#define HMAC_CTX_cleanup HMAC_cleanup +#endif #endif /* On most systems would have given us this, but -- 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC
The checks will override and unset YesPlease settings for HAVE_CLOCK_GETTIME and HAVE_CLOCK_MONOTONIC in config.mak.uname. CLOCK_MONOTONIC isn't available on RHEL3, but there are still RHEL3 systems being used in production. Signed-off-by: Reuben Hawkins --- Makefile | 6 ++ config.mak.uname | 1 + configure.ac | 22 ++ trace.c | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7482a4d..57e33f2 100644 --- a/Makefile +++ b/Makefile @@ -339,6 +339,8 @@ all:: # return NULL when it receives a bogus time_t. # # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt. +# +# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC in librt. GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -1382,6 +1384,10 @@ ifdef HAVE_CLOCK_GETTIME EXTLIBS += -lrt endif +ifdef HAVE_CLOCK_MONOTONIC + BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC +endif + ifeq ($(TCLTK_PATH),) NO_TCLTK = NoThanks endif diff --git a/config.mak.uname b/config.mak.uname index a2f380f..926773e 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -35,6 +35,7 @@ ifeq ($(uname_S),Linux) LIBC_CONTAINS_LIBINTL = YesPlease HAVE_DEV_TTY = YesPlease HAVE_CLOCK_GETTIME = YesPlease + HAVE_CLOCK_MONOTONIC = YesPlease endif ifeq ($(uname_S),GNU/kFreeBSD) HAVE_ALLOCA_H = YesPlease diff --git a/configure.ac b/configure.ac index 210eb4e..c3293b9 100644 --- a/configure.ac +++ b/configure.ac @@ -924,6 +924,28 @@ AC_CHECK_LIB([iconv], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) # +# Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. +GIT_CHECK_FUNC(clock_gettime, + [HAVE_CLOCK_GETTIME=YesPlease], + [HAVE_CLOCK_GETTIME=]) +GIT_CONF_SUBST([HAVE_CLOCK_GETTIME]) + +AC_DEFUN([CLOCK_MONOTONIC_SRC], [ +AC_LANG_PROGRAM([[ +#include +clockid_t id = CLOCK_MONOTONIC; +]])]) + +# +# Define HAVE_CLOCK_MONOTONIC=YesPlease if CLOCK_MONOTONIC is available. +AC_MSG_CHECKING([for CLOCK_MONOTONIC]) +AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC], + [AC_MSG_RESULT([yes]) + HAVE_CLOCK_MONOTONIC=YesPlease], + [AC_MSG_RESULT([no]) + HAVE_CLOCK_MONOTONIC=]) +GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC]) +# # Define NO_SETITIMER if you don't have setitimer. GIT_CHECK_FUNC(setitimer, [NO_SETITIMER=], diff --git a/trace.c b/trace.c index 4778608..bfbd48f 100644 --- a/trace.c +++ b/trace.c @@ -324,7 +324,7 @@ int trace_want(struct trace_key *key) return !!get_trace_fd(key); } -#ifdef HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC) static inline uint64_t highres_nanos(void) { -- 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat'
Detect 'tv_nsec' field in 'struct stat' and set Makefile variable NO_NSEC appropriately. A side-effect of the above detection is that we also determine whether 'stat.st_mtimespec' is available, so, as a bonus, set the Makefile variable USE_ST_TIMESPEC, as well. Signed-off-by: Reuben Hawkins --- configure.ac | 13 + 1 file changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index 6af9647..210eb4e 100644 --- a/configure.ac +++ b/configure.ac @@ -754,6 +754,19 @@ AC_CHECK_TYPES([struct itimerval], [#include ]) GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL]) # +# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exists. +# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor +# stat.st_mtimespec.tv_nsec exists. +AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec]) +AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec]) +if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes ; then + USE_ST_TIMESPEC=YesPlease + GIT_CONF_SUBST([USE_ST_TIMESPEC]) +elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes ; then + NO_NSEC=YesPlease + GIT_CONF_SUBST([NO_NSEC]) +fi +# # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. AC_CHECK_MEMBER(struct dirent.d_ino, [NO_D_INO_IN_DIRENT=], -- 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC
On Wed, Jan 7, 2015 at 1:37 PM, Eric Sunshine wrote: > On Wed, Jan 7, 2015 at 3:23 PM, Reuben Hawkins wrote: >> CLOCK_MONOTONIC isn't available on RHEL3, but there are still RHEL3 >> systems being used in production. This change makes compiling git >> less tedious on older platforms without CLOCK_MONOTONIC. > > The second sentence is implied by the very presence of this patch, > thus adds no value. I, personally, would drop it. > > Also, your sign-off is missing (as mentioned in my previous review[1]). > >> --- >> diff --git a/Makefile b/Makefile >> index 7482a4d..af551a0 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -1382,6 +1382,10 @@ ifdef HAVE_CLOCK_GETTIME >> EXTLIBS += -lrt >> endif >> >> +ifdef HAVE_CLOCK_MONOTONIC >> + BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC >> +endif > > You need to document this new Makefile variable (HAVE_CLOCK_MONOTONIC) > at the top of Makefile (as mentioned in my previous review[1]), so > that people who build without running 'configure' will know that they > may need to tweak it. > >> ifeq ($(TCLTK_PATH),) >> NO_TCLTK = NoThanks >> endif >> diff --git a/configure.ac b/configure.ac >> index dcc4bf0..424dec5 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -923,6 +923,28 @@ AC_CHECK_LIB([iconv], [locale_charset], >> [CHARSET_LIB=-lcharset])]) >> GIT_CONF_SUBST([CHARSET_LIB]) >> # >> +# Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. >> +GIT_CHECK_FUNC(clock_gettime, >> +[HAVE_CLOCK_GETTIME=YesPlease], >> +[HAVE_CLOCK_GETTIME=]) >> +GIT_CONF_SUBST([HAVE_CLOCK_GETTIME]) > > You could simplify the above four lines to this one-liner: > > GIT_CHECK_FUNC(clock_gettime, > GIT_CONF_SUBST([HAVE_CLOCK_GETTIME], [YesPlease])) > >> + >> +AC_DEFUN([CLOCK_MONOTONIC_SRC], [ >> +AC_LANG_PROGRAM([[ >> +#include >> +clockid_t id = CLOCK_MONOTONIC; >> +]], [])]) > > No need to pass empty trailing arguments in m4. It's customary to drop > them altogether (since they are implied). > >> +# >> +# Define HAVE_CLOCK_MONOTONIC=YesPlease if CLOCK_MONOTONIC is available. >> +AC_MSG_CHECKING([for CLOCK_MONOTONIC]) >> +AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC], >> + [AC_MSG_RESULT([yes]) >> + HAVE_CLOCK_MONOTONIC=YesPlease], >> + [AC_MSG_RESULT([no]) >> + HAVE_CLOCK_MONOTONIC=]) >> +GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC]) > > Ditto regarding simplification: > > AC_MSG_CHECKING([for CLOCK_MONOTONIC]) > AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC], > [AC_MSG_RESULT([yes]) > GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC], [YesPlease])], > [AC_MSG_RESULT([no])]) I *think* there's an issue with this simplification as used right here. In the 'no' case, HAVE_CLOCK_MONOTONIC *must* be undefined by setting it equal to nothing HAVE_CLOCK_MONOTONIC= So that the setting in config.mak.uname 'HAVE_CLOCK_MONOTINIC = YesPlease' will be overridden. So this one needs to stay as is. > >> +# >> # Define NO_SETITIMER if you don't have setitimer. >> GIT_CHECK_FUNC(setitimer, >> [NO_SETITIMER=], > > [1]: http://article.gmane.org/gmane.comp.version-control.git/261630 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] configure.ac: check tv_nsec field in struct stat
On Wed, Jan 7, 2015 at 1:19 PM, Eric Sunshine wrote: > On Wed, Jan 7, 2015 at 3:23 PM, Reuben Hawkins wrote: >> This check will automatically set the correct NO_NSEC setting. > > This commit message neglects to mention the important point that > you're also now setting USE_ST_TIMESPEC when detected. You might > revise the message like this: > > Detect 'tv_nsec' field in 'struct stat' and set Makefile variable > NO_NSEC appropriately. > > A side-effect of the above detection is that we also determine > whether 'stat.st_mtimespec' is available, so, as a bonus, set the > Makefile variable USE_ST_TIMESPEC, as well. I see you're single quoted 'tv_nsec' and 'struct stat'. Should I also use single quotes in the first line of the commit msg like this... configure.ac: check 'tv_nsec' field in 'struct stat' ? > > Also, your sign-off is missing (as mentioned in my previous review[1]). > > [1]: http://article.gmane.org/gmane.comp.version-control.git/261626 > >> --- >> configure.ac | 12 >> 1 file changed, 12 insertions(+) >> >> diff --git a/configure.ac b/configure.ac >> index 6af9647..dcc4bf0 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -754,6 +754,18 @@ AC_CHECK_TYPES([struct itimerval], >> [#include ]) >> GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL]) >> # >> +# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exist > > It would be slightly more accurate to drop the ".tv_nsec" bit from this > comment. > > Also: s/exist/exists./ > >> +# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor >> stat.st_mtimespec.tv_nsec exist > > Perhaps wrap this long comment over two lines. > > Also: s/exist/exist./ > >> +AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec]) >> +AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec]) >> +if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes ; then >> + USE_ST_TIMESPEC=YesPlease >> + GIT_CONF_SUBST([USE_ST_TIMESPEC]) >> +elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes ; then >> + NO_NSEC=YesPlease >> + GIT_CONF_SUBST([NO_NSEC]) >> +fi >> +# >> # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. >> AC_CHECK_MEMBER(struct dirent.d_ino, >> [NO_D_INO_IN_DIRENT=], >> -- >> 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] configure.ac: check tv_nsec field in struct stat
On Wed, Jan 7, 2015 at 1:19 PM, Eric Sunshine wrote: > On Wed, Jan 7, 2015 at 3:23 PM, Reuben Hawkins wrote: >> This check will automatically set the correct NO_NSEC setting. > > This commit message neglects to mention the important point that > you're also now setting USE_ST_TIMESPEC when detected. You might > revise the message like this: > > Detect 'tv_nsec' field in 'struct stat' and set Makefile variable > NO_NSEC appropriately. > > A side-effect of the above detection is that we also determine > whether 'stat.st_mtimespec' is available, so, as a bonus, set the > Makefile variable USE_ST_TIMESPEC, as well. > > Also, your sign-off is missing (as mentioned in my previous review[1]). > > [1]: http://article.gmane.org/gmane.comp.version-control.git/261626 > >> --- >> configure.ac | 12 >> 1 file changed, 12 insertions(+) >> >> diff --git a/configure.ac b/configure.ac >> index 6af9647..dcc4bf0 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -754,6 +754,18 @@ AC_CHECK_TYPES([struct itimerval], >> [#include ]) >> GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL]) >> # >> +# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exist > > It would be slightly more accurate to drop the ".tv_nsec" bit from this > comment. The AC_CHECK_MEMBER is checking for st_mtimespec.tv_nsec. If I drop tv_nsec from the comment should I also drop it in the check? I thought it was better to be very explicit because the code using the check is using that .tv_nsec field...I figured the check may as well do exactly what the code is doing... > > Also: s/exist/exists./ > >> +# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor >> stat.st_mtimespec.tv_nsec exist > > Perhaps wrap this long comment over two lines. > > Also: s/exist/exist./ > >> +AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec]) >> +AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec]) >> +if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes ; then >> + USE_ST_TIMESPEC=YesPlease >> + GIT_CONF_SUBST([USE_ST_TIMESPEC]) >> +elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes ; then >> + NO_NSEC=YesPlease >> + GIT_CONF_SUBST([NO_NSEC]) >> +fi >> +# >> # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. >> AC_CHECK_MEMBER(struct dirent.d_ino, >> [NO_D_INO_IN_DIRENT=], >> -- >> 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup
OpenSSL version 0.9.6b and before defined the function HMAC_cleanup. Newer versions define HMAC_CTX_cleanup. Check for HMAC_CTX_cleanup and fall back to HMAC_cleanup when the newer function is missing. --- Makefile | 3 +++ configure.ac | 7 +++ git-compat-util.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/Makefile b/Makefile index af551a0..d3c2b58 100644 --- a/Makefile +++ b/Makefile @@ -1059,6 +1059,9 @@ ifndef NO_OPENSSL ifdef NEEDS_CRYPTO_WITH_SSL OPENSSL_LIBSSL += -lcrypto endif + ifdef NO_HMAC_CTX_CLEANUP + BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP + endif else BASIC_CFLAGS += -DNO_OPENSSL BLK_SHA1 = 1 diff --git a/configure.ac b/configure.ac index 424dec5..c282663 100644 --- a/configure.ac +++ b/configure.ac @@ -923,6 +923,13 @@ AC_CHECK_LIB([iconv], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) # +# Define NO_HMAC_CTX_CLEANUP=YesPlease if HMAC_CTX_cleanup is missing. +AC_CHECK_LIB([crypto], [HMAC_CTX_cleanup], + [NO_HMAC_CTX_CLEANUP=], + [NO_HMAC_CTX_CLEANUP=YesPlease], + []) +GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP]) +# # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. GIT_CHECK_FUNC(clock_gettime, [HAVE_CLOCK_GETTIME=YesPlease], diff --git a/git-compat-util.h b/git-compat-util.h index 400e921..2fdca2d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -213,6 +213,9 @@ extern char *gitbasename(char *); #ifndef NO_OPENSSL #include #include +#ifdef NO_HMAC_CTX_CLEANUP +#define HMAC_CTX_cleanup HMAC_cleanup +#endif #endif /* On most systems would have given us this, but -- 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] configure.ac: check tv_nsec field in struct stat
This check will automatically set the correct NO_NSEC setting. --- configure.ac | 12 1 file changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index 6af9647..dcc4bf0 100644 --- a/configure.ac +++ b/configure.ac @@ -754,6 +754,18 @@ AC_CHECK_TYPES([struct itimerval], [#include ]) GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL]) # +# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exist +# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor stat.st_mtimespec.tv_nsec exist +AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec]) +AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec]) +if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes ; then + USE_ST_TIMESPEC=YesPlease + GIT_CONF_SUBST([USE_ST_TIMESPEC]) +elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes ; then + NO_NSEC=YesPlease + GIT_CONF_SUBST([NO_NSEC]) +fi +# # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. AC_CHECK_MEMBER(struct dirent.d_ino, [NO_D_INO_IN_DIRENT=], -- 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
v2 patches for fixes on RHEL3
These patches add a few autoconfig checks for nanosecond resolution fields in struct stat, CLOCK_MONOTONIC, and HMAC_CTX_cleanup. I'm fairly sure I've fixed the concerns/doubts the first set of patched raised. (I rarely use git-send-email so forgive me if I botch this) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC
CLOCK_MONOTONIC isn't available on RHEL3, but there are still RHEL3 systems being used in production. This change makes compiling git less tedious on older platforms without CLOCK_MONOTONIC. --- Makefile | 4 config.mak.uname | 1 + configure.ac | 22 ++ trace.c | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7482a4d..af551a0 100644 --- a/Makefile +++ b/Makefile @@ -1382,6 +1382,10 @@ ifdef HAVE_CLOCK_GETTIME EXTLIBS += -lrt endif +ifdef HAVE_CLOCK_MONOTONIC + BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC +endif + ifeq ($(TCLTK_PATH),) NO_TCLTK = NoThanks endif diff --git a/config.mak.uname b/config.mak.uname index a2f380f..926773e 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -35,6 +35,7 @@ ifeq ($(uname_S),Linux) LIBC_CONTAINS_LIBINTL = YesPlease HAVE_DEV_TTY = YesPlease HAVE_CLOCK_GETTIME = YesPlease + HAVE_CLOCK_MONOTONIC = YesPlease endif ifeq ($(uname_S),GNU/kFreeBSD) HAVE_ALLOCA_H = YesPlease diff --git a/configure.ac b/configure.ac index dcc4bf0..424dec5 100644 --- a/configure.ac +++ b/configure.ac @@ -923,6 +923,28 @@ AC_CHECK_LIB([iconv], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) # +# Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. +GIT_CHECK_FUNC(clock_gettime, +[HAVE_CLOCK_GETTIME=YesPlease], +[HAVE_CLOCK_GETTIME=]) +GIT_CONF_SUBST([HAVE_CLOCK_GETTIME]) + +AC_DEFUN([CLOCK_MONOTONIC_SRC], [ +AC_LANG_PROGRAM([[ +#include +clockid_t id = CLOCK_MONOTONIC; +]], [])]) + +# +# Define HAVE_CLOCK_MONOTONIC=YesPlease if CLOCK_MONOTONIC is available. +AC_MSG_CHECKING([for CLOCK_MONOTONIC]) +AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC], + [AC_MSG_RESULT([yes]) + HAVE_CLOCK_MONOTONIC=YesPlease], + [AC_MSG_RESULT([no]) + HAVE_CLOCK_MONOTONIC=]) +GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC]) +# # Define NO_SETITIMER if you don't have setitimer. GIT_CHECK_FUNC(setitimer, [NO_SETITIMER=], diff --git a/trace.c b/trace.c index 4778608..bfbd48f 100644 --- a/trace.c +++ b/trace.c @@ -324,7 +324,7 @@ int trace_want(struct trace_key *key) return !!get_trace_fd(key); } -#ifdef HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC) static inline uint64_t highres_nanos(void) { -- 2.2.0.68.g8f72f0c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] configure.ac,trace.c: check for CLOCK_MONOTONIC
On Sun, Dec 21, 2014 at 8:12 PM, brian m. carlson wrote: > On Sun, Dec 21, 2014 at 10:53:35AM -0800, Reuben Hawkins wrote: >> CLOCK_MONOTONIC isn't available on RHEL3, but there are still RHEL3 >> systems being used in production. This change makes compiling git >> less tedious on older platforms. > > While I'm not opposed to this change, I expect that you'll find there's > lots of subtle breakage when trying to compile (and run the testsuite > for) git on RHEL 3. I've spoken up before to prevent breakage on > RHEL/CentOS 5 (since $DAYJOB still supports it), but I'm not sure > anyone's looking out for something as old as RHEL 3. I expect you'll > probably have some pain points with perl and curl, among others. Yes, there are pain points with perl and curl. Those I've disable with other compile options when building on RHEL3, but reducing the number of options I have to set manually and increasing the number of automatic checks with configure is helpful. Sometime over the next few days I'll submit a v2 of the patches with Eric's comments taken into account. > -- > brian m. carlson / brian with sandals: Houston, Texas, US > +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only > OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] configure.ac,trace.c: check for CLOCK_MONOTONIC
CLOCK_MONOTONIC isn't available on RHEL3, but there are still RHEL3 systems being used in production. This change makes compiling git less tedious on older platforms. --- configure.ac | 26 ++ trace.c | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3cfdd51..3900044 100644 --- a/configure.ac +++ b/configure.ac @@ -736,8 +736,10 @@ GIT_UNSTASH_FLAGS($ICONVDIR) GIT_CONF_SUBST([OLD_ICONV]) + ## Checks for typedefs, structures, and compiler characteristics. AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics]) + # TYPE_SOCKLEN_T case $ac_cv_type_socklen_t in @@ -930,6 +932,30 @@ AC_CHECK_LIB([iconv], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) # +# Define NO_CLOCK_GETTIME if you don't have clock_gettime. +GIT_CHECK_FUNC(clock_gettime, +[HAVE_CLOCK_GETTIME=Yes], +[HAVE_CLOCK_GETTIME=]) +GIT_CONF_SUBST([HAVE_CLOCK_GETTIME]) + +AC_DEFUN([CLOCK_MONOTONIC_SRC], [ +AC_LANG_PROGRAM([[ +#include +clockid_t id = CLOCK_MONOTONIC; +]], [])]) + +# +# Define NO_CLOCK_MONOTONIC on really old systems that are still in production +# if you need GIT to compile but can't update the machine otherwise. +AC_MSG_CHECKING([for CLOCK_MONOTONIC]) +AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC], + [AC_MSG_RESULT([yes]) + HAVE_CLOCK_MONOTONIC=Yes], + [AC_MSG_RESULT([no]) + HAVE_CLOCK_MONOTONIC=]) + +GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC]) +# # Define NO_SETITIMER if you don't have setitimer. GIT_CHECK_FUNC(setitimer, [NO_SETITIMER=], diff --git a/trace.c b/trace.c index 4778608..bfbd48f 100644 --- a/trace.c +++ b/trace.c @@ -324,7 +324,7 @@ int trace_want(struct trace_key *key) return !!get_trace_fd(key); } -#ifdef HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC) static inline uint64_t highres_nanos(void) { -- 2.2.0.GIT -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] configure.ac,imap-send.c: check HMAC_CTX_cleanup
Older versions of OpenSSL have HMAC_cleanup, but not HMAC_CTX_cleanup. This change checks for both, uses HMAC_CTX_cleanup on platforms which have it, otherwise falls back to HMAC_cleanup. This changes makes building GIT on older platforms less tedious. --- Makefile | 6 ++ configure.ac | 13 + imap-send.c | 6 ++ 3 files changed, 25 insertions(+) diff --git a/Makefile b/Makefile index 7482a4d..a495d94 100644 --- a/Makefile +++ b/Makefile @@ -1059,6 +1059,12 @@ ifndef NO_OPENSSL ifdef NEEDS_CRYPTO_WITH_SSL OPENSSL_LIBSSL += -lcrypto endif + ifdef HAVE_HMAC_CTX_CLEANUP + BASIC_CFLAGS += -DHAVE_HMAC_CTX_CLEANUP + endif + ifdef HAVE_HMAC_CLEANUP + BASIC_CFLAGS += -DHAVE_HMAC_CLEANUP + endif else BASIC_CFLAGS += -DNO_OPENSSL BLK_SHA1 = 1 diff --git a/configure.ac b/configure.ac index 3900044..b22788c 100644 --- a/configure.ac +++ b/configure.ac @@ -899,6 +899,7 @@ GIT_CONF_SUBST([SNPRINTF_RETURNS_BOGUS]) ## Checks for library functions. ## (in default C library and libraries checked by AC_CHECK_LIB) AC_MSG_NOTICE([CHECKS for library functions]) + # # Define NO_LIBGEN_H if you don't have libgen.h. AC_CHECK_HEADER([libgen.h], @@ -932,6 +933,18 @@ AC_CHECK_LIB([iconv], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) # +# Define HAVE_HMAC_CTX_CLEANUP=Yes if we have the newer HMAC cleanup function +AC_CHECK_LIB([crypto], [HMAC_CTX_cleanup], + [HAVE_HMAC_CTX_CLEANUP=Yes], + [], []) +GIT_CONF_SUBST([HAVE_HMAC_CTX_CLEANUP]) +# +# Define HAVE_HMAC_CLEANUP=Yes if we have the older HMAC cleanup function +AC_CHECK_LIB([crypto], [HMAC_cleanup], + [HAVE_HMAC_CLEANUP=Yes], + [], []) +GIT_CONF_SUBST([HAVE_HMAC_CLEANUP]) +# # Define NO_CLOCK_GETTIME if you don't have clock_gettime. GIT_CHECK_FUNC(clock_gettime, [HAVE_CLOCK_GETTIME=Yes], diff --git a/imap-send.c b/imap-send.c index 70bcc7a..eec2378 100644 --- a/imap-send.c +++ b/imap-send.c @@ -861,7 +861,13 @@ static char *cram(const char *challenge_64, const char *user, const char *pass) HMAC_Init(&hmac, (unsigned char *)pass, strlen(pass), EVP_md5()); HMAC_Update(&hmac, (unsigned char *)challenge, decoded_len); HMAC_Final(&hmac, hash, NULL); +#if defined(HAVE_HMAC_CTX_CLEANUP) HMAC_CTX_cleanup(&hmac); +#elif defined(HAVE_HMAC_CLEANUP) + HMAC_cleanup(&hmac); +#else +# error "no HMAC_cleanup function" +#endif hex[32] = 0; for (i = 0; i < 16; i++) { -- 2.2.0.GIT -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] configure.ac: check tv_nsec field in struct stat
This check will automatically set the correct NO_NSEC setting. --- configure.ac | 19 +++ 1 file changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index 6af9647..3cfdd51 100644 --- a/configure.ac +++ b/configure.ac @@ -754,6 +754,25 @@ AC_CHECK_TYPES([struct itimerval], [#include ]) GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL]) # +# Define HAVE_ST_MTIM=No if you don't have struct stat.st_mtim.tv_nsec. +AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec], +[HAVE_ST_MTIM=Yes], +[HAVE_ST_MTIM=No], +[#include ]) +# +# Define HAVE_ST_MTIMESPEC=No if you don't have struct stat.st_mtimespec.tv_nsec. +AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec], +[HAVE_ST_MTIMESPEC=Yes], +[HAVE_ST_MTIMESPEC=No], +[#include ]) +# +# Define NO_NSEC if both HAVE_ST_MTIMESPEC and HAVE_ST_MTIM are set to No. +if test '(' "$HAVE_ST_MTIM" = "No" ')' -a '(' "$HAVE_ST_MTIMESPEC" = "No" ')' ; then + NO_NSEC=YesPlease + GIT_CONF_SUBST([NO_NSEC]) +fi + +# # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. AC_CHECK_MEMBER(struct dirent.d_ino, [NO_D_INO_IN_DIRENT=], -- 2.2.0.GIT -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Makefile: add NO_CLOCK_GETTIME check
Some really old platforms, rhel3, which don't define CLOCK_MONOTONIC, still need a way to build git. Some high resolution timer code was added Jul 12, 2014 to aid debugging performance issues. That code uses clock_gettime and CLOCK_MONOTONIC. That change breaks building git on ancient platforms which don't support CLOCK_MONOTONIC, so a way to disable that code is needed. To use this feature... $ make NO_CLOCK_GETTIME=1 This change amends the commit... commit 148d6771bf5e00aa1d7fa2221507a3dfe4c1e37f Author: Karsten Blees Date: Sat Jul 12 02:05:42 2014 +0200 trace: add high resolution timer function to debug performance issues --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 9f984a9..0c1c8cf 100644 --- a/Makefile +++ b/Makefile @@ -1502,10 +1502,12 @@ ifdef GMTIME_UNRELIABLE_ERRORS BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS endif +ifndef NO_CLOCK_GETTIME ifdef HAVE_CLOCK_GETTIME BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME EXTLIBS += -lrt endif +endif ifeq ($(TCLTK_PATH),) NO_TCLTK = NoThanks -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] fast-import.c: always honor the filename case
fast-import should not use strncmp_icase. When it does, files with similar names, but different case can be lost in the import. For example... M 100644 :1 FileName.txt D Filename.txt ...would end up deleting FileName from the index during the fast- import when strncmp_icase is used and core.ignorecase=true. The intent in the above snippet is to rename the file, not delete it. Replacing strncmp_icase with strncmp in fast-import.c fixes the issue. alternatives: * check if the filesystem is case-preserving. If it is, don't set core.ignorecase=true. This, however, exposes another issue where git is tricked by stat into thinking that tracked files are untracked on case-preserving and case-insensitive filesystems. --- fast-import.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fast-import.c b/fast-import.c index f4d9969..62e28c0 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1500,7 +1500,7 @@ static int tree_content_set( t = root->tree; for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; - if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) { + if (e->name->str_len == n && !strncmp(p, e->name->str_dat, n)) { if (!slash1) { if (!S_ISDIR(mode) && e->versions[1].mode == mode @@ -1593,7 +1593,7 @@ static int tree_content_remove( t = root->tree; for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; - if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) { + if (e->name->str_len == n && !strncmp(p, e->name->str_dat, n)) { if (slash1 && !S_ISDIR(e->versions[1].mode)) /* * If p names a file in some subdirectory, and a @@ -1663,7 +1663,7 @@ static int tree_content_get( t = root->tree; for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; - if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) { + if (e->name->str_len == n && !strncmp(p, e->name->str_dat, n)) { if (!slash1) goto found_entry; if (!S_ISDIR(e->versions[1].mode)) -- 1.8.5.3.1.gac93028.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] init-db.c: honor case on case preserving fs
Most case-insensitive filesystems are case-preserving. In these filesystems (such as HFS+ on OS X) you can name a file Filename.txt, then rename the file to FileName.txt. That file will be accessible by both filenames, but the case is otherwise honored. We don't want to have git ignore case on these case-preserving filesystem implementations. This change adds an additional check in init-db.c before automatically setting core.ignorecase to true. This fixes a problem where if you import an hg repository, using git-remote-hg, on two OSX systems, one with a case-sensitive fs and the other with case-insensitive fs, the sha1 commit ids of the repositories diverge on commits where a file was renamed, but only the case in the filename changes (for example renaming Filename.cpp -> FileName.cpp). The alternative solutions are * to set ignore_case to 0 in fast-import.c at runtime * explicitly use strcmp, rather than strcmp_icase (also in fast-import.c) * completely rework ignorecase into something that can handle more options (true, false, sometimes, maybe, partially, etc...) Signed-off-by: Reuben Hawkins --- builtin/init-db.c | 43 +-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/builtin/init-db.c b/builtin/init-db.c index 78aa387..34f09d8 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -288,8 +288,47 @@ static int create_default_files(const char *template_path) /* Check if the filesystem is case-insensitive */ path[len] = 0; strcpy(path + len, "CoNfIg"); - if (!access(path, F_OK)) - git_config_set("core.ignorecase", "true"); + if (!access(path, F_OK)) { + /* +* This filesystem is at least partially case-insensitive. Let's +* find out if this filesystem is completely case-insensitive. +* +* Create a CamelCase file here, make sure readdir reads a +* CamelCase file below. +*/ + int completely_insensitive_fs = 1; + char const * const case_check_filename = ".CaseCheck"; + struct dirent *dirent; + FILE *case_file; + DIR *dir; + + path[len] = 0; + strcpy(path + len, case_check_filename); + case_file = fopen(path, "w"); + if (!case_file) + die_errno(_("cannot open '%s'"), path); + fclose(case_file); + + path[len] = 0; + dir = opendir(path); + if (!dir) + die_errno(_("cannot opendir '%s'"), path); + + while ( (dirent = readdir(dir)) ) { + if (0 == strcmp(case_check_filename, dirent->d_name)) { + completely_insensitive_fs = 0; + break; + } + } + + closedir(dir); + path[len] = 0; + strcpy(path + len, case_check_filename); + unlink(path); + + if (completely_insensitive_fs) + git_config_set("core.ignorecase", "true"); + } probe_utf8_pathname_composition(path, len); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] init-db.c: factor out probe_case_sensitivity func
create_default_files was getting a bit long and indented. This particular bit of code got long enough to be its own function. Signed-off-by: Reuben Hawkins --- builtin/init-db.c | 97 + 1 file changed, 53 insertions(+), 44 deletions(-) diff --git a/builtin/init-db.c b/builtin/init-db.c index 34f09d8..bcf7f4c 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -177,6 +177,58 @@ static int git_init_db_config(const char *k, const char *v, void *cb) return 0; } +static void probe_case_sensitivity(char *path, size_t len) +{ + int completely_insensitive_fs = 1; + char const * const case_check_filename = ".CaseCheck"; + struct dirent *dirent; + FILE *case_file; + DIR *dir; + + /* +* If we can't access "config" by the name "CoNfIg", this fs is +* case sensitive...so do nothing and return. +*/ + path[len] = 0; + strcpy(path + len, "CoNfIg"); + if (access(path, F_OK)) + return; + + /* +* This filesystem is at least partially case-insensitive. Let's +* find out if this filesystem is completely case-insensitive. +* +* Create a CamelCase file here, make sure readdir reads a +* CamelCase file below. +*/ + path[len] = 0; + strcpy(path + len, case_check_filename); + case_file = fopen(path, "w"); + if (!case_file) + die_errno(_("cannot open '%s'"), path); + fclose(case_file); + + path[len] = 0; + dir = opendir(path); + if (!dir) + die_errno(_("cannot opendir '%s'"), path); + + while ( (dirent = readdir(dir)) ) { + if (0 == strcmp(case_check_filename, dirent->d_name)) { + completely_insensitive_fs = 0; + break; + } + } + + closedir(dir); + path[len] = 0; + strcpy(path + len, case_check_filename); + unlink(path); + + if (completely_insensitive_fs) + git_config_set("core.ignorecase", "true"); +} + static int create_default_files(const char *template_path) { const char *git_dir = get_git_dir(); @@ -285,50 +337,7 @@ static int create_default_files(const char *template_path) else git_config_set("core.symlinks", "false"); - /* Check if the filesystem is case-insensitive */ - path[len] = 0; - strcpy(path + len, "CoNfIg"); - if (!access(path, F_OK)) { - /* -* This filesystem is at least partially case-insensitive. Let's -* find out if this filesystem is completely case-insensitive. -* -* Create a CamelCase file here, make sure readdir reads a -* CamelCase file below. -*/ - int completely_insensitive_fs = 1; - char const * const case_check_filename = ".CaseCheck"; - struct dirent *dirent; - FILE *case_file; - DIR *dir; - - path[len] = 0; - strcpy(path + len, case_check_filename); - case_file = fopen(path, "w"); - if (!case_file) - die_errno(_("cannot open '%s'"), path); - fclose(case_file); - - path[len] = 0; - dir = opendir(path); - if (!dir) - die_errno(_("cannot opendir '%s'"), path); - - while ( (dirent = readdir(dir)) ) { - if (0 == strcmp(case_check_filename, dirent->d_name)) { - completely_insensitive_fs = 0; - break; - } - } - - closedir(dir); - path[len] = 0; - strcpy(path + len, case_check_filename); - unlink(path); - - if (completely_insensitive_fs) - git_config_set("core.ignorecase", "true"); - } + probe_case_sensitivity(path, len); probe_utf8_pathname_composition(path, len); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html