Skip to content

Conversation

@boegel
Copy link
Member

@boegel boegel commented Dec 12, 2019

Using eb --skip on an installation that was originally performed by someone else currently fails in the permissions step, even if both account are a member of the same group and --group-writable-installdir is used.

This change/optimization to adjust_permissions fixes that problem...

cc @verdurin, @migueldiascosta

… if the current permissions are not correct already
@boegel boegel added the bug fix label Dec 12, 2019
@boegel boegel added this to the release after 4.1.0 (4.1.1?) milestone Dec 12, 2019
@boegel boegel requested review from ocaisa and removed request for ocaisa December 12, 2019 10:52
:param relative: add/remove permissions relative to current permissions (if False, hard set specified permissions)
:param ignore_errors: ignore errors that occur when changing permissions
(up to a maximum ratio specified by --max-fail-ratio-adjust-permissions configuration option)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing :param skip_symlinks

Copy link
Member Author

Choose a reason for hiding this comment

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

That one is deprecated (and if you try using it in EasyBuild v4.x you'll got an error), so I excluded that one on purpose.


if add:
os.chmod(path, perms | permissionBits)
_log.debug("Adding permissions for %s: %s", path, oct(permission_bits))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would move this below new_perms and print both the permission_bits and the final result.
Same for removing

Copy link
Member Author

Choose a reason for hiding this comment

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

But then I need another if add: to discriminate below adding/removing of the permission_bits?

The log messages now mention everything: original permissions, added/removed permissions, changed permissions. For (fictional) example:

== 2019-12-12 21:51:39,936 filetools.py:1189 DEBUG Current permissions for /Users/kehoste/software/bzip2/1.0.6/bin/bzip2: 0100777
== 2019-12-12 21:51:39,936 filetools.py:1197 DEBUG Removing permissions for /Users/kehoste/software/bzip2/1.0.6/bin/bzip2: 022
== 2019-12-12 21:51:39,936 filetools.py:1207 DEBUG Changing permissions for /Users/kehoste/software/bzip2/1.0.6/bin/bzip2 to 0100755

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, I meant moving it one line down after the new_perms = ... line.
I didn't think of the log below with the actual chmod


if add:
os.chmod(path, perms | permissionBits)
_log.debug("Adding permissions for %s: %s", path, oct(permission_bits))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, I meant moving it one line down after the new_perms = ... line.
I didn't think of the log below with the actual chmod

@akesandgren
Copy link
Contributor

Going in, thanks @boegel!

@akesandgren akesandgren merged commit 87611a5 into easybuilders:develop Dec 13, 2019
@boegel boegel deleted the fix_adjust_permissions_chmod branch December 13, 2019 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants