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: Better output in case dataDirectory is invalid #40482
base: master
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
Could this be considered a security risk since we're leaking internal information?. Assuming the directory is invalid, anyone (maybe only registered users) could know where the data directory for ownCloud is located. |
Absolutly - this error is exposed via the browser and we shall never ever expose internal paths. |
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.
writing to log as an alternative is a no-go as we cannot write to data dir.
error_log() might be an alternative - error will go into the webserver error log then
Will |
no |
you can add a condition and use your error message if executed via occ if (\OC::$CLI) {
# TODO: detailed message
} |
Or is this when executing |
No it happened directly when calling |
9a54dfd
to
9713ce9
Compare
Updated the commit by force push to the branch. The output now looks like the following for my specific case:
|
💥 Acceptance tests pipeline apiShareReshareToShares1-mariadb10.2-php7.4 failed. The build has been cancelled. |
9713ce9
to
aeb01eb
Compare
58efbc4
to
30f6ded
Compare
30f6ded
to
3d1c7b4
Compare
@phil-davis can you have a look why the build gets constantly killed by CI? test-javascript |
#40482 (comment)
For some reason there is output "Value of Data directory was: /drone/src/data" mixed in with the output about test tags. I restarted CI to confirm the problem. |
The problem is;
That command is giving "bonus" new output. |
I adjusted the code so that the Data directory message is only emitted if it has a problem. |
Kudos, SonarCloud Quality Gate passed! |
@DeepDiver1975 @jvillafanez please review and comment. If this is OK to do, then I can add a changelog... |
I'd vote for writing the message in the log instead of printing it. Printing messages should be the responsibility of a class as close to the user as possible (one of the
That's the side effect of printing anywhere. Not only it shows irrelevant information to the command, but also it could break 3rd party things (I could use that command to get the version and send an email about the update). If logging isn't possible, I don't know if it's possible to send a 3rd key in the errors. I mean, I assume the "hint" is text that will be displayed in the web, and maybe "error" is a generic error text, so we could add a "cli" key for the error that should be displayed in the command line. |
@pako81 should anyone look at this for 10.13? |
We can try to get this into 10.13. No high priority but still nice to have. @d7oc would you be able to implement the requested change (logging it instead of printing it) ? |
If core/lib/private/legacy/util.php Line 398 in 8e3d093
|
Description
If the dataDirectory is not correct there is currently only the message
Your Data directory is invalid
without specifying which directory is currently set. This small PR aims to add more output in this case.Motivation and Context
It solved the missing output in case something is wrong with the data directory.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: