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

Even more syscallcompat improvements #180

Merged
merged 3 commits into from
Dec 1, 2017

Conversation

slackner
Copy link
Contributor

Patch 1 adds / updates the documentation as requested in #179.

Patch 2 fixes the syscall emulation for absolute paths in a couple of functions. For absolute paths the dirfd should always be ignored. BTW, it would be nice if it would be possible to run the same emulation tests with emulation disabled, to test if the Linux syscalls actually work as expected.

Patch 3 updates two existing syscall wrappers with the new method (open current directory instead of caching the absolute path)

After this series only emulateRenameat remains a bit ugly. If you have any suggestions how to improve it without falling back to absolute paths ... ideas welcome ;)

For absolute paths, the file descriptor should be ignored. In such a case
there is also no need to hold the lock or change the working directory.
This avoids the conversion to an absolute path.
if err != nil {
t.Fatal(err)
}
_, err = os.Stat(tmpDir + "/dir2/f1")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, small typo here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or not ... sorry for the noise (thought the path was incorrect, but should be fine - otherwise the tests also wouldn't pass)

@rfjakob
Copy link
Owner

rfjakob commented Dec 1, 2017

Looks good to me, thanks! I'll think about emulateRenameat.

@rfjakob rfjakob merged commit 616a468 into rfjakob:master Dec 1, 2017
@rfjakob
Copy link
Owner

rfjakob commented Dec 1, 2017

Oh and about testing the linux syscalls - that would be nice indeed. I have not found a solution for how to do that without massive copy+paste, though.

@slackner slackner deleted the syscallcompat3 branch December 1, 2017 21:57
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.

2 participants