-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
lib/fs: Correct wrapping order for meaningful log-caller #7209
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
Conversation
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.
LGTM unless you wanna tweak
// wrapFilesystem should always be used when wrapping a Filesystem. | ||
// It ensures proper wrapping order, which right now means: | ||
// `logFilesystem` needs to be the outermost wrapper for caller lookup. |
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.
We have two different wrapping orders of logfs and walkfs, depending on whether we want to debug above or below walkfs... Probably that does not matter, and maybe we should remove the walkfs
trace option as this is potentially confusing
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.
Having both fs
and walkfs
has merits: The former will just print one debug line that it will start walking now, the latter will also print every filesystem operation that occurs while walking - I think I remember I needed that huge walking verbosity once. And the unwrapping added in this PR is correct for both cases: It's appropriate for the filesystem calls originating in the walking code to give the fs walking code as the caller.
lib/ignore/ignore_test.go
Outdated
@@ -1192,3 +1192,31 @@ func TestEmptyPatterns(t *testing.T) { | |||
} | |||
} | |||
} | |||
|
|||
func TestUnignoredParent(t *testing.T) { |
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.
Random test case is random?
3ba9b0b
to
b8a9f2a
Compare
* main: (27 commits) lib/fs: Correct wrapping order for meaningful log-caller (syncthing#7209) all: Handle errors opening db/creating file-set (ref syncthing#5907) (syncthing#7150) cmd/relaypoolsrv: Allow validation of relay join requests by certificate (fixes syncthing#7196) (syncthing#7217) lib: Close underlying conn in protocol (fixes syncthing#7165) (syncthing#7212) lib/db: Prevent IndexID creation race (syncthing#7211) gui: Reflect change in untrusted in sharing tab (syncthing#7201) lib/db: Remove index ids when dropping folder (syncthing#7200) lib/model: Fix flaky test and add some scanning debug (syncthing#7214) lib: Consistently set suture logging (syncthing#7202) lib/model: Unflake TestIgnoreDeleteUnignore (syncthing#7208) gui: Apply changes to untrusted (ref syncthing#6443) (syncthing#7206) lib/config: Remove deprecated pending entries from config (ref syncthing#6443) (syncthing#7204) all: Store pending devices and folders in database (fixes syncthing#7178) (syncthing#6443) gui, man, authors: Update docs, translations, and contributors gui: Sort folders and devices in advanced config modal (syncthing#7192) model: Actually print folder description in "Overriding" log message gui: version.tags is an array, which is truthy when empty build: Switch to gopsutil's v3 module (syncthing#7191) build: Update notify (fixes syncthing#7076) (syncthing#7189) lib/api: Returns tags in version as list (syncthing#7190) ...
With
fs
debug logging we print information about what called the fs method. However for case- and mtime-fileysstems, this information is entirely useless, as it just points at the overriding method in those wrappers (e.g. chmod just says it was called by chmod). To prevent that I added a utility function that ensures proper wrapping order: