-
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
9.1.0: realpath error messages in OC log although file uploads succeed #26033
Comments
HA - the "Local" Storage Constructor IS occassionally being called with "/" as argument! I have added a debug_trace() as follows to /lib/private/Files/Storage/Local.php: protected function getPhpStackTraceString()
{
$arrTrace = debug_backtrace();
$strTrace = ''; $strSep = '';
foreach ($arrTrace as $arrCall) {
if ($arrCall['function'] == 'getPhpStackTraceString') continue;
$strFile = '...' . substr($arrCall['file'], 20);
$strCall = $strFile . '#' . $arrCall['line'] . ' ';
// if ($arrCall['class'] != '')
// $strCall .= "{$arrCall['class']}{$arrCall['type']}{$arrCall['function']}(";
// else
$strCall .= $arrCall['function'] . '(';
$strSep2 = '';
foreach ($arrCall['args'] as $mixArg) {
$strCall .= $strSep2;
$strArgType = gettype($mixArg);
switch ($strArgType) {
case "boolean":
$strCall .= $mixArg ? 'true' : 'false';
break;
case "integer":
case "double":
case "string":
$strCall .= $mixArg;
break;
default: // "array", "object", "resource", "NULL", "unknown type"
$strCall .= '{' . $strArgType . '}';
break;
}
$strSep2 = ', ';
}
$strCall .= ')';
$strTrace = $strCall . $strSep . $strTrace;
$strSep = ' | ';
}
return $strTrace;
} // getPhpStackTraceString()
public function __construct($arguments) {
if (!isset($arguments['datadir']) || !is_string($arguments['datadir'])) {
throw new \InvalidArgumentException('No data directory set for local storage');
}
if ($arguments['datadir'] == '/') {
file_put_contents('/tmp/ocdebug', $arguments['datadir'] . "\n" . $this->getPhpStackTraceString() . "\n\n", FILE_APPEND);
} and got this output - once for each file upload from ownCloud Client Version 2.2.3 (build 6307):
I'm not familiar with the SW architecture of OC - can someone who is take a shot at what the cause may be? I'll gladly do more debugging if you tell me what to do. Tim |
Hey guys - this is obviously a real bug - no takers? I am not the only one to observe this problem; a guy reported it on central a few weeks ago. So I have done more debugging, here my observations:
Hope this helps! |
was busy with other critical bugs, sorry... Thanks for debugging. Usually I use this kind of statement:
I'll see if I can reproduce your issue. The Local storage should never be initialized with the root, must be a bug. |
also note that Github is an issue tracker, not a support platform. See http://owncloud.org/support |
@PVince81 Thanks Vincent for taking this up - and of course you are right, this is an issue tracker - it's just sometimes easy to not think straight when one is tired, things are not going right and time is tight. Still you are right - sorry and Grüße nach Stuttgart! That my debug method was crude - yup, sure was, but it worked without me having to know details of what OC offers in that area. |
That, I fully understand 😉 Okay I got something locally and also I finally learnt what "open_basedir" is:
Getting this:
This is indeed suspicious, will debug in detail. |
Stack:
Args given to "Local":
|
Wha... ?! https://github.com/owncloud/core/blob/v9.1.0/lib/private/Files/Storage/Local.php#L412 public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
if ($sourceStorage->instanceOfStorage('\OC\Files\Storage\Local')) {
/**
* @var \OC\Files\Storage\Local $sourceStorage
*/
$rootStorage = new Local(['datadir' => '/']);
return $rootStorage->copy($sourceStorage->getSourcePath($sourceInternalPath), $this->getSourcePath($targetInternalPath));
} else {
return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
}
} |
My first thought was: changing the path to be the data dir. Doesn't work directly. There might be ways to make it work. |
Ok, I got a fix to simply get rid of the useless warning: #26058 Ideally we should find a way to get rid of this root storage but it might be more complicated. |
Thanks Vincent - alles klar! |
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. |
Steps to reproduce
Expected behaviour
Should succeed with no OC log messages
Actual behaviour
Succeeds, but for each file uploaded a message like this appears in the OC log:
{"reqId":"...","remoteAddr":"{my-home-ip}","app":"PHP","message":
"realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s):
(/var/www/vhosts/{domain}/:/tmp/:/dev/urandom:/var/run/redis:/home/mybackup)
at /var/www/vhosts/{domain}/{subdomain}/lib/private/Files/Storage/Local.php#56",
"level":3,"time":"2016-09-06T07:40:45+00:00","method":"PUT",
"url":"/remote.php/webdav/Zed/Server/ownCloud/OC-910-Manual-Fixes.txt","user":"{me}"}
The code line at Local.php#56 is this:
$this->realDataDir = rtrim(realpath($this->datadir), '/') . '/';
If anyone can suggest a debug statement (how to log what is actually in $this->datadir, and even better to output a call stack, then I'll gladly whack it in and post the test results.
I would really appreciate quick support, as I have clients wanting to upgrade and I go on holiday soon!
Server configuration
Operating system
Ubuntu 14.04.5 LTS
Web server:
nginx 1.11.1 (as installed by Plesk)
Database:
mysql
PHP version:
7.0.10 (self compiled)
ownCloud version: 9.1.0
Updated from an older ownCloud or fresh install:
Updated
Where did you install ownCloud from:
https://owncloud.org/install/ From Source-Zip, via CLI
Signing status (ownCloud 9.0 and above):
No errors have been found.
List of activated apps:
Enabled:
Disabled:
The content of config/config.php:
{
"system": {
"instanceid": "oc452bf87cea",
"passwordsalt": "_REMOVED SENSITIVE VALUE",
"trusted_domains": [
"owncloud.biblische-reisen.de"
],
"datadirectory": "/var/www/vhosts/biblische-reisen.de/oc-data",
"dbtype": "mysql",
"version": "9.0.4.1",
"dbname": "owncloudbde",
"dbhost": "localhost",
"dbtableprefix": "oc",
"dbuser": "_REMOVED SENSITIVE VALUE",
"dbpassword": "_REMOVED SENSITIVE VALUE",
"installed": true,
"loglevel": 4,
"forcessl": true,
"theme": "",
"maintenance": false,
"mail_from_address": "owncloud",
"mail_domain": "biblische-reisen.de",
"mail_smtpmode": "php",
"mail_smtpname": "_REMOVED SENSITIVE VALUE",
"mail_smtppassword": "_REMOVED SENSITIVE VALUE",
"default_language": "en",
"secret": "_REMOVED SENSITIVE VALUE",
"log_rotate_size": 10485760,
"check_for_working_wellknown_setup": false,
"check_for_working_htaccess": false,
"memcache.local": "\OC\Memcache\APCu",
"filelocking.enabled": "true",
"memcache.locking": "\OC\Memcache\Redis",
"redis": {
"host": "/var/run/redis/redis.sock",
"port": 0,
"timeout": 0,
"dbindex": 1
},
"trashbin_retention_obligation": "auto",
"updater.secret": "_REMOVED SENSITIVE VALUE"
}
}
Are you using external storage
No
Are you using encryption:
No
Are you using an external user-backend, if yes which one:
No
Client configuration
Browser:
Firefox
Operating system:
Windows 10
Logs
Web server error log
ownCloud log (data/owncloud.log)
Browser log
The text was updated successfully, but these errors were encountered: