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

fix copy module update atime/mtime #83235

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from

Conversation

dkuji
Copy link

@dkuji dkuji commented May 12, 2024

SUMMARY
  • update atime, mtime
ISSUE TYPE
ADDITIONAL INFORMATION

@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels May 12, 2024
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label May 14, 2024
Copy link
Contributor

@mkrizek mkrizek left a comment

Choose a reason for hiding this comment

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

Please create a changelog fragment.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 20, 2024
@ansibot ansibot removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels May 21, 2024
@dkuji
Copy link
Author

dkuji commented May 24, 2024

@mkrizek I created fragment file.

@dkuji
Copy link
Author

dkuji commented May 27, 2024

@flowerysong @s-hertel @mkrizek PTAL?

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jun 3, 2024
@s-hertel
Copy link
Contributor

s-hertel commented Jun 3, 2024

@dkuji Sorry, this is still in my queue. I'm kind of concerned how easy it seems like it would be to accidentally lose the test coverage. I still haven't understood how to reliably reproduce the issue (for example, I was able to tweak your test to use the full path, and reproduce, so it's not limited to relative paths). Even though the test is destructive, I think the test should use the remote_tmp_dir if possible for easy cleanup.

The os.rename documentation mentions The operation may fail on some Unix flavors if src and dst are on different filesystems. - curious if that's related and would make a more intentional test.

@dkuji
Copy link
Author

dkuji commented Jun 4, 2024

@s-hertel

Thanks for your comment!
Yes, this issue is not limited to relative paths.
For example, you can reproduce this by specifying an absolute path such as /var/tmp/foo.txt for dest and using the same file system for src and dest.

This is because src is a path like /root/.ansible/tmp/ansible-tmp-1717499708.7618713-470-18776907546337/.source.txt, and the file system is the same for src and dest.

However, if you use {{ remote_dir }} in dest, dest will be under /tmp/, and the file system will be different, so it cannot be reproduced.
This is because /tmp is a tmpfs file system in the Docker container used in integration-test.

This is the result of a df in a container that starts when you run the following command:

# ansible-test integration copy --docker alpine319 --python 3.11
~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
overlay 61202244 15380100 42680820 26% /
tmpfs 65536 0 65536 0% /dev
shm 65536 164 65372 0% /dev/shm
tmpfs 4016028 16 4016012 0% /tmp
tmpfs 4016028 28 4016000 0% /run
/dev/vda1 61202244 15380100 42680820 26% /etc/resolv.conf
/dev/vda1 61202244 15380100 42680820 26% /etc/hostname
/dev/vda1 61202244 15380100 42680820 26% /etc/hosts
tmpfs 4016028 0 4016028 0% /run/lock
tmpfs 4016028 0 4016028 0% /sys/fs/cgroup
tmpfs 65536 0 65536 0% /proc/kcore
tmpfs 65536 0 65536 0% /proc/keys
tmpfs 65536 0 65536 0% /proc/timer_list
tmpfs 4016028 0 4016028 0% /sys/firmware

I understand the idea that I should use {{ remote_dir }} for easier cleanup, but I don't know how to reproduce it using {{ remote_dir }}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants