The Samba-Bugzilla – Attachment 18766 Details for
Bug 15940
vfs_recycle does not update mtime
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
4.22 patch
4.22-patch-15940.patch (text/plain), 10.67 KB, created by
Pavel Filipenský
on 2025-11-04 12:23:19 UTC
(
hide
)
Description:
4.22 patch
Filename:
MIME Type:
Creator:
Pavel Filipenský
Created:
2025-11-04 12:23:19 UTC
Size:
10.67 KB
patch
obsolete
>From 1c6c1b41bbab598c98b06fef36f4a77b911eb99a Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@samba.org> >Date: Sun, 26 Oct 2025 21:01:40 +0100 >Subject: [PATCH 1/3] selftest: Add a test for > recycle:touch,touch_mtime,keeptree >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15940 > >Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >(cherry picked from commit 498984cf346630c17169dbdb13a232854309f6a8) >--- > selftest/knownfail | 1 + > selftest/target/Samba3.pm | 3 +++ > source3/script/tests/test_recycle.sh | 37 ++++++++++++++++++++++++++++ > 3 files changed, 41 insertions(+) > >diff --git a/selftest/knownfail b/selftest/knownfail >index ab2d79d7114..717a2576e63 100644 >--- a/selftest/knownfail >+++ b/selftest/knownfail >@@ -5,6 +5,7 @@ > # a successful run for any of these tests an error. > > ^samba3.blackbox.failure.failure # this is designed to fail, for testing our test infrastructure >+^samba3.blackbox.recycle.recycle_touch # recycle:touch_mtime is not working > .*driver.add_driver_timestamps # we only can store dates, not timestamps > ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption > ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-RECONNECT # expected to give CONNECTION_DISCONNECTED, we need to fix the test >diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm >index 60f7a9a546a..b61e5d6a855 100755 >--- a/selftest/target/Samba3.pm >+++ b/selftest/target/Samba3.pm >@@ -3722,6 +3722,9 @@ sub provision($$) > path = $recycle_shrdir > vfs objects = recycle > recycle : repository = .trash >+ recycle : keeptree = yes >+ recycle : touch = yes >+ recycle : touch_mtime = yes > recycle : exclude = *.tmp > recycle : directory_mode = 755 > >diff --git a/source3/script/tests/test_recycle.sh b/source3/script/tests/test_recycle.sh >index 779683f4822..9f98841bd32 100755 >--- a/source3/script/tests/test_recycle.sh >+++ b/source3/script/tests/test_recycle.sh >@@ -42,6 +42,7 @@ do_cleanup() > cd "$share_test_dir" || return > rm -f testfile1 > rm -f testfile2.tmp >+ rm -f test_mtime > rm -rf .trash > ) > ( >@@ -117,6 +118,38 @@ quit > return 0 > } > >+test_touch() >+{ >+ tmpfile=$PREFIX/test_mtime >+ touch "$tmpfile" >+ if ! $SMBCLIENT -U$USERNAME%$PASSWORD //$SERVER/recycle -I$SERVER_IP $ADDARGS -c "put $tmpfile test_mtime" ; then >+ printf "failed recycle smbclient" >+ return 1 >+ fi >+ rm -f "$tmpfile" >+ atime1=`stat -c '%x' "$share_test_dir/test_mtime"` >+ mtime1=`stat -c '%y' "$share_test_dir/test_mtime"` >+ if ! $SMBCLIENT -U$USERNAME%$PASSWORD //$SERVER/recycle -I$SERVER_IP $ADDARGS -c 'del test_mtime' ; then >+ printf "failed recycle smbclient" >+ return 1 >+ fi >+ test -e "$share_test_dir/.trash/test_mtime" || { >+ printf ".trash/test_mtime expected to exist but does NOT exist\n" >+ return 1 >+ } >+ atime2=`stat -c '%x' "$share_test_dir/.trash/test_mtime"` >+ mtime2=`stat -c '%y' "$share_test_dir/.trash/test_mtime"` >+ test "$atime1" != "$atime2" || { >+ printf "recycle:touch failed: atime should differ: $atime1, $atime2\n" >+ return 1 >+ } >+ test "$mtime1" != "$mtime2" || { >+ printf "recycle:touch_mtime failed: mtime should differ: $mtime1, $mtime2\n" >+ return 1 >+ } >+ return 0 >+} >+ > test_recycle_crossrename() > { > tmpfile=$PREFIX/smbclient_interactive_prompt_commands >@@ -168,6 +201,10 @@ testit "recycle" \ > test_recycle || > failed=$((failed + 1)) > >+testit "recycle_touch" \ >+ test_touch || >+ failed=$((failed + 1)) >+ > testit "recycle_crossrename" \ > test_recycle_crossrename || > failed=$((failed + 1)) >-- >2.51.0 > > >From 872f057adb86a22a5b2c5ae6cb76571c6c5198ee Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@samba.org> >Date: Sat, 25 Oct 2025 00:24:33 +0200 >Subject: [PATCH 2/3] vfs_recycle: Fix trailing whitespace in vfs_recycle.c >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15940 > >Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >(cherry picked from commit 5124acec34c20391cdfeb9d9005365047b7d7eee) >--- > source3/modules/vfs_recycle.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c >index 9c0020a8dbe..057c1a1be66 100644 >--- a/source3/modules/vfs_recycle.c >+++ b/source3/modules/vfs_recycle.c >@@ -363,9 +363,9 @@ static bool matchdirparam(const char **dir_exclude_list, char *path) > return False; > } > >- /* >+ /* > * Walk the components of path, looking for matches with the >- * exclude list on each component. >+ * exclude list on each component. > */ > > for (startp = path; startp; startp = endp) { >-- >2.51.0 > > >From 2d04692f40e3942e8d57c88dff1a2e415739dfe4 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@samba.org> >Date: Sat, 25 Oct 2025 00:24:35 +0200 >Subject: [PATCH 3/3] vfs_recycle: Make recycle:touch/touch_mtime work again if > recycle:keeptree is set >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Problem: Since commit c7839fa smbd: Remove non_widelink_open() > >the atime/mtime is not updated if recycle:keeptree is set > > recycle:keeptree = yes > recycle:touch = yes > recycle:touch_mtime = yes > >Cause: recycle_do_touch() fails since the path ".deleted/administrator/./file" >contains a dot '.' - openat_pathref_fsp_nosymlink() loops over all >components and fails if there is a dot: > >[2025/10/24 20:09:24.618003, 10, pid=95965, effective(65534, 65534), real(65534, 0)] ../../source3/smbd/files.c:1144(openat_pathref_fsp_nosymlink) > openat_pathref_fsp_nosymlink: .deleted/administrator/. contains a dot >[2025/10/24 20:09:24.618007, 5, pid=95965, effective(65534, 65534), real(65534, 0)] ../../source3/smbd/files.c:2337(file_free) > file_free: freed files structure 0 (4 used) >[2025/10/24 20:09:24.618010, 10, pid=95965, effective(65534, 65534), real(65534, 0)] ../../source3/smbd/filename.c:811(filename_convert_dirfsp_nosymlink) > filename_convert_dirfsp_nosymlink: opening directory .deleted/administrator/. failed: NT_STATUS_OBJECT_NAME_INVALID >[2025/10/24 20:09:24.618014, 10, pid=95965, effective(65534, 65534), real(65534, 0)] ../../source3/smbd/open.c:568(fd_openat) > fd_openat: filename_convert_dirfsp_rel returned NT_STATUS_OBJECT_PATH_NOT_FOUND >[2025/10/24 20:09:24.618021, 10, pid=95965, effective(65534, 65534), real(65534, 0)] ../../source3/smbd/files.c:487(openat_pathref_fullname) > openat_pathref_fullname: Opening pathref for [.deleted/administrator/./file] failed: NT_STATUS_OBJECT_NAME_NOT_FOUND > >Here is a backtrace when openat_pathref_fsp_nosymlink() hits: DBG_DEBUG("%s contains a dot\n", path_in); > >0 openat_pathref_fsp_nosymlink (mem_ctx=0x353463c0, conn=0x35322350, in_dirfsp=0x3532a820, path_in=0x3533afe0 ".trash/.", twrp=0, posix=true, _smb_fname=0x7ffdb25df138, _symlink_err=0x7ffdb25df140) at ../../source3/smbd/files.c:1144 >1 filename_convert_dirfsp_nosymlink (mem_ctx=0x353463c0, conn=0x35322350, basedir=0x3532a820, name_in=0x35321a80 ".trash/./mmm", ucf_flags=8, twrp=0, _dirfsp=0x7ffdb25df370, _smb_fname=0x7ffdb25df378, _smb_fname_rel=0x7ffdb25df380, _symlink_err=0x7ffdb25df2d8) at ../../source3/smbd/filename.c:782 >2 filename_convert_dirfsp_rel (mem_ctx=0x353463c0, conn=0x35322350, basedir=0x3532a820, name_in=0x35321a80 ".trash/./mmm", ucf_flags=8, twrp=0, _dirfsp=0x7ffdb25df370, _smb_fname=0x7ffdb25df378, _smb_fname_rel=0x7ffdb25df380) at ../../source3/smbd/filename.c:1097 >3 fd_openat (dirfsp=0x3532a820, smb_fname=0x35321950, fsp=0x3531b670, _how=0x7ffdb25df4b0) at ../../source3/smbd/open.c:549 >4 openat_pathref_fullname (conn=0x35322350, dirfsp=0x3532a820, full_fname=0x7ffdb25df498, smb_fname=0x35321950, how=0x7ffdb25df4b0) at ../../source3/smbd/files.c:437 >5 openat_pathref_fsp (dirfsp=0x3532a820, smb_fname=0x35321950) at ../../source3/smbd/files.c:545 >6 synthetic_pathref (mem_ctx=0x353463c0, dirfsp=0x3532a820, base_name=0x35346ef0 ".trash/./mmm", stream_name=0x0, psbuf=0x0, twrp=0, flags=0, _smb_fname=0x7ffdb25df578) at ../../source3/smbd/files.c:1871 >7 recycle_do_touch (handle=0x35311cb0, smb_fname=0x35346dc0, touch_mtime=true) at ../../source3/modules/vfs_recycle.c:439 >8 recycle_unlink_internal (handle=0x35311cb0, dirfsp=0x352592a0, smb_fname=0x35335eb0, flags=0) at ../../source3/modules/vfs_recycle.c:726 >9 recycle_unlinkat (handle=0x35311cb0, dirfsp=0x352592a0, smb_fname=0x35335eb0, flags=0) at ../../source3/modules/vfs_recycle.c:746 >10 smb_vfs_call_unlinkat (handle=0x35311cb0, dirfsp=0x352592a0, smb_fname=0x35335eb0, flags=0) at ../../source3/smbd/vfs.c:1987 >11 close_remove_share_mode (fsp=0x35344a40, close_type=NORMAL_CLOSE) at ../../source3/smbd/close.c:624 >12 close_normal_file (req=0x35336eb0, fsp=0x35344a40, close_type=NORMAL_CLOSE) at ../../source3/smbd/close.c:932 >13 close_file_smb (req=0x35336eb0, fsp=0x35344a40, close_type=NORMAL_CLOSE) at ../../source3/smbd/close.c:1414 > >Fix: If the path_name is '.', just do not add it. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15940 > >Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> > >Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org> >Autobuild-Date(master): Tue Nov 4 11:38:52 UTC 2025 on atb-devel-224 > >(cherry picked from commit 9bbdfee7f2fdeee3cf530becb2a6f06345627b23) >--- > selftest/knownfail | 1 - > source3/modules/vfs_recycle.c | 2 +- > 2 files changed, 1 insertion(+), 2 deletions(-) > >diff --git a/selftest/knownfail b/selftest/knownfail >index 717a2576e63..ab2d79d7114 100644 >--- a/selftest/knownfail >+++ b/selftest/knownfail >@@ -5,7 +5,6 @@ > # a successful run for any of these tests an error. > > ^samba3.blackbox.failure.failure # this is designed to fail, for testing our test infrastructure >-^samba3.blackbox.recycle.recycle_touch # recycle:touch_mtime is not working > .*driver.add_driver_timestamps # we only can store dates, not timestamps > ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption > ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-RECONNECT # expected to give CONNECTION_DISCONNECTED, we need to fix the test >diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c >index 057c1a1be66..421659fa6ab 100644 >--- a/source3/modules/vfs_recycle.c >+++ b/source3/modules/vfs_recycle.c >@@ -612,7 +612,7 @@ static int recycle_unlink_internal(vfs_handle_struct *handle, > goto done; > } > >- if (config->keeptree) { >+ if (config->keeptree && !ISDOT(path_name)) { > temp_name = talloc_asprintf(frame, "%s/%s", > config->repository, > path_name); >-- >2.51.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
asn
:
review+
Actions:
View
Attachments on
bug 15940
:
18765
| 18766