Removed Git SCM string anonymization as it's proven quite useless and hindering in understanding bug report
This commit is contained in:
parent
35f4aa964f
commit
f7849077e1
2 changed files with 6 additions and 53 deletions
|
|
@ -19,10 +19,9 @@
|
||||||
#define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@"
|
#define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
const char g_scm_rev[] = GIT_REV;
|
||||||
const char* g_scm_rev;
|
const char g_scm_branch[] = GIT_BRANCH;
|
||||||
const char* g_scm_branch;
|
const char g_scm_desc[] = GIT_DESC;
|
||||||
const char* g_scm_desc;
|
|
||||||
const char g_build_name[] = BUILD_NAME;
|
const char g_build_name[] = BUILD_NAME;
|
||||||
const char g_build_date[] = BUILD_DATE;
|
const char g_build_date[] = BUILD_DATE;
|
||||||
const char g_build_fullname[] = BUILD_FULLNAME;
|
const char g_build_fullname[] = BUILD_FULLNAME;
|
||||||
|
|
@ -30,50 +29,4 @@ const char g_build_version[] = BUILD_VERSION;
|
||||||
const char g_build_id[] = BUILD_ID;
|
const char g_build_id[] = BUILD_ID;
|
||||||
const char g_title_bar_format_idle[] = TITLE_BAR_FORMAT_IDLE;
|
const char g_title_bar_format_idle[] = TITLE_BAR_FORMAT_IDLE;
|
||||||
const char g_title_bar_format_running[] = TITLE_BAR_FORMAT_RUNNING;
|
const char g_title_bar_format_running[] = TITLE_BAR_FORMAT_RUNNING;
|
||||||
|
|
||||||
/// Anonymizes SCM data
|
|
||||||
/// This is quite weak. But better than nothing.
|
|
||||||
class scm_encrypt {
|
|
||||||
std::string m_scm_rev, m_scm_branch, m_scm_desc;
|
|
||||||
|
|
||||||
public:
|
|
||||||
scm_encrypt() {
|
|
||||||
// Get a key that is easy to obtain when asking the person directly but (usually) hard to
|
|
||||||
// guess
|
|
||||||
std::string key;
|
|
||||||
#ifdef __linux__
|
|
||||||
if (!std::getline(std::ifstream("/proc/sys/kernel/hostname"), key))
|
|
||||||
key = "linux_error_key";
|
|
||||||
#else
|
|
||||||
// Not a good fallback, but better than nothing I guess?
|
|
||||||
key = g_build_date;
|
|
||||||
#endif
|
|
||||||
// Copy strings in place
|
|
||||||
m_scm_rev = GIT_REV;
|
|
||||||
m_scm_branch = GIT_BRANCH;
|
|
||||||
m_scm_desc = GIT_DESC;
|
|
||||||
// XOR each string with key
|
|
||||||
auto key_it = key.begin();
|
|
||||||
for (auto& string : {&m_scm_rev, &m_scm_branch, &m_scm_desc}) {
|
|
||||||
for (auto& c : *string) {
|
|
||||||
c ^= *key_it;
|
|
||||||
if (++key_it == key.end())
|
|
||||||
key_it = key.begin();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Make each string human-readable
|
|
||||||
for (auto& string : {&m_scm_rev, &m_scm_branch, &m_scm_desc}) {
|
|
||||||
const std::string original = *string;
|
|
||||||
string->clear();
|
|
||||||
for (const auto c : original) {
|
|
||||||
string->append(fmt::format("{:x}", unsigned(c)));
|
|
||||||
}
|
|
||||||
string->pop_back();
|
|
||||||
}
|
|
||||||
// Set pointers
|
|
||||||
g_scm_rev = m_scm_rev.c_str();
|
|
||||||
g_scm_branch = m_scm_branch.c_str();
|
|
||||||
g_scm_desc = m_scm_desc.c_str();
|
|
||||||
}
|
|
||||||
} scm_encrypt_instance;
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
extern const char* g_scm_rev;
|
extern const char g_scm_rev[];
|
||||||
extern const char* g_scm_branch;
|
extern const char g_scm_branch[];
|
||||||
extern const char* g_scm_desc;
|
extern const char g_scm_desc[];
|
||||||
extern const char g_build_name[];
|
extern const char g_build_name[];
|
||||||
extern const char g_build_date[];
|
extern const char g_build_date[];
|
||||||
extern const char g_build_fullname[];
|
extern const char g_build_fullname[];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue