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

check ENOTDIR for readlink #1597

Merged
merged 6 commits into from
Mar 30, 2021
Merged

check ENOTDIR for readlink #1597

merged 6 commits into from
Mar 30, 2021

Conversation

butonic
Copy link
Contributor

@butonic butonic commented Mar 29, 2021

{
  "level": "error",
  "service": "storage",
  "pkg": "rgrpc",
  "traceid": "24d2f1bb7b3cb88c68fd005ced336cce",
  "error": "Decomposedfs: Wrap: readlink error: readlink /var/tmp/ocis/storage/users/nodes/a5066dc8-8566-4aa4-9286-d63c30bdc9a6/somename: not a directory",
  "time": "2021-03-29T19:01:05Z",
  "caller": "/home/vscode/go/pkg/mod/github.com/cs3org/reva@v1.6.1-0.20210326165326-e8a00d9b2368/internal/grpc/services/storageprovider/storageprovider.go:571",
  "message": "error stating: path:\"/home/testfile.txt/somename\" "
}

readlink returns ENOTDIR when a path segment is a file and not a directory. os.IsNotExist won't cover this case: golang/go#18974

part of owncloud/ocis#1239

Links: https://www.man7.org/linux/man-pages/man2/readlink.2.html

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@update-docs
Copy link

update-docs bot commented Mar 29, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic
Copy link
Contributor Author

butonic commented Mar 29, 2021

remaining apiWebdavProperties1/copyFile.feature tests require returning a new error type that we can use to map the AlreadyExists error ...

@butonic butonic marked this pull request as ready for review March 29, 2021 21:02
@butonic butonic requested a review from labkode as a code owner March 29, 2021 21:02
@butonic butonic requested a review from ishank011 March 29, 2021 21:05
@butonic
Copy link
Contributor Author

butonic commented Mar 29, 2021

@ishank011 I also removed the failing test from eos because I don't expect it to be an issue for eos ...

aduffeck
aduffeck previously approved these changes Mar 30, 2021
Copy link
Contributor

@aduffeck aduffeck left a comment

Choose a reason for hiding this comment

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

LGTM 👍

You could maybe consider adding a unit test to the Describe("Child", ... block in node_test.go for it, e.g.

		It("handles (broken) links including file segments by returning an non-existant node", func() {
			child, err := parent.Child(env.Ctx, "file1/broken")
			Expect(err).ToNot(HaveOccurred())
			Expect(child).ToNot(BeNil())
			Expect(child.Exists).To(BeFalse())
		})

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@ishank011 ishank011 merged commit 4fd0229 into cs3org:master Mar 30, 2021
ffurano pushed a commit to ffurano/reva that referenced this pull request Apr 19, 2021
@butonic butonic deleted the check-notdir branch July 8, 2021 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants