Bug 14180 - fallback to unix modes not working on systems without xattr support
Summary: fallback to unix modes not working on systems without xattr support
Status: RESOLVED INVALID
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.9.13
Hardware: All OpenBSD
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-01 08:46 UTC by Jonathan Matthew
Modified: 2019-11-01 17:59 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Matthew 2019-11-01 08:46:18 UTC
On systems without xattr support (such as OpenBSD), the setxattr() wrapper returns ENOSYS, which is mapped to NT_STATUS_NOT_SUPPORTED.  dosmode() and file_set_dosmode() fall back to using unix modes on NT_STATUS_NOT_IMPLEMENTED, but not NT_STATUS_NOT_SUPPORTED, so these functions fail rather than falling back as intended.

I noticed this because subversion tries to hide its .svn directories, so until I set 'store dos attributes = no' in smb.conf, svn didn't work on Windows clients connected to an OpenBSD samba server.

I'm not sure if there's an important difference between NT_STATUS_NOT_SUPPORTED and NT_STATUS_NOT_IMPLEMENTED, so I can't say whether it'd be better to change the mapping of ENOSYS or apply the fallback on either error code.
Comment 1 Ralph Böhme 2019-11-01 09:06:24 UTC
Even on Linux there's no fallback iirc. You have to explicitly disable "store dos attributes" if your filesystem doesn't support xattrs.
Comment 2 Jonathan Matthew 2019-11-01 10:15:32 UTC
Have I misunderstood the purpose of this block?  https://git.samba.org/?p=samba.git;a=blob;f=source3/smbd/dosmode.c;h=38d34623336ed1285830572cacaea2e01ef6797a;hb=HEAD#l995
That seems like what it's there to do.
Comment 4 Jonathan Matthew 2019-11-01 10:55:32 UTC
Sure, I can see how that part of it works.  It just seems to me that it could also cover the case where there's no xattr support available at all, and I don't see anything there to indicate why it shouldn't.  To me, the current situation seems a bit less helpful to the samba administrator than it could be.
Comment 5 Andrew Bartlett 2019-11-01 17:59:25 UTC
(In reply to Jonathan Matthew from comment #4)
We understand, we just found that silent fallbacks bite, they work pretty well so nobody noticed until they hit an edge case.

So we prefer to fail clearly, and ensure that a clear statement has to be put in the smb.conf (which might encourage the administrator to instead ensure xattrs are available).

Now I realise that an administrator deploying exclusively on OpenBSD does not have that option, but here it still remains helpful (compared with a flipped default or 'auto') because when posting the smb.conf to the mailing list, it will be clear that 'store dos attributes = no' has been set to those aiding in debugging. 

Sorry!