You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update to invalid app tarball fails with wrong error message #34669
occ market:upgrade -l activity-2.4.2.tar.gz <= the wrong tarball
Expected result
Upgrade fails with proper error message.
Actual result
Original app is deleted but the new app isn't there.
This basically deletes the app...
Version
stable10 / 10.1.0
Note: the "wrong" tarball doesn't have "activity" as root path but "activity-2.4.2".
We should extend the update code to verify that the tarball contains an "activity" folder just like the install process does.
Classification: confirmed-bug (low severity, as labelled p4-low / junior job).
Confirmed on current master (lib/private/Installer.php). @PVince81's 2019 diagnosis is still accurate — here is the located cause.
Root cause
Installer::checkAppsIntegrity() tolerates a tarball whose top-level folder name does not match the app id: when appinfo/info.xml isn't at the archive root it searches one level of subdirectories and locally re-points $extractDir to that subfolder (Installer.php L316–328). But that adjusted $extractDir is not returned — only $info is.
installApp() handles the consequence correctly: after building the source path it verifies it exists before copying, and only an empty freshly-created dir is at risk:
$extractDir .= '/' . $info['id'];
if (\!\file_exists($extractDir)) {
OC_Helper::rmdirr($basedir);
thrownew \Exception($l->t("Archive does not contain a directory named %s", $info['id']));
}
OC_Helper::copyr($extractDir, $basedir);
if (\is_dir($basedir)) {
OC_Helper::rmdirr($basedir); // existing app is deleted here
}
$appInExtractDir = $extractDir;
if (\substr($extractDir, -1) \!== '/') {
$appInExtractDir .= '/';
}
$appInExtractDir .= $info['id']; // builds .../<extractDir>/<appid>OC_Helper::copyr($appInExtractDir, $basedir); // no existence check on source
So for an invalid tarball (top folder name ≠ app id) updateApp first rmdirrs the currently-installed app, then tries to copyr from a path that does not exist. The user sees a confusing copy/filesystem error instead of the clear "Archive does not contain a directory named <appid>" message that installApp produces — and the previously-working app has already been removed.
Suggested fix (junior-friendly)
Mirror the installApp guard in updateApp: after computing $appInExtractDir, throw the same clear "Archive does not contain a directory named %s" error before the rmdirr($basedir) of the existing app, so a bad tarball is rejected without destroying the installed version. (Validating the source path up front also avoids the data-loss side effect.)
🤖 Automated issue analysis by Claude Code review agent.
🤖 Follow-up: opened a fix — #41643. It mirrors installApp()'s archive-directory guard in updateApp(), but runs the check before removing the installed app — so an invalid tarball now yields the correct "Archive does not contain a directory named …" error instead of deleting the installed app and failing with a misleading message. Includes a regression test + fixture.
Activity
PVince81 commentedon Mar 4, 2019
Ref: the update happens here: https://github.com/owncloud/core/blob/v10.1.0/lib/private/Installer.php#L222
The folder gets extracted properly but later on it doesn't get copied over since it has the wrong name.
But at this point the old version was already detected through
rmdirr.ownclouders commentedon Mar 4, 2019
GitMate.io thinks possibly related issues are #21366 (Update), #20661 (Update), #18826 (update fail), #20593 (Update failed), and #11017 (Update fails).
jnweiger commentedon Feb 16, 2022
also, when using a normal occ wapper:
DeepDiver1975 commentedon Jun 21, 2026
Classification: confirmed-bug (low severity, as labelled
p4-low/junior job).Confirmed on current
master(lib/private/Installer.php). @PVince81's 2019 diagnosis is still accurate — here is the located cause.Root cause
Installer::checkAppsIntegrity()tolerates a tarball whose top-level folder name does not match the app id: whenappinfo/info.xmlisn't at the archive root it searches one level of subdirectories and locally re-points$extractDirto that subfolder (Installer.phpL316–328). But that adjusted$extractDiris not returned — only$infois.installApp()handles the consequence correctly: after building the source path it verifies it exists before copying, and only an empty freshly-created dir is at risk:(L119–124)
updateApp()does not have this guard (L216–246):So for an invalid tarball (top folder name ≠ app id)
updateAppfirstrmdirrs the currently-installed app, then tries tocopyrfrom a path that does not exist. The user sees a confusing copy/filesystem error instead of the clear "Archive does not contain a directory named<appid>" message thatinstallAppproduces — and the previously-working app has already been removed.Suggested fix (junior-friendly)
Mirror the
installAppguard inupdateApp: after computing$appInExtractDir, throw the same clear"Archive does not contain a directory named %s"error before thermdirr($basedir)of the existing app, so a bad tarball is rejected without destroying the installed version. (Validating the source path up front also avoids the data-loss side effect.)🤖 Automated issue analysis by Claude Code review agent.
DeepDiver1975 commentedon Jun 21, 2026
🤖 Follow-up: opened a fix — #41643. It mirrors
installApp()'s archive-directory guard inupdateApp(), but runs the check before removing the installed app — so an invalid tarball now yields the correct "Archive does not contain a directory named …" error instead of deleting the installed app and failing with a misleading message. Includes a regression test + fixture.