summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-11 10:20:39 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-11 10:20:39 -0400
commit66074ad1e21cfe6c98a70b279ed690e357d1c41c (patch)
treeb9f2f7218ee3a19dc02fe2f4dff32577a336c1be
parent537092cdbb7f4be0e6d68f4e5d65ca2a403375f9 (diff)
parent5aee26ee46d8d38759713d00ce4310a3aef4a559 (diff)
downloadtor-66074ad1e21cfe6c98a70b279ed690e357d1c41c.tar.gz
tor-66074ad1e21cfe6c98a70b279ed690e357d1c41c.zip
Merge branch 'unify_microrevision_users'
-rw-r--r--src/app/config/config.c2
-rw-r--r--src/core/include.am6
-rw-r--r--src/lib/log/git_revision.c (renamed from src/core/or/git_revision.c)10
-rw-r--r--src/lib/log/git_revision.h (renamed from src/core/or/git_revision.h)2
-rw-r--r--src/lib/log/include.am9
-rw-r--r--src/lib/log/log.c14
6 files changed, 22 insertions, 21 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 1be1803f29..74aa64dede 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -85,7 +85,7 @@
#include "feature/relay/dns.h"
#include "core/or/dos.h"
#include "feature/client/entrynodes.h"
-#include "core/or/git_revision.h"
+#include "lib/log/git_revision.h"
#include "feature/stats/geoip.h"
#include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h"
diff --git a/src/core/include.am b/src/core/include.am
index 1f37044e9a..cd9edc4493 100644
--- a/src/core/include.am
+++ b/src/core/include.am
@@ -34,7 +34,6 @@ LIBTOR_APP_A_SOURCES = \
src/core/or/connection_edge.c \
src/core/or/connection_or.c \
src/core/or/dos.c \
- src/core/or/git_revision.c \
src/core/or/policies.c \
src/core/or/protover.c \
src/core/or/reasons.c \
@@ -135,10 +134,6 @@ else
src_core_libtor_app_testing_a_SOURCES =
endif
-src/core/or/git_revision.$(OBJEXT) \
- src/core/or/src_core_libtor_app_testing_a-git_revision.$(OBJEXT): \
- micro-revision.i
-
AM_CPPFLAGS += -DSHARE_DATADIR="\"$(datadir)\"" \
-DLOCALSTATEDIR="\"$(localstatedir)\"" \
-DBINDIR="\"$(bindir)\""
@@ -190,7 +185,6 @@ noinst_HEADERS += \
src/core/or/entry_connection_st.h \
src/core/or/entry_port_cfg_st.h \
src/core/or/extend_info_st.h \
- src/core/or/git_revision.h \
src/core/or/listener_connection_st.h \
src/core/or/or.h \
src/core/or/or_circuit_st.h \
diff --git a/src/core/or/git_revision.c b/src/lib/log/git_revision.c
index 28ec1a7933..9d29ecd2a2 100644
--- a/src/core/or/git_revision.c
+++ b/src/lib/log/git_revision.c
@@ -3,7 +3,8 @@
* Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
-#include "core/or/git_revision.h"
+#include "orconfig.h"
+#include "lib/log/git_revision.h"
/** String describing which Tor Git repository version the source was
* built from. This string is generated by a bit of shell kludging in
@@ -14,3 +15,10 @@ const char tor_git_revision[] =
#include "micro-revision.i"
#endif
"";
+
+const char tor_bug_suffix[] = " (on Tor " VERSION
+#ifndef _MSC_VER
+ " "
+#include "micro-revision.i"
+#endif
+ ")";
diff --git a/src/core/or/git_revision.h b/src/lib/log/git_revision.h
index 02070cfd5e..0ce1190795 100644
--- a/src/core/or/git_revision.h
+++ b/src/lib/log/git_revision.h
@@ -7,6 +7,6 @@
#define TOR_GIT_REVISION_H
extern const char tor_git_revision[];
+extern const char tor_bug_suffix[];
#endif /* !defined(TOR_GIT_REVISION_H) */
-
diff --git a/src/lib/log/include.am b/src/lib/log/include.am
index b5a1c5ca26..4a6c9b3686 100644
--- a/src/lib/log/include.am
+++ b/src/lib/log/include.am
@@ -7,6 +7,7 @@ endif
src_lib_libtor_log_a_SOURCES = \
src/lib/log/escape.c \
+ src/lib/log/git_revision.c \
src/lib/log/ratelim.c \
src/lib/log/log.c \
src/lib/log/util_bug.c
@@ -20,11 +21,15 @@ src_lib_libtor_log_testing_a_SOURCES = \
src_lib_libtor_log_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
src_lib_libtor_log_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
-src/lib/log/torlog.$(OBJEXT) \
- src/lib/log/src_lib_libtor_log_testing_a-torlog.$(OBJEXT): micro-revision.i
+# Declare that these object files depend on micro-revision.i. Without this
+# rule, we could try to build them before micro-revision.i was created.
+src/lib/log/git_revision.$(OBJEXT) \
+ src/lib/log/src_lib_libtor_log_testing_a-git_revision.$(OBJEXT): \
+ micro-revision.i
noinst_HEADERS += \
src/lib/log/escape.h \
+ src/lib/log/git_revision.h \
src/lib/log/ratelim.h \
src/lib/log/log.h \
src/lib/log/util_bug.h \
diff --git a/src/lib/log/log.c b/src/lib/log/log.c
index 8349041ab1..e2514a341b 100644
--- a/src/lib/log/log.c
+++ b/src/lib/log/log.c
@@ -32,6 +32,7 @@
#define LOG_PRIVATE
#include "lib/log/log.h"
+#include "lib/log/git_revision.h"
#include "lib/log/ratelim.h"
#include "lib/lock/compat_mutex.h"
#include "lib/smartlist_core/smartlist_core.h"
@@ -353,13 +354,6 @@ log_tor_version(logfile_t *lf, int reset)
return 0;
}
-static const char bug_suffix[] = " (on Tor " VERSION
-#ifndef _MSC_VER
- " "
-#include "micro-revision.i"
-#endif
- ")";
-
/** Helper: Format a log message into a fixed-sized buffer. (This is
* factored out of <b>logv</b> so that we never format a message more
* than once.) Return a pointer to the first character of the message
@@ -442,9 +436,9 @@ format_msg(char *buf, size_t buf_len,
}
if (domain == LD_BUG &&
- buf_len - n > strlen(bug_suffix)+1) {
- memcpy(buf+n, bug_suffix, strlen(bug_suffix));
- n += strlen(bug_suffix);
+ buf_len - n > strlen(tor_bug_suffix)+1) {
+ memcpy(buf+n, tor_bug_suffix, strlen(tor_bug_suffix));
+ n += strlen(tor_bug_suffix);
}
buf[n]='\n';