Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: Log warning when debug source excedes item size limit #1305

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/utils/dif_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,17 +1063,25 @@ fn process_symbol_maps<'a>(
/// Default filter function to skip over bad sources we do not want to include.
pub fn filter_bad_sources(entry: &FileEntry) -> bool {
let max_size = Config::current().get_max_dif_item_size();
let path = &entry.abs_path_str();

if entry.name_str().ends_with(".pch") {
// always ignore pch files
false
} else if let Ok(meta) = fs::metadata(&entry.abs_path_str()) {
return false;
} else if let Ok(meta) = fs::metadata(path) {
let item_size = meta.len();
// ignore files larger than limit (defaults to 1MB)
meta.len() < max_size
} else {
// if a file metadata could not be read it will be skipped later.
true
if item_size > max_size {
warn!(
"Source exceded maximum item size limit ({}). {}",
item_size, path
);
return false;
}
}

// if a file metadata could not be read it will be skipped later.
true
}

/// Creates a source bundle containing the source files referenced by the input DIFs.
Expand Down