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

Replace uses of fs::file_copy with file.copy. #165

Merged
merged 4 commits into from
Jul 26, 2024
Merged

Replace uses of fs::file_copy with file.copy. #165

merged 4 commits into from
Jul 26, 2024

Conversation

plietar
Copy link
Member

@plietar plietar commented Jul 26, 2024

Unfortunately fs::file_copy has issues when working with read-only files on a Samba mounted file system. file.copy doesn't have the same problem. See mrc-5557 for more details.

This was tested manually and confirmed to work by running a basic report with an orderly_dependency call on a Samba mount. Unfortunately it is not something we can easily test for automatically.

Unfortunately `fs::file_copy` has issues when working with read-only
files on a Samba mounted file system. `file.copy` doesn't have the same
problem. See mrc-5557 for more details.

This was tested manually and confirmed to work by running a basic report
with an `orderly_dependency` call on a Samba mount. Unfortunately it is
not something we can easily test for automatically.
@plietar plietar requested a review from richfitz July 26, 2024 11:58
Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.91%. Comparing base (07c1d31) to head (5ea0ceb).
Report is 27 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main     #165      +/-   ##
===========================================
- Coverage   100.00%   99.91%   -0.09%     
===========================================
  Files           40       40              
  Lines         3699     3735      +36     
===========================================
+ Hits          3699     3732      +33     
- Misses           0        3       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@richfitz richfitz left a comment

Choose a reason for hiding this comment

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

There's one use left of fs::file_copy in the tests - that's fine as we never expect that to be used on a network share

@plietar plietar merged commit 534c743 into main Jul 26, 2024
10 checks passed
@plietar plietar deleted the mrc-5557 branch July 26, 2024 14:53
plietar added a commit that referenced this pull request Sep 10, 2024
It has more bells and whistles, and is often more performant. In
particular, it makes use of `CopyFileW` (on Windows) and
`copy_file_range` (on Linux) when applicable. This offers a big speedup
when copying a file within a network drive, which is a common use case
for orderly.

The reason why `file.copy` was introduced in #165 is that copying
read-only files with the `fs` package wasn't working properly on Samba
drives. It turns out this situation only occurs when `overwrite = TRUE`.
When the flag is set to FALSE, the copy succeeds. To work around this we
do an initial check before the copy to delete any files in the
destination path, and copy with `overwrite = FALSE`. This was manually
tested by running the test suite with the `TMPDIR` environment variable
set to a path on a network drive.
plietar added a commit that referenced this pull request Sep 10, 2024
It has more bells and whistles, and is often more performant. In
particular, it makes use of `CopyFileW` (on Windows) and
`copy_file_range` (on Linux) when applicable. This offers a big speedup
when copying a file within a network drive, which is a common use case
for orderly.

The reason why `file.copy` was introduced in #165 is that copying
read-only files with the `fs` package wasn't working properly on Samba
drives. It turns out this situation only occurs when `overwrite = TRUE`.
When the flag is set to FALSE, the copy succeeds. To work around this we
do an initial check before the copy to delete any files in the
destination path, and copy with `overwrite = FALSE`. This was manually
tested by running the test suite with the `TMPDIR` environment variable
set to a path on a network drive.
plietar added a commit that referenced this pull request Sep 13, 2024
It has more bells and whistles, and is often more performant. In
particular, it makes use of `CopyFileW` (on Windows) and
`copy_file_range` (on Linux) when applicable. This offers a big speedup
when copying a file within a network drive, which is a common use case
for orderly.

The reason why `file.copy` was introduced in #165 is that copying
read-only files with the `fs` package wasn't working properly on Samba
drives. It turns out this situation only occurs when `overwrite = TRUE`.
When the flag is set to FALSE, the copy succeeds. To work around this we
do an initial check before the copy to delete any files in the
destination path, and copy with `overwrite = FALSE`. This was manually
tested by running the test suite with the `TMPDIR` environment variable
set to a path on a network drive.
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