Bug 15145 - `net usershare add` fails with flag works with --long but fails with -l
Summary: `net usershare add` fails with flag works with --long but fails with -l
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.16.3
Hardware: x64 Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
Depends on:
Reported: 2022-08-13 03:49 UTC by Thaynan Silva
Modified: 2022-08-23 14:51 UTC (History)
3 users (show)

See Also:

patch from master (7.11 KB, patch)
2022-08-17 11:57 UTC, Christian Ambach
asn: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Thaynan Silva 2022-08-13 03:49:23 UTC
Hi there,

When I try adding a new usershare using the tool `net' (package smbclient), if I want to print the share info after creating it, it works with the flag --long, but fails if I use -l and shows this error message:

  reopen_one_log: Unable to open new log file 'directory/log.net': No such file or directory
net usershare add: share name /path/to/directory contains invalid characters (any of %<>*?|/\+=;:",)

This bug has been present for a couple versions. I currently have version 4.16.4 but have downgraded down to 4.15. something and still had this same issue.

It is currently breaking nautilus-share, a plug-in for nautilus that allows sharing files via samba.

My distro is ArchLinux, linux 5.18.16-arch1-1 x86_64.

Thanks in advance,
Comment 1 Christian Ambach 2022-08-15 20:46:48 UTC
The -l option was removed when the command options were streamlined, see this commit

commit 94fc9ca4c506468ab1907d501c0964d67b9d963c
Author:     Andreas Schneider <asn@samba.org>
AuthorDate: Wed Jan 13 14:54:03 2021 +0100
Commit:     Andrew Bartlett <abartlet@samba.org>
CommitDate: Fri May 28 02:55:31 2021 +0000

    s3:utils: Remove '-l' for '--long' from net
    This conflicts with '--log-basename' from the commend cmdline parser.
The first version to include this was 4.15, see also its release notes: https://www.samba.org/samba/history/samba-4.15.0.html

You probably need to file a bug against nautilus.
Comment 2 Christian Ambach 2022-08-15 21:23:13 UTC
Found this: https://bugs.archlinux.org/task/72642, so there should be a fix for ArchLinux.

I'll reopen this bug to fix the usage statement of the net usershare command to not mention the removed -l option any more.
Comment 3 Samba QA Contact 2022-08-17 07:15:14 UTC
This bug was referenced in samba master:

Comment 4 Christian Ambach 2022-08-17 11:57:44 UTC
Created attachment 17480 [details]
patch from master
Comment 5 Christian Ambach 2022-08-17 15:29:53 UTC
Hi Jule,

please include the attached patch in 4.17.

Comment 6 Thaynan Silva 2022-08-18 14:32:37 UTC
Good day!

I'm afraid I can't file a bug because the project is archived, but I'll build a binary from source.

Thanks for the response!
Comment 7 Jule Anger 2022-08-23 05:53:07 UTC
Pushed to autobuild-v4-17-test.
Comment 8 Samba QA Contact 2022-08-23 08:58:03 UTC
This bug was referenced in samba v4-17-test:

Comment 9 Samba QA Contact 2022-08-23 14:51:00 UTC
This bug was referenced in samba v4-17-stable (Release samba-4.17.0rc3):