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

[Bug]: Can't move folders across different external storage volumes #37741

Closed
6 of 9 tasks
rbeier opened this issue Apr 14, 2023 · 9 comments
Closed
6 of 9 tasks

[Bug]: Can't move folders across different external storage volumes #37741

rbeier opened this issue Apr 14, 2023 · 9 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 26-feedback bug

Comments

@rbeier
Copy link

rbeier commented Apr 14, 2023

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

Hi,

I found a bug related to external storage. I'm using Nextcloud in a docker container on my NAS and have different volumes mounted as external (local) storage.

When moving a folder from one mounting point (Share) to another (Daten) the following errors occurs:

[PHP] Fehler: rename(//mnt/Share/Downloads/Fotos,//mnt/Daten/Fotos): Invalid cross-device link at /var/www/html/lib/private/Files/Storage/Local.php#377

MOVE /remote.php/dav/files/admin/Share/Downloads/Fotos
from 192.168.0.22 by admin at 2023-04-14T15:33:57+00:00

[PHP] Fehler: rename(): The first argument to copy() function cannot be a directory at /var/www/html/lib/private/Files/Storage/Local.php#377

MOVE /remote.php/dav/files/admin/Share/Downloads/Fotos
from 192.168.0.22 by admin at 2023-04-14T15:33:57+00:00

Did some research, turns out this is a known php bug which can be bypassed by using

exec("mv ".escapeshellarg($strOldPath)." ".escapeshellarg($strNewPath));

see https://bugs.php.net/bug.php?id=54097 for more information.

btw. copying the folder works fine.

Steps to reproduce

  1. mount different external storages in your nextcloud instance
  2. move a folder from one external storage to another

Expected behavior

The folder should be moved to the volume

Installation method

Community Docker image

Nextcloud Server version

24

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "26.0.0.11",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "defaultapp": "files"
    }
}

List of activated Apps

Enabled:
  - activity: 2.18.0
  - cloud_federation_api: 1.9.0
  - contactsinteraction: 1.7.0
  - dav: 1.25.0
  - federatedfilesharing: 1.16.0
  - federation: 1.16.0
  - files: 1.21.1
  - files_external: 1.18.0
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - nextcloud_announcements: 1.15.0
  - notifications: 2.14.0
  - oauth2: 1.14.0
  - password_policy: 1.16.0
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - support: 1.9.0
  - survey_client: 1.14.0
  - systemtags: 1.16.0
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - viewer: 1.10.0
  - workflowengine: 2.8.0
Disabled:
  - admin_audit: 1.16.0
  - bruteforcesettings: 2.6.0
  - circles: 26.0.0 (installed 26.0.0)
  - comments: 1.16.0 (installed 1.16.0)
  - dashboard: 7.6.0 (installed 7.6.0)
  - encryption: 2.14.0
  - photos: 2.2.0 (installed 2.2.0)
  - suspicious_login: 4.4.0
  - twofactor_totp: 8.0.0-alpha.0
  - user_ldap: 1.16.0
  - user_status: 1.6.0 (installed 1.6.0)
  - weather_status: 1.6.0 (installed 1.6.0)

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@rbeier rbeier added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Apr 14, 2023
@szaimen

This comment was marked as resolved.

@rbeier
Copy link
Author

rbeier commented Jun 2, 2023

Hi,
updated to 26.0.2 but the bug still occurs. Got a 403 response from
MOVE http://192.168.0.2:8003/remote.php/dav/files/admin/Share/Downloads/xyz

Response:

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\Forbidden</s:exception>
  <s:message/>
</d:error>

Got the following errors in the log:

[PHP] Fehler: rename(//mnt/Share/Downloads/xyz,//mnt/Games/xyz): Success at /var/www/html/lib/private/Files/Storage/Local.php#378

MOVE /remote.php/dav/files/admin/Share/Downloads/xyz
from 192.168.0.22 by admin at 2023-06-02T13:25:55+00:00
[PHP] Fehler: rename(): The first argument to copy() function cannot be a directory at /var/www/html/lib/private/Files/Storage/Local.php#378

MOVE /remote.php/dav/files/admin/Share/Downloads/xyz
from 192.168.0.22 by admin at 2023-06-02T13:25:55+00:00

@joshtrichards
Copy link
Member

Duplicate of #14743

@bgottschall
Copy link

Version 27.0.2 bug still present

@joshtrichards
Copy link
Member

@bgottschall - The fix is in #38623 so it'll show up in v28.

@kesselb kesselb closed this as completed Aug 16, 2023
@kesselb
Copy link
Contributor

kesselb commented Aug 16, 2023

Thanks, please create a new issue when the problem continues to occur with Nextcloud 28.

@rivolity
Copy link

rivolity commented Sep 3, 2023

@bgottschall
You can just update the "public function rename" with the new function that is present in the last release
in your Local.php under /lib/private/Files/Storage/Local.php
delete the whole function public function rename
replace it with the last release function
https://github.com/nextcloud/server/blob/master/lib/private/Files/Storage/Local.php#L338C1-L372C3

@HammyHavoc
Copy link

@bgottschall You can just update the "public function rename" with the new function that is present in the last release in your Local.php under /lib/private/Files/Storage/Local.php delete the whole function public function rename replace it with the last release function https://github.com/nextcloud/server/blob/master/lib/private/Files/Storage/Local.php#L338C1-L372C3

Just to confirm what you're saying with this—you're saying I can copy-paste a few lines from v28 into my v27.1.3 without breaking anything and it'll fix the above issue?

@rivolity
Copy link

@HammyHavoc
Yes you will update just the function that I have specified in my last comment, not all the file.
The function is called
public function rename
Using this release File-release , search for the same function, copy it and replace it in
/lib/private/Files/Storage/Local.php
Again, you need to replace just the function not the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 26-feedback bug
Projects
None yet
Development

No branches or pull requests

8 participants