smbget's -P option

Christian Ambach ambi at samba.org
Mon Feb 15 19:28:26 UTC 2016


Hi list,

while working on blackbox tests for smbget, I wanted to increase the 
code coverage by testing out the -P option.
However, I found some issues with it and wanted to gather opinions if 
the option should be fixed or simply be removed.

The manpage of smbget is very vague about the option:
"Set same permissions on local file as are set on remote file."

What it actually does is:
It uses smbclient's stat commands that will convert the DOS attributes 
into a file mode, similar to what the map hidden, map archive, map 
system, map readonly server options do.
For me, this is not a copy of permissions, but an interpretation of the 
DOS attributes (and should be described as such).

When running in recursive mode, it currently fails spectaculary as it 
sets a mode of 0000 on all directories, leaving them unaccessible until 
manual intervention (and also attempts to chmod() on an empty pathname, 
generating more error messages).

I am not convinced that getting interpreted DOS attributes is
1. what the user expects
2. what the user wants

So before spending more time fixing the issues with the option, I would 
rather tend to remove it (as part of the smbget renovation efforts for 4.4).
Data migration (including ACLs) is outside of the scope of this tool and 
talking about permissions in the docs creates false expectations.

More opinions?

Christian



More information about the samba-technical mailing list