-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[stable9.1] Fix initMountPoints to set usersSetup earlier #26399
Conversation
@PVince81, thanks for your PR! By analyzing the history of the files in this pull request, we identified @icewind1991, @nickvergessen and @MorrisJobke to be potential reviewers. |
} | ||
|
||
self::$usersSetup[$user] = true; | ||
if (isset(self::$usersSetup[$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.
I don't understand this.... This code will always exit here, doesn't it? 😕
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.
You mean I don't understand... I mixed up the rows during conflict solving, sorry
throw new \OC\User\NoUserException('Backends provided no user object for ' . $user); | ||
} | ||
|
||
// workaround in case of different casings | ||
if ($user !== $userObject->getUID()) { | ||
$stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50)); | ||
\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $userObject->getUID() . '" got "' . $user . '". Stack: ' . $stack, \OCP\Util::WARN); | ||
} | ||
$user = $userObject->getUID(); | ||
$user = $userObject->getUID(); |
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.
Calling three times the getUID
method in four lines doesn't look good. Better cache it in a local variable.
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.
ok, adjusted. I'll redo a test
46556dc
to
cae38de
Compare
In general, I feel there are too many calls to |
return; | ||
} | ||
|
||
self::$usersSetup[$user] = true; |
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.
@jvillafanez fixed, I forgot to push...
cae38de
to
2c559f6
Compare
I don't have better alternatives for my previous comment nor for the "checkAndSet" piece of code, so 👍 |
2c559f6
to
ef096ee
Compare
@jvillafanez PR adjusted. I also retested with avatars with different casings to make sure it still works. |
I finally found some steps to reproduce, see #25718 (comment) |
OC 9.0 / stable9 seems unaffected by this bug. It seems that when it gets into |
This is needed because in some cases like LDAP, the user manager itself might trigger avatar updates which would internally also call initMountPoints with the same user. This could cause the same user to be setup twice, and in some sharing situations could cause recursive deduplication of shares by adding "(2)" every time.
ef096ee
to
c82d62a
Compare
Fixed unit test by deleting the |
Okay, actually OC < 9.1 is not affected. This is a regression introduced by me in #24187. So only a forward port is needed. |
build passed, not published due to rate limits => merging |
|
master: #26411 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
This is needed because in some cases like LDAP, the user manager itself
might trigger avatar updates which would internally also call
initMountPoints with the same user. This could cause the same user to
be setup twice, and in some sharing situations could cause recursive
deduplication of shares by adding "(2)" every time.
Related Issue
Fixes #25718
Motivation and Context
See description
How Has This Been Tested?
Very difficult to reproduce: #25718 (comment)
Tested with the provided DB dump with LDAP + avatars, in an env where the issue could be reproduced.
Screenshots (if appropriate):
Types of changes
Checklist:
Backports:
Potentially this issue could appear in previous versions as well, maybe in different forms, so I'd say let's backport to:
stable9not affected@jvillafanez @DeepDiver1975