A bug in Samba?

  • It looks there's a bug in Samba when there are 2 different files with the same name (which are created when the recording of the same movie is stopped and started again later).

    When I access the shared folder Recordings/movie on LE 11 Nightly 20210903 running on RPi 4B/2GB from Windows workstation, I see two files with the same name, different length and different time stamp. When I try to copy them to Windows workstation (using standard Explorer), it looks always only the first file is transferred regardless which one I select, despite the fact the file length is reported properly to Windows.

    Edited 5 times, last by ghtester (September 5, 2021 at 11:26 PM).

  • Please share Pictures, Debug Logs from TVH (or whatever makes the recording) and filesystem output (all to pastebin) to prove that two files of the same name exist in the same filesystem at the same time. That should be impossible, so we need to explain or eliminate that before pointing fingers at Samba server behaving badly in that scenario.

  • I have to confirm that it happened. Tvheadend Server 4.3 (Alpha) Add-on (4.3-1967, 10.0.0.101 by Team LibreELEC)

    AFAIK images can't be put to pastebin (or I don't know how) so I have pasted them here.

    The recording settings:

    I am not sure if national characters could be an issue but it does not happen always, maybe the 2 recordings of the same stream in the short period is a problem.

  • A good point... So on LE's filesystem it's OK.

    It looks I am able to download only the files with eaerlier timestamp.

    For Windows the filenames are the same. The replacement of the first file is offered when I try to download the second file and the correct filename size is reported. It does not matter if I allow the replacement or filename change instead, still the first file is saved.

    Edited once, last by ghtester (September 6, 2021 at 12:04 AM).

  • See the "NAME MANGLING" section in smb.conf .. LE defaults to "mangled names = no" which means the filesystem is case insensitive and the samba default for casing is lowercase, so my (now educated) guess is the "Nova" file is the one that downloads?

    Comments in the docs imply the Windows client does not support case-sensitivity so I'm not sure experimenting with a custom samba.conf will lead anywhere. Better to focus on TVH and ensure it always writes unique Windows compatible filenames (no idea how - not an app I use or have experience with).

  • Yeah, thanks a lot for the opinion, I think you are absolutely right.

    I agree TVH should be configured better to save always a unique file names but currently I also don't know how exactly.

    As in this case the recordings were made from different TV channels (different TV providers, transmitting the same program), enabling the TVH settings Make subdirectories per channel: could perhaps help.

    As it looks there's no Samba / filesystem issue, let's mark this thread as Resolved. Thanks again for your quick help, I have learned something... The only confusing thing is the file size reported properly...

  • Yeah it should help but it's unlikely I'll need to repeat that situation (these recordings were made just to help debugging with another issue with subtitles not displayed on some Live TV channel), I'll keep the current TVH settings.

    But, overall, I think Samba should be still able to serve the both files properly (even with the default name mangling configuration). ?(

    I don't know how the SMB protocol works but it looks Samba is able to recognize which file Windows client requests (as it returns a correct file length when Windows offers replacing the file yet existing with the same filename) but the wrong file (with the different file length than reported) is then sent... I'll try to look at smb.conf to understand better why it works this way.