-
Notifications
You must be signed in to change notification settings - Fork 0
perf(ops): panel refresh, search, fs, archive, copy hot paths #111
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,8 +93,13 @@ pub fn rename_entry(old: &Path, new_name: &str) -> io::Result<()> { | |
| Err(err) if err.kind() == io::ErrorKind::NotFound => None, | ||
| Err(err) => return Err(err), | ||
| }; | ||
| let same_file = match (fs::symlink_metadata(old), new_meta.as_ref()) { | ||
| (Ok(old_meta), Some(new_meta)) => super::common::same_inode(&old_meta, new_meta), | ||
| // Only stat `old` when the dest exists (for the same-inode check). | ||
| // When dest doesn't exist, the old stat is unnecessary. | ||
| let same_file = match (new_meta.as_ref(), new_meta.is_some()) { | ||
| (Some(new_meta), true) => match fs::symlink_metadata(old) { | ||
|
Comment on lines
+98
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: The The previous version matched directly on You can keep the same behavior and “only stat let same_file = match new_meta.as_ref() {
Some(new_meta) => match fs::symlink_metadata(old) {
Ok(old_meta) => super::common::same_inode(&old_meta, new_meta),
_ => false,
},
None => false,
};This removes the unnecessary boolean and clarifies intent. Suggested implementation: // Only stat `old` when the dest exists (for the same-inode check).
// When dest doesn't exist, the old stat is unnecessary.
let same_file = match new_meta.as_ref() {
Some(new_meta) => match fs::symlink_metadata(old) {
Ok(old_meta) => super::common::same_inode(&old_meta, new_meta),
_ => false,
},
None => false,
};No additional changes are required; this preserves the "only stat |
||
| Ok(old_meta) => super::common::same_inode(&old_meta, new_meta), | ||
| _ => false, | ||
| }, | ||
| _ => false, | ||
| }; | ||
| // TOCTOU: this check + `fs::rename` is non-atomic. On POSIX, rename | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a sort or filter rebuild reorders
unfiltered_entries,path_indexretains the old slot values becauseset_filtered_indicesonly rebuilds the visible view. A subsequent watcher upsert or removal therefore updates or removes the wrong file entry before the next full directory refresh.