summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-07-09 17:31:22 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-07-09 17:31:22 +0200
commit5b3a8ee27257f7347e371f92b13a868f266bca93 (patch)
tree629ce04e1547449ea4b8bdc5e451d9681d90e173
parentce13689ba8222ec9ede22d6669b802258bd07d4d (diff)
parent5b468f65fb2e5ac8dd6c5018974722bbe5426a47 (diff)
downloadmullvadvpn-5b3a8ee27257f7347e371f92b13a868f266bca93.tar.xz
mullvadvpn-5b3a8ee27257f7347e371f92b13a868f266bca93.zip
Merge branch 'openvpn-log-first-in-report'
-rw-r--r--CHANGELOG.md3
-rw-r--r--mullvad-problem-report/src/main.rs47
2 files changed, 29 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a6b7fada6..6f87e0af5f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,8 @@ Line wrap the file at 100 chars. Th
### Changed
- App now uses statically linked OpenSSL on all platforms.
+- Add OpenVPN logs at the top of the problem report instead of middle, to aid support work.
+- Lower per log size limit in the problem report to 128 kiB.
### Fixed
- Disable account input when logging in.
@@ -40,6 +42,7 @@ Line wrap the file at 100 chars. Th
- Hide the app icon from taskbar.
- Autohide the main window on focus loss.
+
## [2018.2-beta1] - 2018-07-02
### Added
- Refresh account expiration when account view becomes visible.
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs
index 440b1a9c75..ce36aa253a 100644
--- a/mullvad-problem-report/src/main.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -32,7 +32,7 @@ use std::path::{Path, PathBuf};
use std::process::Command;
/// Maximum number of bytes to read from each log file
-const LOG_MAX_READ_BYTES: usize = 512 * 1024;
+const LOG_MAX_READ_BYTES: usize = 128 * 1024;
const EXTRA_BYTES: usize = 32 * 1024;
/// Fit five logs plus some system information in the report.
const REPORT_MAX_SIZE: usize = (5 * LOG_MAX_READ_BYTES) + EXTRA_BYTES;
@@ -64,7 +64,7 @@ error_chain!{
description("Error listing the files in the mullvad-daemon log directory")
display(
"Error listing the files in the mullvad-daemon log directory: {}",
- path.to_string_lossy()
+ path.display()
)
}
WriteReportError(path: PathBuf) {
@@ -177,9 +177,24 @@ fn collect_report(
let mut problem_report = ProblemReport::new(redact_custom_strings);
match logs_from_log_directory() {
- Ok(logs) => problem_report.try_add_logs(logs),
+ Ok(logs) => {
+ let mut other_logs = Vec::new();
+ for log in logs {
+ match log {
+ Ok(path) => if is_tunnel_log(&path) {
+ problem_report.add_log(&path);
+ } else {
+ other_logs.push(path);
+ },
+ Err(error) => problem_report.add_error("Unable to get log path", error),
+ }
+ }
+ for other_log in other_logs {
+ problem_report.add_log(&other_log);
+ }
+ }
Err(error) => problem_report.add_error("Failed to list logs in log directory", error),
- }
+ };
problem_report.add_logs(extra_logs);
@@ -213,6 +228,13 @@ fn logs_from_log_directory() -> Result<impl Iterator<Item = Result<PathBuf>>> {
})
}
+fn is_tunnel_log(path: &Path) -> bool {
+ match path.file_name() {
+ Some(file_name) => file_name.to_string_lossy().contains("openvpn"),
+ None => false,
+ }
+}
+
fn send_problem_report(user_email: &str, user_message: &str, report_path: &Path) -> Result<()> {
let report_content = normalize_newlines(
read_file_lossy(report_path, REPORT_MAX_SIZE)
@@ -276,23 +298,6 @@ impl ProblemReport {
}
}
- /// Tries to attach some file logs to this report.
- ///
- /// This method receives a result with an iterator of results of file paths. If any of the
- /// results are errors, they are collected and displayed in the final report.
- pub fn try_add_logs<I, P>(&mut self, paths: I)
- where
- I: IntoIterator<Item = Result<P>>,
- P: AsRef<Path>,
- {
- for path_result in paths {
- match path_result {
- Ok(path) => self.add_log(path.as_ref()),
- Err(error) => self.add_error("Error getting next log file", error),
- }
- }
- }
-
/// Attach a file log to this report. This method adds the error chain instead of the log
/// contents if an error occurs while reading the log file.
pub fn add_log(&mut self, path: &Path) {