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
Inhibit chmod #74342
base: devel
Are you sure you want to change the base?
Inhibit chmod #74342
Conversation
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
This has my support |
Looking at this a bit more, it seems like adding a new option is probably not the best fix. We should detect and handle the failure of copystat by setting the appropriate mode by other means. |
As you say, but I'm not sure how one can detect this. There is no standardization of error codes or messages, other than an unhelpful position of approximating |
Hm if read access is not permitted then the hash comparison won’t work, too.
But regarding the present use case, I’m not sure if there is any reliable way to check this files the unix way.
…--
Mit freundlichen Grüßen / With kind regards
Florian Manschwetus
E-Mail: ***@***.******@***.***>
Tel.: +49-(0)611-8908534
CS Software Concepts and Solutions GmbH
Geschäftsführer / Managing Director: Falk Dreßler, Manfred Brandner
Amtsgericht Wiesbaden HRB 28619 (Commercial registry)
Schiersteiner Straße 31
D-65187 Wiesbaden
Germany
Tel.: 0611/8908555
Von: Randall S. Becker ***@***.***>
Gesendet: Dienstag, 20. April 2021 17:57
An: ansible/ansible ***@***.***>
Cc: Florian Manschwetus ***@***.***>; Author ***@***.***>
Betreff: Re: [ansible/ansible] Inhibit chmod (#74342)
Looking at this a bit more, it seems like adding a new option is probably not the best fix. We should detect and handle the failure of copystat by setting the appropriate mode by other means.
As you say, but I'm not sure how you can detect this. There is no standardization of error codes or messages, other than an unhelpful position of approximating it may have worked from the OS. You could check the idempotency of the operation by checking that the target file exists and has an expected mode, but you have no true indication of whether the copy actually worked without comparing the contents for equality, which itself is not always going to be possible if read access is not permitted.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#74342 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHKNGURJKW4QUMKQRQFPL7DTJWP33ANCNFSM43ICHZOA>.
|
Lets approach on this from a use case perspective, there are various corner cases, where this generic copy operation may not fit perfectly, especially the copystat facet. As the copy module is a generic approach, I won't expect it to automatically detect and handle such more or less exotic cases. Also I stumbled over an additional misfit with the copy operation in the Guardian scope, which works by accident. |
The other related PR was closed because it went stale, not because it was not valuable. This PR will allow operations to work and I do not see another useful suggestion of an alternative implementation. |
@manschwetusCS were you able to get any traction, or is Ansible just not wanting this? |
module.warn("Unable to copy stats {0}".format(to_native(b_src))) | ||
else: | ||
raise | ||
if not inhibit_copystat: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would still not make this an option, but try to capture the copystat error on hp/ux and issue the warning as we do for enosys case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would still not make this an option, but try to capture the copystat error on hp/ux and issue the warning as we do for enosys case
This is not HP/UX, but HPE NonStop. There is no specific error code for this situation and the error message varies depending on circumstance - I think LANG
might be involved too, so parsing the stderr output may be impractical. The general error - not specific to this situation - is Invalid function argument
, which can result from many causes but is part of the message here of significance at least with the cp
command, attempting to copy k from one directory to another in the edge condition described in this PR:
cp: preserving permissions for '/G/data01/randall/k': Invalid function argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LANG should not be involved as we are making a system call, so answers should always be in POSIX/C locale, even if we were using the command line tools we do have the ability to force the locale/lang setting to enable parsing the output.
This is still something we don't want to have hidden behind an extra option but rather implicit fallback behaviour in the copy module. It should try its best to capture the error and expose a warning if the copystat fails on the filesystem. As for the question around how to handle the errors as the message is not consistent, wouldn't catching |
The problem is that the copystat is report different errors in different situations. ENOENT and EINVAL are both reported depending on the file being copied. This is burying the underlying issue. If there was an errno that made any sense here, I would have contributed that fix. |
In what scenarios are these different values, is it on different platforms, different paths, etc? |
SUMMARY
Added the inhibit_copystat flag to copy to allow copy to succeed on platforms where stat values cannot be copied from src to dest.
ISSUE TYPE
COMPONENT NAME
copy
ADDITIONAL INFORMATION
When running playbooks on HPE NonStop platforms, the shutil.copystat operation does not succeed
when copying files between legacy (GUARDIAN) and current file systems (OSS/POSIX). The stat values are incompatible and does not work of the dest file is in the always-three-level GUARDIAN space
(e.g., /G/disk/dir/file). This option will allow the copy operation to succeed. The author considered adding
to the except clause, but felt that the decision to enable this behaviour in general is not desirable, and should by by deliberate choice of the user of the copy module on platforms where this situation applies.
This is originally work of @rsbeckerca, see #51103
before
after