Open alexanderharm opened 11 months ago
This may or may not be NC issue, but you'll need to dig a bit deeper into your SMB server's configuration and SMB implementation to help get to the bottom of the matter (your SMB server's underlying OS and OS version are a factor too).
It sounds like a bit like case sensitivity and/or case preservation is disabled on your SMB server (or any number of related options that depend on what your specific SMB server implementation supports).
Please check the manual for your SMB server to determine what it supports in terms of case preservation and sensitivity. You may just need to adjust some options. If it's really old (or oddly configured) there may even be some name mangling involved.
Thanks for your feedback. The server runs Samba (Version 4.17.8-Debian
) and is on default settings which according to Samba are the same for Windows Servers, meaning case insensitive but case preserving
(https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html) which would explain the above behaviour (but I would still suspect Nextcloud to handle the default config of SMB servers gracefully and not to end up with dysfunctional folders).
I can set case sensitive = yes
for testing (only tonight) and I can also check if the dysfunctional folders in Nextcloud are actually dysfunctional on the SMB-server as well.
I can reproduce this error when using NC in docker and mounting the data volume
volumes:
- ./config:/var/www/html/config
- ./data:/var/www/html/data
from nextcloud.log
The destination node already exists, and the overwrite header is set to false
cc @icewind1991 , @artonge
I finally found some time to test further:
case sensitive = Auto
The default setting of auto allows clients that support case sensitive filenames (Linux CIFSVFS and smbclient 3.0.5 and above currently) to tell the Samba server on a per-packet basis that they wish to access the file system in a case-sensitive manner (to support UNIX case sensitive semantics). No Windows or DOS system supports case-sensitive filename so setting this option to auto is that same as setting it to no for them.
My test steps:
WebGUI
99_test
to 99_TEST
99_test
and 99_TEST
99_test
99_test
99_TEST
leaves only 99_test
but dysfunctional99_test
is dysfunctional99_test
and 99_TEST
are both deleted99_test
generates error but deletes folder99_test
is deleted as wellNextcloud Client
99_test
to 99_TEST
99_TEST
shows but is dysfunctional99_TEST
shows but is dysfunctionalSMB-mount
99_test
to 99_TEST
99_TEST
99_TEST
showscase sensitive = yes
My test steps:
99_test
to 99_TEST
99_TEST
99_TEST
99_TEST
99_TEST
to 99_test
99_test
99_test
case sensitive = yes
I feel like the issue lies with how the share is mounted via libsmbclient. I still haven't figured out how nextcloud specifies options to libsmbclient when mounting the share.
The following options:
vers=3.0,_netdev,credentials=/my_path/.secrets/.smb,iocharset=utf8,gid=100033,uid=100033,file_mode=0777,dir_mode=0777,sec=ntlmv2,cache=none,noserverino
allow linux to do a 'mv t.txt T.txt' without a problem.
Using: vers=2.0,_netdev,credentials=/my_path/.secrets/.smb,iocharset=utf8,gid=100033,uid=100033,file_mode=0777,dir_mode=0777,sec=ntlmv2
I get this file name already exists error directly in linux terminal.
Some post I crossed when searching for the issue referenced cache being a problem and setting cache=none helped resolve that. Not quite sure if switching to vers=3.0 or the noserverio options have any effect, but came with the suggestion from the post I found online.
Can anyone point me in the right direction where I can try specifying the SMB mount options values for testing? I found references in files.js and './apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php' but can't quite determine how the libsmbclient has options set for the connection.
⚠️ This issue respects the following points: ⚠️
Bug description
Renaming an object (here folder/directory) on external storage connected via SMB leads to strange results depending on the client.
WebGUI:
99_test
to99_TEST
produces an error message saying that the name is already in use and that I should use a different name99_test
AND99_TEST
99_test
it also shows in99_TEST
and vice versa99_test
Nextcloud client (Windows) with virtual files:
99_test
to99_TEST
produces an error message saying that it failed caused by a protocol error99_test
, sync status remains active99_test
fails in client and WebGUI, folder is dysfunctionalSteps to reproduce
Expected behavior
renaming by just changing case is detected by WebGUI and Nextcloud client as illegal on SMB storage and no file operations are executed.
Installation method
Other Community project
Nextcloud Server version
27
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Nginx
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response