Skip to content

memory: fix dst mutating src after server-side copy - #7690

Merged
nielash merged 1 commit into
rclone:masterfrom
nielash:fix-memory-copy
Mar 27, 2024
Merged

nielash merged 1 commit into
rclone:masterfrom
nielash:fix-memory-copy

Conversation

@nielash

@nielash nielash commented Mar 25, 2024

Copy link
Copy Markdown
Contributor

What is the purpose of this change?

Before this change, the Memory backend's Copy method created a dst object that referenced the src's objectData by pointer instead of making a copy. While this minimized memory usage, an unintended consequence was that subsequently mutating the src (such as changing the modtime) would inadvertently also mutate the dst, and vice versa.

This change fixes the issue and adds a test.

Was the change discussed in an issue or in the forum before?

No.

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

Before this change, the Memory backend's Copy method created a dst object that
referenced the src's objectData by pointer instead of making a copy. While this
minimized memory usage, an unintended consequence was that subsequently mutating
the src (such as changing the modtime) would inadvertently also mutate the dst,
and vice versa.

This change fixes the issue and adds a test.
@nielash nielash added this to the v1.67 milestone Mar 25, 2024
@nielash
nielash marked this pull request as ready for review March 25, 2024 15:39

@ncw ncw left a comment

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.

Looks great - thank you.

Please merge when ready.

@nielash
nielash merged commit fecce67 into rclone:master Mar 27, 2024
nielash added a commit to nielash/rclone that referenced this pull request Mar 27, 2024
This change officially adds bisync to the nightly integration tests for all
backends.

This will be part of giving us the confidence to take bisync out of beta.

A number of fixes have been added to account for features which can differ on
different backends -- for example, hash types / modtime support, empty
directories, unicode normalization, and unimportant differences in log output.
We will likely find that more of these are needed once we start running these
with the full set of remotes.

Additionally, bisync's extremely sensitive tests revealed a few bugs in other
backends that weren't previously covered by other tests. Fixes for those issues
have been submitted on the following separate PRs (and bisync test failures will
be expected until they are merged):

- rclone#7670 memory: fix deadlock in operations.Purge
- rclone#7688 memory: fix incorrect list entries when rooted at subdirectory
- rclone#7690 memory: fix dst mutating src after server-side copy
- rclone#7692 dropbox: fix chunked uploads when size <= chunkSize

Relatedly, workarounds have been put in place for the following backend
limitations that are unsolvable for the time being:

- rclone#3262 drive is sometimes aware of trashed files/folders when it shouldn't be
- rclone#6199 dropbox can't handle emojis and certain other characters
- rclone#4590 onedrive API has longstanding bug for conflictBehavior=replace in
	server-side copy/move
nielash added a commit that referenced this pull request Mar 27, 2024
This change officially adds bisync to the nightly integration tests for all
backends.

This will be part of giving us the confidence to take bisync out of beta.

A number of fixes have been added to account for features which can differ on
different backends -- for example, hash types / modtime support, empty
directories, unicode normalization, and unimportant differences in log output.
We will likely find that more of these are needed once we start running these
with the full set of remotes.

Additionally, bisync's extremely sensitive tests revealed a few bugs in other
backends that weren't previously covered by other tests. Fixes for those issues
have been submitted on the following separate PRs (and bisync test failures will
be expected until they are merged):

- #7670 memory: fix deadlock in operations.Purge
- #7688 memory: fix incorrect list entries when rooted at subdirectory
- #7690 memory: fix dst mutating src after server-side copy
- #7692 dropbox: fix chunked uploads when size <= chunkSize

Relatedly, workarounds have been put in place for the following backend
limitations that are unsolvable for the time being:

- #3262 drive is sometimes aware of trashed files/folders when it shouldn't be
- #6199 dropbox can't handle emojis and certain other characters
- #4590 onedrive API has longstanding bug for conflictBehavior=replace in
	server-side copy/move
lafkpages pushed a commit to lafkpages/rclone that referenced this pull request Jul 20, 2026
This change officially adds bisync to the nightly integration tests for all
backends.

This will be part of giving us the confidence to take bisync out of beta.

A number of fixes have been added to account for features which can differ on
different backends -- for example, hash types / modtime support, empty
directories, unicode normalization, and unimportant differences in log output.
We will likely find that more of these are needed once we start running these
with the full set of remotes.

Additionally, bisync's extremely sensitive tests revealed a few bugs in other
backends that weren't previously covered by other tests. Fixes for those issues
have been submitted on the following separate PRs (and bisync test failures will
be expected until they are merged):

- rclone#7670 memory: fix deadlock in operations.Purge
- rclone#7688 memory: fix incorrect list entries when rooted at subdirectory
- rclone#7690 memory: fix dst mutating src after server-side copy
- rclone#7692 dropbox: fix chunked uploads when size <= chunkSize

Relatedly, workarounds have been put in place for the following backend
limitations that are unsolvable for the time being:

- rclone#3262 drive is sometimes aware of trashed files/folders when it shouldn't be
- rclone#6199 dropbox can't handle emojis and certain other characters
- rclone#4590 onedrive API has longstanding bug for conflictBehavior=replace in
	server-side copy/move
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants