Skip to content

lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref #6875) - #6877

Merged
calmh merged 12 commits into
syncthing:mainfrom
AudriusButkevicius:mtime-fs
Aug 7, 2020
Merged

calmh merged 12 commits into
syncthing:mainfrom
AudriusButkevicius:mtime-fs

Conversation

@AudriusButkevicius

@AudriusButkevicius AudriusButkevicius commented Aug 3, 2020 •

Copy link
Copy Markdown
Member

So the crux of the problem is the fact they are wrapped in mtimefs.

I thought about doing an interface assertion instead, but some of the implementations call Stat() which again might return basicFileInfo or mtimeFileInfo, so I am not sure I can do an assertion on a function with yet another generic interface return value?

This also addresses stuff discussed in golang/go#24331

Let's see if this passes the tests.

@calmh

calmh commented Aug 4, 2020 •

Copy link
Copy Markdown
Member

I fixed the freebsd builder so it's happy now.

We could have an unexported interface { unwrap() File } that File implementations can implement if they wrap a lower level implementation. Then we'd loop on unwrap() as long as the return is still assertable to that interface and finally check if it's basic or not. Like we have for filesystems...

It's not just the mtime one, there's also the new windows junction stuff, but maybe that only wraps junctions specifically?

@calmh

calmh commented Aug 4, 2020 •

Copy link
Copy Markdown
Member

Or possibly we implement the SyscallConn stuff directly and just pass that down to the lower layer or finally return ENOTSUPP at that point if we don't have an actual fd to provide

@AudriusButkevicius

Copy link
Copy Markdown
Member Author

image

@AudriusButkevicius

Copy link
Copy Markdown
Member Author

image

@AudriusButkevicius

Copy link
Copy Markdown
Member Author

image

@calmh
calmh merged commit e9bb173 into syncthing:main Aug 7, 2020
calmh added a commit that referenced this pull request Aug 7, 2020
* release:
  lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref #6875) (#6877)
  lib/model: Don't close file early (fixes #6875) (#6876)
@AudriusButkevicius
AudriusButkevicius deleted the mtime-fs branch August 7, 2020 07:00
@calmh calmh added this to the v1.9.0 milestone Aug 18, 2020
calmh added a commit to calmh/syncthing that referenced this pull request Aug 19, 2020
* main: (368 commits)
  build: We now target Go 1.14
  lib/fs: Disable ioctl on ppc (fixes syncthing#6898) (syncthing#6901)
  gui, man, authors: Update docs, translations, and contributors
  lib/dialer: Try dialing without reuse in parallel (fixes syncthing#6892) (syncthing#6893)
  cmd/stcrashreceiver: Don't crash on nil err
  all: Remove need to restart syncthing (syncthing#6883)
  lib/db: Don't put truncated files (ref syncthing#6855, ref syncthing#6501) (syncthing#6888)
  lib/osutil: Check returned error instead of info (ref syncthing#6885) (syncthing#6887)
  gui, man, authors: Update docs, translations, and contributors
  lib/osutil: Preserve perms in AtomicWriter (fixes #tbd) (syncthing#6885)
  lib/fs: Fix WatchRename test for FreeBSD (fixes syncthing#6613)
  lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref syncthing#6875) (syncthing#6877)
  lib/model: Don't close file early (fixes syncthing#6875) (syncthing#6876)
  lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref syncthing#6875) (syncthing#6877)
  gui, man, authors: Update docs, translations, and contributors
  lib/fs: Fix WatchRename test for FreeBSD (fixes syncthing#6613)
  lib/model: Don't close file early (fixes syncthing#6875) (syncthing#6876)
  lib/db: Log context on panic (syncthing#6872)
  gui: Don't show pull order on SO folders (ref syncthing#6807) (syncthing#6871)
  lib/model: Check folder error before sync-waiting (fixes syncthing#6793) (syncthing#6847)
  ...
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Aug 7, 2021
@syncthing syncthing locked and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants