Skip to content

lib/fs: Be more clear about invalid file names (ref #7010) - #7011

Merged
calmh merged 4 commits into
syncthing:mainfrom
calmh:errors
Sep 28, 2020
Merged

calmh merged 4 commits into
syncthing:mainfrom
calmh:errors

Conversation

@calmh

@calmh calmh commented Sep 28, 2020

Copy link
Copy Markdown
Member

Add specific errors for the failures, resulting in this rather than just
the generic "invalid filename":

[MRIW7] 08:50:50 INFO: Puller (folder default, item "NUL"): syncing: filename is invalid: name is reserved
[MRIW7] 08:50:50 INFO: Puller (folder default, item "fail."): syncing: filename is invalid: name ends with space or period
[MRIW7] 08:50:50 INFO: Puller (folder default, item "sup:yo"): syncing: filename is invalid: name contains reserved character
[MRIW7] 08:50:50 INFO: default: Failed to sync 3 items

@calmh calmh changed the title lib/model: Be more clear about invalid file names (ref #7010) lib/fs: Be more clear about invalid file names (ref #7010) Sep 28, 2020
Add specific errors for the failures, resulting in this rather than just
the generic "invalid filename":

[MRIW7] 08:50:50 INFO: Puller (folder default, item "NUL"): syncing: filename is invalid: name is reserved
[MRIW7] 08:50:50 INFO: Puller (folder default, item "fail."): syncing: filename is invalid: name ends with space or period
[MRIW7] 08:50:50 INFO: Puller (folder default, item "sup:yo"): syncing: filename is invalid: name contains reserved character
[MRIW7] 08:50:50 INFO: default: Failed to sync 3 items
Comment thread lib/fs/util.go Outdated
var (
errInvalidSpacePeriod = errors.New("name ends with space or period")
errInvalidReservedName = errors.New("name is reserved")
errInvalidReservedChar = errors.New("name contains reserved character")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the use of word reserved is a bit vague. I'd say name contains charaters not permitted on Windows, or file name is not permitted on windows or something.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the errors a bit to be more clear, un-exported the things as they're not used outside of lib/fs currently

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact wording is a bit difficult because the "name" is actually a "path component" but then it gets very technical

@calmh
calmh merged commit 9e0b924 into syncthing:main Sep 28, 2020
@calmh calmh added this to the v1.10.1 milestone Sep 28, 2020
calmh added a commit to calmh/syncthing that referenced this pull request Sep 29, 2020
* main:
  lib/fs: Add COM0 and LPT0 to invalid Windows file names (ref syncthing#7008) (syncthing#7013)
  lib/fs: Be even more strict about Windows names (ref syncthing#7008) (syncthing#7012)
  lib/fs: Be more clear about invalid file names (ref syncthing#7010) (syncthing#7011)
  lib/model: Disallow reserved names, and names ending with period on Windows (fixes syncthing#7008) (syncthing#7010)
  lib/model, lib/scanner: Prevent races aborting scans (fixes syncthing#6994) (syncthing#6997)
  lib/fs: Use file clone ioctl wrappers and types from golang.org/x/sys/unix (syncthing#7000)
  Update config.yml
  gui, man, authors: Update docs, translations, and contributors
@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 Sep 29, 2021
@syncthing syncthing locked and limited conversation to collaborators Sep 29, 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