Bug 15828 - Can't delete files anymore with 4.22 when using "Wide Links"
Summary: Can't delete files anymore with 4.22 when using "Wide Links"
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.22.0
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-16 13:45 UTC by Serge
Modified: 2025-04-17 11:54 UTC (History)
2 users (show)

See Also:


Attachments
test patch. (1.55 KB, patch)
2025-03-31 16:43 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Serge 2025-03-16 13:45:03 UTC
Runing on archlinux server (up-to-date).
Everything about Samba was working fine for years, but one specific point seems broken with 4.22

Kernel : 
Linux saturne 6.13.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 27 Feb 2025 18:09:44 +0000 x86_64 GNU/Linux

Samba : 
samba-2:4.22.0-1-x86_64.pkg.tar.zst

Context : 
- i have one share, exposing one folder and containing symlinks pointing to USB attached drives
- because of this, i have the "wild links" option activated (for years)
- since last update, i can still browse and create files or folders in these locations (it's working fine "as before")
- however, now i can NOT anymore delete anything (i have a weird "permission error" at client side (= from another computer) (this is not possible, as i'm able to CREATE new folders, for example) and a "file not found" (see below) in the samba server logs

Configuration is basically (unix permissions are disabled at global level section) : 

[media]
        map archive = no
        printable = no
        write list = <my account>
        path = /home/data/media/
        hide dot files = no
        valid users = <my account>
        read only = no
        public = yes
        browsable = yes
        writable = yes
        case sensitive = yes
        mangled names = no

[downloads]
        copy = media
        path = /home/data/downloads/
        follow symlinks = yes
        wide links = yes


in that download folders i do have symbolic links like : 
lrwxrwxrwx 1 <my account> <my account> 20 2023-10-12 17:37 usb -> /mnt/external/usb/

Again : 
- from a client computer (using NEMO as a file manager) i can create & browse this content as before
- especially i can create new folders (i.e., it does not seem a permission issue - again, permissions are fine everywhere and have not been touched) ("Create new folder" with name "Untitled Folder" => working, folder is created with proper permissions and proper owner (<my account>))
- but when willing to delete that "Untitled Folder" folder (or rename it), i have (with debug log = 3) this in log : 


2025/03/16 14:38:02.311356,  3] ../../lib/util/modules.c:167(load_module_absolute_path)
  load_module_absolute_path: Module '/usr/lib/samba/pdb/tdbsam.so' loaded
(...)
[2025/03/16 14:38:02.314874,  3] ../../source3/lib/util_procid.c:53(pid_to_procid)
  pid_to_procid: messaging_dgm_get_unique failed: Aucun fichier ou dossier de ce nom
(...)
[2025/03/16 14:38:02.324843,  2] ../../source3/smbd/server.c:1386(smbd_parent_loop)
  waiting for connections
[2025/03/16 14:38:20.590342,  3] ../../lib/util/access.c:372(allow_access)
  Allowed connection from 192.168.8.5 (192.168.8.5)



and that weird "STATUS_NO_MORE_FILES" : 


[2025/03/16 14:38:53.125991,  3] ../../source3/smbd/dir.c:734(smbd_dirptr_get_entry)
  smbd_dirptr_get_entry: mask=[*] found Untitled Folder fname=Untitled Folder (Untitled Folder)
[2025/03/16 14:38:53.126190,  3] ../../source3/smbd/smb2_server.c:4074(smbd_smb2_request_error_ex)
  smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[STATUS_NO_MORE_FILES] || at ../../source3/smbd/smb2_query_directory.c:161
[2025/03/16 14:38:53.126756,  3] ../../source3/smbd/smb2_trans2.c:2012(smbd_do_qfsinfo)
  smbd_do_qfsinfo: level = 1007
[2025/03/16 14:38:53.127530,  3] ../../source3/smbd/smb2_trans2.c:2012(smbd_do_qfsinfo)
  smbd_do_qfsinfo: level = 1005
[2025/03/16 14:38:56.555431,  3] ../../source3/smbd/dir.c:734(smbd_dirptr_get_entry)
  smbd_dirptr_get_entry: mask=[*] found . fname=. (.)
[2025/03/16 14:38:56.555540,  3] ../../source3/smbd/dir.c:734(smbd_dirptr_get_entry)
  smbd_dirptr_get_entry: mask=[*] found .. fname=.. (..)
[2025/03/16 14:38:56.555839,  3] ../../source3/smbd/smb2_server.c:4074(smbd_smb2_request_error_ex)
  smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[STATUS_NO_MORE_FILES] || at ../../source3/smbd/smb2_query_directory.c:161
[2025/03/16 14:38:56.558605,  3] ../../source3/smbd/smb2_trans2.c:5097(smbd_do_setfilepathinfo)
  smbd_do_setfilepathinfo: links/usb/Untitled Folder (fnum 243012310) info_level=1013 totdata=1
[2025/03/16 14:38:56.559275,  3] ../../source3/smbd/smb2_server.c:4074(smbd_smb2_request_error_ex)
  smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_OBJECT_NAME_NOT_FOUND] || at ../../source3/smbd/smb2_close.c:111

Seems definitely a regression, i would say.
Comment 1 timo 2025-03-30 11:51:22 UTC
I *think* that the issue that I reported in bug #15841 may be related:

https://bugzilla.samba.org/show_bug.cgi?id=15841
Comment 2 Jeremy Allison 2025-03-31 16:43:28 UTC
Created attachment 18623 [details]
test patch.

Can you test this provisional patch ? It compiles but hasn't gone through the Samba test suite. If it works in your cases we'll need to add regression tests for the specific cases.
Comment 3 Serge 2025-03-31 21:20:02 UTC
Comment on attachment 18623 [details]
test patch.

Sorry i tried but i'm not able to install the patched binary on my side (i'm running archlinux)
- i took the samba source, built everything inside a debian12 container (once patch applied) (and compilation was successful)
- then i took the generated smbd binary from bin/

But then i'm stuck, this binary relies on many libraries not inside my base system, and i'm not sure how to manage that (tried copying a few .so into /usr/lib, but it's far away from being enough).
Comment 4 Serge 2025-03-31 21:30:38 UTC
And also i tried to start from the arch samba package source at gitlab, but i'm also stuck (for a fully different / arch issue), here i'm encountering an old & weird error about "yapp not found" (somehow a conflict with perl-parse-yapp, it seems), so also can't progress in that direction :(