The branch, v4-23-test has been updated
       via  3f2c2537347 s3:script: Avoid UnicodeDecodeError for 
samba-log-parser processing whole directory
      from  74001ee99f0 vfs_recycle: Make recycle:touch/touch_mtime work again 
if recycle:keeptree is set

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-23-test


- Log -----------------------------------------------------------------
commit 3f2c25373472d67aee31b77eeb65be589f48cb7c
Author: Pavel Filipenský <[email protected]>
Date:   Wed Jul 9 22:38:02 2025 +0200

    s3:script: Avoid UnicodeDecodeError for samba-log-parser processing whole 
directory
    
    When log directory contains zipped files like
    old/log.rpcd_spoolss-20250831.gz we get error.
    We want to ignore such files.
    
    $ samba-log-parser --traceid 6 --merge-by-timestamp
    Traceback (most recent call last):
      File "/usr/bin/samba-log-parser", line 382, in <module>
        main()
        ~~~~^^
      File "/usr/bin/samba-log-parser", line 311, in main
        process_file(
        ~~~~~~~~~~~~^
            record_list,
            ^^^^^^^^^^^^
        ...<3 lines>...
            options.traceid,
            ^^^^^^^^^^^^^^^^
        )
        ^
      File "/usr/bin/samba-log-parser", line 92, in process_file
        data = infile.readlines()
      File "<frozen codecs>", line 325, in decode
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: 
invalid start byte
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15943
    
    Signed-off-by: Pavel Filipenský <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    
    Autobuild-User(master): Pavel Filipensky <[email protected]>
    Autobuild-Date(master): Tue Sep  9 13:50:00 UTC 2025 on atb-devel-224
    
    (cherry picked from commit f636bd3ec08271e79feea6cdd48e48da2af5b1d8)
    
    Autobuild-User(v4-23-test): Jule Anger <[email protected]>
    Autobuild-Date(v4-23-test): Thu Nov  6 15:41:09 UTC 2025 on atb-devel-224

-----------------------------------------------------------------------

Summary of changes:
 source3/script/samba-log-parser | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/samba-log-parser b/source3/script/samba-log-parser
index a07dfdb4a6c..bd8cf580e05 100755
--- a/source3/script/samba-log-parser
+++ b/source3/script/samba-log-parser
@@ -69,7 +69,12 @@ from collections import defaultdict
 
 def process_file_no_traceid(record_list, fname):
     with open(fname, "r") as infile:
-        data = infile.readlines()
+        try:
+            data = infile.readlines()
+        except UnicodeDecodeError:
+            print("This file is not Unicode encoded: ", fname, file=sys.stderr)
+            return
+
     date = ""
     record_lines = []
 
@@ -89,7 +94,12 @@ def process_file_no_traceid(record_list, fname):
 
 def process_file(record_list, traceid_set, fname, opid, otraceid):
     with open(fname, "r") as infile:
-        data = infile.readlines()
+        try:
+            data = infile.readlines()
+        except UnicodeDecodeError:
+            print("This file is not Unicode encoded: ", fname, file=sys.stderr)
+            return
+
     pid = None
     traceid = 0
     traceid_prev = None


-- 
Samba Shared Repository

Reply via email to