Skip to content

[WIP] Throw an exception when a user was not found in FS setup - #14044

Closed
PVince81 wants to merge 1 commit into
masterfrom
fs-throwexceptionforinvaliduser
Closed

PVince81 wants to merge 1 commit into
masterfrom
fs-throwexceptionforinvaliduser

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

To avoid unwanted side effects with a wrongly setup FS, if the user was
not found by the user manager, an exception will be thrown.

Should increase robustness a bit and avoid fatal side effects like #12801 (comment)

@icewind1991 @Xenopathic @blizzz @schiesbn @DeepDiver1975

To avoid unwanted side effects with a wrongly setup FS, if the user was
not found by the user manager, an exception will be thrown.
@PVince81 PVince81 changed the title Throw an exception when a user was not found Throw an exception when a user was not found in FS setup Feb 10, 2015
@PVince81

Copy link
Copy Markdown
Contributor Author

I tested this with the broken LDAP upgrade path from #12801 (make sure to have shares). The exception is correctly thrown during the OC6->OC7 upgrade. No bogus storage is created. Applying the patch from #13865 after seeing the error solves it.

I also regression tested this (with encryption enabled):

  • public links
  • s2s sharing + upload

@PVince81 PVince81 added this to the 8.1-next milestone Feb 10, 2015
@blizzz

blizzz commented Feb 10, 2015

Copy link
Copy Markdown
Contributor

And update script does not need to be touched, or will just report the error?

@PVince81

Copy link
Copy Markdown
Contributor Author

This will just report the error, basically blocking the update instead of destroying everything.

@PVince81

Copy link
Copy Markdown
Contributor Author

Consider this like a fuse in an electronic circuit. It's only there as a safety.

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 1 updated code elements

@PVince81

Copy link
Copy Markdown
Contributor Author

@blizzz to clarify: when testing this, do not apply the other patch. Goal is to recreate the original situation we had where the bogus "local::" storages got created. The difference is that with this PR here it will block the update and no bogus storages will be created.

@blizzz

blizzz commented Feb 10, 2015

Copy link
Copy Markdown
Contributor

No, I agree. My point is that this will require other fixes to behave nicer to users. So we need to be prepared that it might throw exception on other places, too. Either we figure them out before (but to be dealt with in seperate PRs), or wait for testing to find them.

@blizzz

blizzz commented Feb 10, 2015

Copy link
Copy Markdown
Contributor

OTOH we are not aware of other cases that result in such problems… ok. was just thinking writingly.

@blizzz

blizzz commented Feb 10, 2015

Copy link
Copy Markdown
Contributor

👍

@PVince81

Copy link
Copy Markdown
Contributor Author
  • fix unit tests

@PVince81

Copy link
Copy Markdown
Contributor Author
  • test with cron jobs that might setup FS without users

@PVince81

Copy link
Copy Markdown
Contributor Author

@icewind1991 can you explain why this was expected:

1) Test\Files\Filesystem::testLocalMountWhenUserDoesNotExist
Exception: Cannot setup FS for user "user_nWx5Xfn6n5JCl" who was not found by the user manager

/srv/www/htdocs/owncloud/lib/private/files/filesystem.php:346
/srv/www/htdocs/owncloud/tests/lib/files/filesystem.php:277

Why do we have this logic that still creates a "local::" based storage for non-existing users ? And why not create a "home::" based one if we really do want an entry ?
Shouldn't we just bail out ? What is the use case ?

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

Quick question: would this exception throw be better suited in the user manager itself? I'm not too familiar with that code, but it seems to me that $manager->get($uid) should always attempt to get the user, else it is a failure and should throw an exception?

@PVince81

Copy link
Copy Markdown
Contributor Author

@Xenopathic it might make sense from a design point of view but who knows what other things will break if we make that change...

@icewind1991

Copy link
Copy Markdown
Contributor

@icewind1991 can you explain why this was expected

No clue, and you added it 😄 34c92f6

@LukasReschke LukasReschke changed the title Throw an exception when a user was not found in FS setup [WIP] Throw an exception when a user was not found in FS setup Feb 24, 2015
@PVince81

Copy link
Copy Markdown
Contributor Author

Hmmm... back then I was still confused by it so I preferred to keep it.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

rescheduling this for 8.2 - we are entering freeze for 8.1 tomorrow

@DeepDiver1975 DeepDiver1975 modified the milestones: 8.2-next, 8.1-current Mar 30, 2015
@MorrisJobke

Copy link
Copy Markdown
Contributor

Lets address this in #15332

@MorrisJobke MorrisJobke closed this Apr 2, 2015
@MorrisJobke
MorrisJobke deleted the fs-throwexceptionforinvaliduser branch April 2, 2015 12:48
@MorrisJobke MorrisJobke removed this from the 8.2-next milestone Apr 2, 2015
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants