Skip to content
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

configurable ownlcloud temp directory location #16636

Closed

Conversation

mmattel
Copy link
Contributor

@mmattel mmattel commented May 30, 2015

With this PR, the location of the temp directory used by owncloud can be configured.

Please see also PR #13031 (Configurabe owncloud temporary directory) which was closed due to rebasing problems.

* Get the temporary directory to store transfer data
* @return null|string Path to the temporary directory or null
*/
public function t_get_temp_dir() {
Copy link
Member

Choose a reason for hiding this comment

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

Function names need to be in camelCase as per contribution guidelines

@mmattel mmattel force-pushed the configurable_owncloud_temp_dir_II branch 2 times, most recently from e1bd94a to 9e11164 Compare May 30, 2015 12:48
@mmattel
Copy link
Contributor Author

mmattel commented May 30, 2015

all changes requested done and squashed

@mmattel
Copy link
Contributor Author

mmattel commented May 30, 2015

Note regarding the build failure:

There were 2 failures:

1) Test\TempManager::testLogCantCreateFile
Failed asserting that '/tmp/oc_tmp_KxlMwF-.txt' is false.

/var/www/xxx/tests/lib/tempmanager.php:138

2) Test\TempManager::testLogCantCreateFolder
Failed asserting that '/tmp/oc_tmp_5TFKFA-folder/' is false.

/var/www/xxx/tests/lib/tempmanager.php:152

These two failures also pop up when I have cloned a brand fresh master from git (tested yesterday and today), just finalizing the installation, without applying any PR or changing any code.

@RobinMcCorkell
Copy link
Member

The unit test failures are caused by the changes to the TempManager unit test, where the TempManager is not given the correct base directory. The baseDir used to get passed in during TempManager construction, but now the class is self-sufficient and so it does not get passed in.

Perhaps the best solution would be to have an extra parameter to TempManager, to specify the baseDir. If specified as null, the TempManager determines the baseDir by itself. This enables our unit tests to work with little change.

// Get the temporary directory and log the path if loglevel is set to debug
// Info: based on the temp dir, further directories may be created unique to the instance
$temp = $this->gatherTempDir();
\OCP\Util::writeLog('Core', 'Temporary directory set to: ' . ($temp ? $temp : 'NULL'), \OCP\Util::DEBUG);
Copy link
Member

Choose a reason for hiding this comment

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

Use $this->log to write log messages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tried but:
Call to undefined method OC\\TempManager::log()
Will stay at the current code

@mmattel
Copy link
Contributor Author

mmattel commented May 31, 2015

@Xenopathic

The unit test failures are caused by the changes to the TempManager unit test

I do not believe that, because as written, the test failed on blank and fresh git clone from master also, which was just finalized by the installing procedure having no single line of code changed. Just give it a try...

changes as requested

return false -> return null

updates
@mmattel mmattel force-pushed the configurable_owncloud_temp_dir_II branch from 9e11164 to 652d9d5 Compare May 31, 2015 08:41
@scrutinizer-notifier
Copy link

A new inspection was created.

@ghost
Copy link

ghost commented May 31, 2015

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/12608/

Build result: FAILURE

[...truncated 14 lines...] > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10 > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.gitusing GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git3763832391780320647.credentials # timeout=10 > git -c core.askpass=true fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse refs/remotes/origin/pr/16636/merge^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/pr/16636/merge^{commit} # timeout=10Checking out Revision 74b7d141e32469189c0a4042c7960685f10b85f2 (refs/remotes/origin/pr/16636/merge) > git config core.sparsecheckout # timeout=10 > git checkout -f 74b7d141e32469189c0a4042c7960685f10b85f2 > git rev-list 6de87dbc5022e9b2dd1cc6bbdceb2b1a05e633c1 # timeout=10First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » SLAVEpull-request-analyser-ng-simple » SLAVE completed with result FAILURESetting status of 652d9d5 to FAILURE with url https://ci.owncloud.org/job/pull-request-analyser-ng-simple/12608/ and message: Build finished.
💣 Test FAILed. 💣

nooo432

@RobinMcCorkell
Copy link
Member

@mmattel Other PRs are resulting in test success: https://ci.owncloud.org/job/pull-request-analyser-ng-simple/12605/ for example. The problem is, as I mentioned, the fact that before the unit tests passed a custom baseDir path into TempManager, but now the path is decided inside TempManager so the unit test does not have the chance to pass its custom path in, so there is a discrepancy. The unit tests that fail set what they think the baseDir to be to be unwritable (chmod 500), but the TempManager has the wrong baseDir so it doesn't affect it.


protected function setUp() {
parent::setUp();

$this->baseDir = get_temp_dir() . $this->getUniqueID('/oc_tmp_test');
$this->baseDir = $this->getManager()->getTempDir() . $this->getUniqueID('/oc_tmp_test');
Copy link
Member

Choose a reason for hiding this comment

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

The line in question is here - this baseDir needs to get passed into TempManager somehow

@MorrisJobke
Copy link
Contributor

@mmattel How can we help out here?

@Xenopathic Any advise?

@RobinMcCorkell
Copy link
Member

The ability to override the temp directory for unit tests is absolutely critical. I'd suggests introducing a new method to TempManager that overrides the temp dir. This can be used in the unit tests.

@mmattel
Copy link
Contributor Author

mmattel commented Aug 28, 2015

This is a good idea, but I currently do not have any free minute to do this. Just became a grandpa... 😄

@MorrisJobke
Copy link
Contributor

@Xenopathic Can you help out and jump in? :)

@lock lock bot locked as resolved and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants