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

[stable24] Fix size calculation on copying the skeleton files #35049

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

juliusknorr
Copy link
Member

Backport of #34834

otherwise the filecache will have a wrong size for skeleton files

Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr requested review from PVince81, icewind1991, a team and come-nc and removed request for a team November 9, 2022 12:12
@juliusknorr juliusknorr added bug 3. to review Waiting for reviews labels Nov 9, 2022
@juliusknorr juliusknorr added this to the Nextcloud 24.0.8 milestone Nov 9, 2022
@juliusknorr juliusknorr merged commit af87f28 into stable24 Nov 10, 2022
@juliusknorr juliusknorr deleted the backport/34834/stable24 branch November 10, 2022 20:31
@nickvergessen
Copy link
Member

This breaks skeleton file creation for guest app users.

Easily testable with running talks integration test: features/conversation/find-listed.feature:22

git bisect start
# status: waiting for both good and bad commits
# good: [6b5a8eec4cd044d74dae9b0add4ccaf812abbaae] [tx-robot] updated from transifex
git bisect good 6b5a8eec4cd044d74dae9b0add4ccaf812abbaae
# status: waiting for bad commit, 1 good commit known
# bad: [5643a62fcc44695853d2be9a5d35c981cc209ebb] [tx-robot] updated from transifex
git bisect bad 5643a62fcc44695853d2be9a5d35c981cc209ebb
# good: [fd452e51c15d53b20cbfdf03cc45eeeab1afd205] Merge pull request #35039 from nextcloud/backport/32211/stable24
git bisect good fd452e51c15d53b20cbfdf03cc45eeeab1afd205
# bad: [7b7ae291c5ca1bbf9ade47a43c0d4b503432c1bf] Merge pull request #35101 from nextcloud/backport/35077/stable24
git bisect bad 7b7ae291c5ca1bbf9ade47a43c0d4b503432c1bf
# bad: [af87f280d038df4f75a3de08f9b0e85278da593d] Merge pull request #35049 from nextcloud/backport/34834/stable24
git bisect bad af87f280d038df4f75a3de08f9b0e85278da593d
# good: [97f2518b9e22318702998c44133ecbc42444d9d2] Merge pull request #35065 from nextcloud/backport/35063/stable24
git bisect good 97f2518b9e22318702998c44133ecbc42444d9d2
# bad: [ed6ef37dd18881f239aec62e060c241352e1d2a8] Use proper storage method for writing skeleton files
git bisect bad ed6ef37dd18881f239aec62e060c241352e1d2a8
# first bad commit: [ed6ef37dd18881f239aec62e060c241352e1d2a8] Use proper storage method for writing skeleton files

@nickvergessen
Copy link
Member

{
  "Exception": "OCP\\Files\\GenericFileException",
  "Message": "file_put_contents failed",
  "Code": 0,
  "Trace": [
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/legacy/OC_Util.php",
      "line": 257,
      "function": "putContent",
      "class": "OC\\Files\\Node\\File",
      "type": "->"
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/legacy/OC_Util.php",
      "line": 216,
      "function": "copyr",
      "class": "OC_Util",
      "type": "::"
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/User/Session.php",
      "line": 553,
      "function": "copySkeleton",
      "class": "OC_Util",
      "type": "::"
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/User/Session.php",
      "line": 403,
      "function": "prepareUserLogin",
      "class": "OC\\User\\Session",
      "type": "->"
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/User/Session.php",
      "line": 616,
      "function": "completeLogin",
      "class": "OC\\User\\Session",
      "type": "->",
      "args": [
        "*** sensitive parameters replaced ***"
      ]
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/User/Session.php",
      "line": 355,
      "function": "loginWithPassword",
      "class": "OC\\User\\Session",
      "type": "->",
      "args": [
        "*** sensitive parameters replaced ***"
      ]
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/User/Session.php",
      "line": 450,
      "function": "login",
      "class": "OC\\User\\Session",
      "type": "->",
      "args": [
        "*** sensitive parameters replaced ***"
      ]
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/private/User/Session.php",
      "line": 575,
      "function": "logClientIn",
      "class": "OC\\User\\Session",
      "type": "->",
      "args": [
        "*** sensitive parameters replaced ***"
      ]
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/lib/base.php",
      "line": 1081,
      "function": "tryBasicAuthLogin",
      "class": "OC\\User\\Session",
      "type": "->"
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/ocs/v1.php",
      "line": 59,
      "function": "handleLogin",
      "class": "OC",
      "type": "::"
    },
    {
      "file": "/home/nickv/Nextcloud/24/server/ocs/v2.php",
      "line": 23,
      "args": [
        "/home/nickv/Nextcloud/24/server/ocs/v1.php"
      ],
      "function": "require_once"
    }
  ],
  "File": "/home/nickv/Nextcloud/24/server/lib/private/Files/Node/File.php",
  "Line": 72,
  "CustomMessage": "--"
}

@juliusknorr
Copy link
Member Author

Strange, I've tried to debug this a bit but could not figure out why 24 would behave different yet.

Overall it seems that the guests app on 24 does not trigger a failure of the newFile call. On master this properly throws a NotPermittedException which is catched and expected in the copy skeleton.

To be continued.

Small test script to trigger the issue directly:

<?php
// curl http://stable24.dev.local/playground/test.php -H 'Cookie: XDEBUG_SESSION=PHPSTORM' -u "guest@guest.com:guest@guest.com"
try {
	require_once __DIR__ . '/../lib/versioncheck.php';
	require_once __DIR__ . '/../lib/base.php';

	// v1.php
	OC_App::loadApps(['session']);
	OC_App::loadApps(['authentication']);
	OC_App::loadApps();

	if (!\OC::$server->getUserSession()->isLoggedIn()) {
		OC::handleLogin(\OC::$server->getRequest());
	}

	$userFolder = \OC::$server->getUserFolder('guest@guest.com');
	OC_Util::copySkeleton('guest@guest.com', $userFolder);
} catch (\Exception $e) {
	echo '<pre>';
	echo get_class($e) . PHP_EOL;
	echo $e->getMessage() . PHP_EOL;
	echo $e->getTraceAsString();
}

@juliusknorr
Copy link
Member Author

Filed #35248 for follow up investigations

@blizzz blizzz mentioned this pull request Nov 21, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants