-
Notifications
You must be signed in to change notification settings - Fork 94
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 reinstall not detecting changed permissions by itself #6658
base: 8.4.x
Are you sure you want to change the base?
Conversation
stdout, stderr = proc.communicate() | ||
|
||
# Strip unwanted output. | ||
stdout = ('\n'.join(re.findall(r'\+\+\+(.*)\+\+\+', stdout))).strip() |
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.
This seemed to be duplicating the work of format_rsync_output()
, but removing all cannot delete non-empty directory:
lines, not just the opt
dir
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.
The point of the +++
prefix/suffix will have been to separate intended rsync
output from any unexpected "junk" that might be output by the command / shell, ensuring that we only display what we need, even if the output differs from expectation in other ways.
Why did you remove this? Just didn't like the look of it?
Remember that this code is used for more than just the dry-run check.
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.
From the context I could gather in #5125, the only unwanted output that was being targeted was cannot delete non-empty directory:
. This is implemented in format_reinstall_output()
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.
This rsync
command doesn't just apply to the dry-run check (which is passed throughformat_rsync_output
). And this prefix stripped out other potential output.
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.
cylc-flow/cylc/flow/install.py
Lines 226 to 227 in 48d3d38
# Strip unwanted output. | |
stdout = ('\n'.join(re.findall(r'\+\+\+(.*)\+\+\+', stdout))).strip() |
is at odds with
cylc-flow/cylc/flow/scripts/reinstall.py
Lines 346 to 348 in 48d3d38
else: | |
# other uncategorised log line | |
lines.append(line) |
The former seems to have been implemented to cover cannot delete non-empty directory:
, there was no mention of any other potential rsync output in #5125. And the latter seems to have been implemented to deliberately include other potential rsync output in case the rsync implementation results in non-standard output format.
Hence I am not sure we should be stripping other potential rsync output.
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.
It's not at odds.
- The
+++
prefix ensures that only the intended output lines get through. - The
else
handles intended output lines that don't matchsend
ordel.
.
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.
cannot delete non-empty directory:
does not have +++
pre/suffixed to it (it is orthogonal to the %o %n%L
output format). It is always being stripped. Only lines that match send
or del.
have +++
pre/suffixed anyway.
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.
The only case I can think of where some other potential output would make it through both bits of code is if the %o
output format resulted in something other than send
or del.
. But that seems unlikely
else: | ||
# other uncategorised log line | ||
# shouldn't happen; tolerate unknown rsync implementation? |
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.
If you don't think it should happen, then perhaps a message warning that this is an unexpected rsync implementation, please contact the dev team might be appropriate.
continue | ||
match = re.match(r'^(.{11}) (send|del\.) (.*)$', line) | ||
if match: | ||
summary, operation, file = match.groups() |
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.
[should not block/nice to have]
If nothing has changed except permissions can get this info from the rsync output and pass it on to the user?
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.
- Tested manually
- Read
- Made 2 non-blocking suggestions
@@ -180,9 +180,14 @@ def get_includes_to_rsync(rsync_includes=None): | |||
DEFAULT_RSYNC_OPTS = [ | |||
'-a', | |||
'--checksum', | |||
'--out-format=%o %n%L', | |||
'--out-format=%i %o %n%L', # see comment below |
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.
Do we want to include %i
in the logs?
- If this is only really relevant to the dry-run functionality, then continue to override the CLI argument as we did before (no need to change here).
- If we think we should have this in the logs, then to keep them readable it might be better to keep the operation at the start of the line?
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.
The rsync output isn't included in the reinstall logs. The only thing we do with the rsync output is print it to stdout in the dry-run 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 think it is, install a workflow, make changes, then check ~/cylc-run/<workflow>/log/install/*
.
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.
Ah ok - it's only included in the 01-install.log
. So I should make this option with %i
only apply to reinstall. But it is not included in the reinstall logs regardless.
This fixes a bug where
cylc reinstall
in interactive mode would not pick up on permissions changes for files.The reason for this is that
rsync
does not report files as included to be sent if only the permissions have been changed, unless%i
is added to the--out-format
option.%i
is an itemized changes summary.https://linux.die.net/man/1/rsync, https://man.freebsd.org/cgi/man.cgi?query=rsync
I have hidden this itemized changes summary unless using
cylc reinstall -v
or even higher verbosity.Check List
CONTRIBUTING.md
and added my name as a Code Contributor.?.?.x
branch.