Bug 11672 - wildcard pathnames matched incorrectly
Summary: wildcard pathnames matched incorrectly
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.2.5
Hardware: x64 Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2016-01-14 14:52 UTC by Stefan Schmiedl
Modified: 2016-01-15 09:00 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schmiedl 2016-01-14 14:52:24 UTC
I have the following situation on a 3.6.25 and two 4.2.5 samba servers.

Create a new directory in a share with two subdirectories:

    db1 share # mkdir test
    db1 share # cd test
    db1 test # mkdir "3392 Lampenabdeckungen"
    db1 test # mkdir "3077 Stahl Biegearbeiten 1 Zoll"

Given the leading number, I need to find out the complete name, so I use:

    db1 test # smbclient //db1/share -c "ls test/3077*"
    Domain=[...] OS=[Windows 6.1] Server=[Samba 4.2.5]
      3077 Stahl Biegearbeiten 1 Zoll      D        0  Thu Jan 14 15:26:19 2016

which is fine. But trying this for the other number gives a wrong result:

    db1 test # smbclient //db1/share -c "ls test/3392*"
    Domain=[...] OS=[Windows 6.1] Server=[Samba 4.2.5]
      3077 Stahl Biegearbeiten 1 Zoll      D        0  Thu Jan 14 15:26:19 2016
      3392 Lampenabdeckungen              D        0  Thu Jan 14 15:26:06 2016

This popped up in a larger directory (>1100 subdirs named similarly), where a VBA-Macro used Dir on a samba share to determine the full name given the leading project number. About 10 matches like the above in that directory returned an additional wrong result. I can't post the other names due to privacy concerns.
Comment 1 Jeremy Allison 2016-01-15 00:10:09 UTC
Almost certainly this is a match on the 8.3 (truncated name). Samba matches wildcards against both, to cope with UNIX names like a:file:name which otherwise can't be returned to Windows clients.

Try setting the per-share parameter:

mangled names = no

on the share and see if the problem goes away.
Comment 2 Stefan Schmiedl 2016-01-15 09:00:57 UTC
First time in over 15 years of using samba that name mangling even has become visible to me. I'd never have expected that.

Deactivating mangling solves the problem for me.

Thank you very much, Jeremy.

Is resolved/invalid the correct status for this should-have-RTFM-instead-of-filing-a-bug situation?