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

Small cleanups for copy_file sendfile fix #544

Merged
merged 5 commits into from
May 23, 2022
Merged

Small cleanups for copy_file sendfile fix #544

merged 5 commits into from
May 23, 2022

Conversation

hmoffatt
Copy link
Contributor

Cleanups for #543

@@ -2898,6 +2898,8 @@ namespace vcpkg
return true;
#else // ^^^ (defined(__APPLE__) // !defined(__APPLE__) vvv

destination_fd.fchmod(source_stat.st_mode, ec);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is now generally before writing the output and for some paths before reading ec, instead of immediately before returning. IMO this is a behavioural change, not deduplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps, but is there a need to delay the fchmod until the end, requiring the duplication?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is really an improvement ;-)

Copy link
Contributor

@ras0219-msft ras0219-msft May 20, 2022

Choose a reason for hiding this comment

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

I think this change LGTM, but it needs to add a check for ec and an early failure if the fchmod failed. Failure to change permissions but success in copying the data doesn't sound like a successful copy to me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks that's a good point, I pushed a change.

@@ -2898,6 +2898,8 @@ namespace vcpkg
return true;
#else // ^^^ (defined(__APPLE__) // !defined(__APPLE__) vvv

destination_fd.fchmod(source_stat.st_mode, ec);
Copy link
Contributor

@ras0219-msft ras0219-msft May 20, 2022

Choose a reason for hiding this comment

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

I think this change LGTM, but it needs to add a check for ec and an early failure if the fchmod failed. Failure to change permissions but success in copying the data doesn't sound like a successful copy to me :)

@BillyONeal BillyONeal merged commit ec42d25 into microsoft:main May 23, 2022
@hmoffatt hmoffatt deleted the sendfile-cleanup branch June 8, 2022 06:49
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.

4 participants