Can't determine shared folders

Bug #917906 reported by Moritz Winter
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
nautilus-share (Debian)
Confirmed
Undecided
Unassigned
nautilus-share (Ubuntu)
Confirmed
Undecided
Unassigned
samba (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

If I restart my machine after I shared a folder the "shared" icon is missing and the context-menu share-option is turned off as if the folder isn't shared anymore. If I access the folder from another computer over the network the folder is still shared. So I can't determine from within the system which folders are shared and can't really unshare them.

Workaround: Look which folders are shared from another computer/vm, share them again and deselect sharing without rebooting.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: nautilus-share 0.7.3-1ubuntu1
ProcVersionSignature: Ubuntu 3.0.0-14.23-generic 3.0.9
Uname: Linux 3.0.0-14-generic x86_64
NonfreeKernelModules: fglrx
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Tue Jan 17 22:58:10 2012
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
ProcEnviron:
 PATH=(custom, user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
SourcePackage: nautilus-share
UpgradeStatus: No upgrade log present (probably fresh install)

[edit]

The bug occurs when the result of the command "net usershare info" ends with an error message, which is caused e.g. by deleting (or moving/renaming) a shared folder, which name goes last in the alphabet in relation to other shared folders. (exception seems to be shares that begin with the letter "a". Shares that begin with "a" are always listed last)
This is because the share definition in /var/lib/samba/usershares will not be removed after deleting a shared folder.
The bug can be fixed if the (alphabetically last) obsolent share definition is deleted.

This Bug affects all Distributions using gnome (testet on Ubuntu 10.04 and
Ubuntu 12.04 beta-2 as well as the current Debian stable release.)

Revision history for this message
Moritz Winter (winter-moritz) wrote :
Revision history for this message
Chow Loong Jin (hyperair) wrote : Re: [Bug 917906] [NEW] Can't determine shared folders

On 18/01/2012 06:04, Moritz Winter wrote:
> Public bug reported:
>
> If I restart my machine after I shared a folder the "shared" icon is
> missing and the context-menu share-option is turned off as if the folder
> isn't shared anymore. If I access the folder from another computer over
> the network the folder is still shared. So I can't determine from within
> the system which folders are shared and can't really unshare them.
>
> Workaround: Look which folders are shared from another computer/vm,
> share them again and deselect sharing without rebooting.

The Sharing Option context menu item is always turned on for folders. Are you
sure you have nautilus-share installed? If so, nautilus might be having some
issues loading the plugin.

Please kill nautilus and post the output of a newly launched nautilus instance
in the terminal. Also, please post the output of "net usershare info"

  status incomplete

--
Kind regards,
Loong Jin

Changed in nautilus-share (Ubuntu):
status: New → Incomplete
Revision history for this message
Moritz Winter (winter-moritz) wrote :

Hi, sorry if my description wasn't as clear as intendend, this is because I'm using the german translation and have to guess how the context-menu-entries are labeled.
What i meant was that if i right-click on the directory and choose the "sharing-options" (Freigabeoptionen) the checkmark on "Share this folder" (Diesen Ordner freigeben) isn't set anymore.

killall nautilus && nautilus:
Nautilus-Share-Message: Called "net usershare info" but it failed: »net usershare« gab den Fehler 255 zurück: info_fn: file /var/lib/samba/usershares/drop is not a well formed usershare file.
info_fn: Error was Path is not a directory.

net usershare info:
info_fn: file /var/lib/samba/usershares/drop is not a well formed usershare file.
info_fn: Error was Path is not a directory.

I will delete the file ('drop') mentioned above and will report back if the error still exists.

Revision history for this message
Chow Loong Jin (hyperair) wrote : Re: [Bug 917906] Re: Can't determine shared folders

On 18/01/2012 12:29, Moritz Winter wrote:
> Hi, sorry if my description wasn't as clear as intendend, this is because I'm using the german translation and have to guess how the context-menu-entries are labeled.
> What i meant was that if i right-click on the directory and choose the "sharing-options" (Freigabeoptionen) the checkmark on "Share this folder" (Diesen Ordner freigeben) isn't set anymore.
>
> killall nautilus && nautilus:
> Nautilus-Share-Message: Called "net usershare info" but it failed: »net usershare« gab den Fehler 255 zurück: info_fn: file /var/lib/samba/usershares/drop is not a well formed usershare file.
> info_fn: Error was Path is not a directory.
>
> net usershare info:
> info_fn: file /var/lib/samba/usershares/drop is not a well formed usershare file.
> info_fn: Error was Path is not a directory.
>
> I will delete the file ('drop') mentioned above and will report back if
> the error still exists.

Thanks, that makes sense. It would be useful if you could attach it here as
well. This could be a samba bug.

nautilus-share is really just a frontend for the "net usershare" command that
comes with samba.

--
Kind regards,
Loong Jin

Revision history for this message
Moritz Winter (winter-moritz) wrote :

I can't reproduce the bug now, after I deleted the erroneous file. What should I attach? Many thanks for the help!

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for nautilus-share (Ubuntu) because there has been no activity for 60 days.]

Changed in nautilus-share (Ubuntu):
status: Incomplete → Expired
Revision history for this message
masteryoda (hal66rr) wrote :

I have experienced this problem several times now and I think it should definitly be fixed.

The bug it has obviously something to do with how nautilus reads the usershares definition under /var/lib/samba/usershares, which is affected by the usershare settings in the smb.conf file.
So I think it has to do with the communication between nautilus (especially the usershare function) and samba.

After noticing the bug I tried reconfiguring the smb.conf file which has been modified by me in the past. So first of all it would be interesting to know wheater other users who experienced this bug also have been modifieing the smb.conf file.

After I reset the guest settings in smb.conf, more precisely the "guest ok = yes" the bug was gone. I restartet several times after resetting different options so I think it rather hast something to do with the usershare allow guest setting but I could not reproduce the bug since then.

Using:

Ubuntu 10.04-4 LTS
Samba 3.4.7

Changed in nautilus-share (Ubuntu):
status: Expired → Confirmed
Revision history for this message
Chow Loong Jin (hyperair) wrote :

On 08/04/2012 03:44, masteryoda wrote:
> I have experienced this problem several times now and I think it should
> definitly be fixed.
>
> The bug it has obviously something to do with how nautilus reads the usershares definition under /var/lib/samba/usershares, which is affected by the usershare settings in the smb.conf file.
> So I think it has to do with the communication between nautilus (especially the usershare function) and samba.
>
> After noticing the bug I tried reconfiguring the smb.conf file which has
> been modified by me in the past. So first of all it would be interesting
> to know wheater other users who experienced this bug also have been
> modifieing the smb.conf file.
>
> After I reset the guest settings in smb.conf, more precisely the "guest
> ok = yes" the bug was gone. I restartet several times after resetting
> different options so I think it rather hast something to do with the
> usershare allow guest setting but I could not reproduce the bug since
> then.

nautilus-share does not access the files in /var/lib/samba/usershare directly.
It only talks to samba via the "net usershare" command.

During startup, it parses the output of "net usershare info". If, for some
reason, that command fails, then nautilus-share will not know what directories
are shared.In your case, that's most probably what's happening.

The next time you encounter this issue, please get the output of "net usershare
info" in a terminal.

--
Kind regards,
Loong Jin

Revision history for this message
masteryoda (hal66rr) wrote :

I got it, I reproduced the bug:

If you define a share, the definition is made in /var/lib/samba/usershares.
But if you delete a Folder that is being shared, the definition in /var/lib/samba/usershares will not be removed.
After restarting all other shares will not be shown as "shared" (the share icon is not visible anymore) and thats the bug. This will only occur if the deleted folder was not only shared but hab writing permissions to other samba users (second option in the kontex menu)

So in other words: The bug is caused by deleting a shared folder, with write permissions to other users.

A workaround as well as probably the final solution would be to delete all obsolent sharing definitions in /var/lib/samba/usershares.
Unfortunately I cannot fix this by myself (not a programmer yet) so please someone take that time.

If I enter "net usershare info" after the bug occurs this is the result (I hat two folders shared, which are named "one" and "two", I deleted "two"):

~$ net usershare info
[one]
path=/home/gnomeuser/Desktop/one
comment=
usershare_acl=Everyone:F,
guest_ok=n

info_fn: file /var/lib/samba/usershares/two is not a well formed usershare file.
info_fn: Error was Path is not a directory.
gnomeuser@gnomeuser-VM:~$

Also there is a simular bug that is probably related: If you share a default folder in your homefolder it gets the share icon above the default icon, but after restarting the shared icon is gone as well.
I could not reproduce this bug by using a new folder with an normal icon, which might have to to with the fact that the share icon in that case is below the icon I setted, while with the default icons the shared icon is above the default icon.

Revision history for this message
masteryoda (hal66rr) wrote :

Correction:

1. The shared folder does not have to own writing privileges for other users for the bug to occur.
Deleting simply a shared folder produces the bug as well.

2. The bug is reproduceable using folder names "one and two". I just tried it with the names "aa" and "bb" but it didn't work for some reason.

I will keep trying to figure out more about it.

Revision history for this message
masteryoda (hal66rr) wrote :

Ok I got the hopefully final solution:

The bug only occurs if the name of the deleted folder beginns with a letter that stands before the first letter of the second folder in the alphabet.

For example: If you have the shared folders "one" and "two", you have to delete "two" for the bug to occur.
If you have the folder names "aa" and "bb" you must delete "aa" for the bug to occur.

When deleting the alphabetically first folder the result of "net usershare info" will show first the normal share definition and at the end the error message. Thats what causes the bug.

If you delete the alphabetically second folder, "net usershare info" will show the error message first, and then the normal share definition. In this case the bug will not occur.

Summary:

If the result of the command "net usershare info" ends with an error message the described bug will occur.
The solution is: After deleting a shared folder, the share defninition in /var/lib/samba/usershares has to be removed as well.

Revision history for this message
masteryoda (hal66rr) wrote :

Correction:

The explanation with the alphabetical order was wrong (obviously ;))

But the order of the shares in "net usershare info" still counts.
It's just taht I cannot say how the order of the share definitions is determined.

Revision history for this message
masteryoda (hal66rr) wrote :

Again two additions:

1. The alphabetical order is relevant it's just that userg "a" and "b" is kinda an exception with my system right now, but using other names the normal order is alphabetically

2. The bug will also occur if you rename the shared folder, which is logical, since the share definitions become corrupt if the defined folder is changed in any way (or at least it seems that way).

Revision history for this message
masteryoda (hal66rr) wrote :

This bug also affects Ubuntu 12.04 Beta-2.

I didn't try it with different versions but the bug will probably affect all versions of Ubuntu since this feature was added.

masteryoda (hal66rr)
description: updated
description: updated
masteryoda (hal66rr)
description: updated
Revision history for this message
Chow Loong Jin (hyperair) wrote :

  status triaged

I think a possible solution would be to monitor each shared directory and remove
the corresponding shares when the directory is deleted or moved. On the other
hand, this won't help cases where the share is deleted while the user is not
logged in (e.g. by terminal).

--
Kind regards,
Loong Jin

Changed in nautilus-share (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
masteryoda (hal66rr) wrote :

The solution could be to add a removal command for the sahre definition to the remove and move command, but this would end up dirty right?

How about letting the net usershare command react to the error message?

Revision history for this message
Chow Loong Jin (hyperair) wrote :

On 08/04/2012 23:36, masteryoda wrote:
> The solution could be to add a removal command for the sahre definition
> to the remove and move command, but this would end up dirty right?

Yes it could, but it would solve another issue of the share path not following
directory renames/moves.

> How about letting the net usershare command react to the error message?

Well, the net usershare command is the one actually generating the error message
in the first place. I'd much prefer net usershare to just spit out a warning on
stderr and continue.

--
Kind regards,
Loong Jin

Revision history for this message
masteryoda (hal66rr) wrote :

Well I don't now much about this but it seem rather important to me that 1. the obsolent share definitions will be removed, because creating a new folder with the same name of a once shared (and then deleted) folder will unintentionally share the new folder as well. Furthermore it is importet that the sharing icons won't disappear, so user will still see that a folder is shared. Both problems can lead to security risks and since the bug affects probably all distributions who use nautilus, the problem is major.

masteryoda (hal66rr)
security vulnerability: no → yes
masteryoda (hal66rr)
description: updated
description: updated
Revision history for this message
masteryoda (hal66rr) wrote :

How about this for a start:

Instead of just creating the error message, the net usershare command should at least delete the corrupt usershare definitions. Still this does not solve the remove/rename problem but that is not as severe as obsolent share definition.

I cannot change the code myself but apart from that I am willing to help. If there is something I can do please contact me: <email address hidden>

Revision history for this message
Chow Loong Jin (hyperair) wrote :

On 10/04/2012 07:09, masteryoda wrote:
> How about this for a start:
>
> Instead of just creating the error message, the net usershare command
> should at least delete the corrupt usershare definitions. Still this
> does not solve the remove/rename problem but that is not as severe as
> obsolent share definition.
>
>
> I cannot change the code myself but apart from that I am willing to help. If there is something I can do please contact me: <email address hidden>
>

Well for the time being we can open a task against samba, which is where the
`net' command comes from.

  affects ubuntu/samba

--
Kind regards,
Loong Jin

James Page (james-page)
Changed in samba (Ubuntu):
importance: Undecided → Medium
Revision history for this message
masteryoda (hal66rr) wrote :

I have opened up a bug report at bugzilla.samba.org as well.
https://bugzilla.samba.org/show_bug.cgi?id=8852

security vulnerability: yes → no
security vulnerability: yes → no
masteryoda (hal66rr)
Changed in samba (Ubuntu):
status: New → Confirmed
Revision history for this message
masteryoda (hal66rr) wrote :

Creating usershares:

gnomeuser@gnomeuser:~/Desktop/test$ mkdir
/home/gnomeuser/Desktop/test/{bb,gg,pp}
gnomeuser@gnomeuser:~/Desktop/test$ net usershare add cc
'/home/gnomeuser/Desktop/test/bb'

gnomeuser@gnomeuser:~/Desktop/test$ net usershare info
[cc]
path=/home/gnomeuser/Desktop/test/bb
comment=
usershare_acl=Everyone:R,
guest_ok=n

gnomeuser@gnomeuser:~/Desktop/test$ net usershare add ww
'/home/gnomeuser/Desktop/test/gg'
gnomeuser@gnomeuser:~/Desktop/test$ net usershare add ff
'/home/gnomeuser/Desktop/test/pp'
gnomeuser@gnomeuser:~/Desktop/test$ net usershare info
[ff]
path=/home/gnomeuser/Desktop/test/pp
comment=
usershare_acl=Everyone:R,
guest_ok=n

[cc]
path=/home/gnomeuser/Desktop/test/bb
comment=
usershare_acl=Everyone:R,
guest_ok=n

[ww]
path=/home/gnomeuser/Desktop/test/gg
comment=
usershare_acl=Everyone:R,
guest_ok=n

When creating usershares like this (via terminal), the sharing icons won't
appear until nautilus is restarted (respectively a specific command, which I
don't know, is executed)

gnomeuser@gnomeuser:~/Desktop/test$ ls
bb gg pp

gnomeuser@gnomeuser:~/Desktop/test$ mv gg ggg
gnomeuser@gnomeuser:~/Desktop/test$ ls
bb ggg pp

gnomeuser@gnomeuser:~/Desktop/test$ net usershare info
[ff]
path=/home/gnomeuser/Desktop/test/pp
comment=
usershare_acl=Everyone:R,
guest_ok=n

[cc]
path=/home/gnomeuser/Desktop/test/bb
comment=
usershare_acl=Everyone:R,
guest_ok=n

info_fn: file /var/lib/samba/usershares/ww is not a well formed usershare file.
info_fn: Error was Path is not a directory.

After restarting nautilus, all sharing icons will disappear.

The sharing definition is still there:

gnomeuser@gnomeuser:/var/lib/samba/usershares$ cat ww
#VERSION 2
path=/home/gnomeuser/Desktop/test/gg
comment=
usershare_acl=S-1-1-0:R
guest_ok=n

Revision history for this message
masteryoda (hal66rr) wrote :

Quote from bugziall.samba (https://bugzilla.samba.org/show_bug.cgi?id=8852#c6)

Ok. This is a nautilus problem. The last step printing the error message prints
that error to stderr, the valid shares are listed on stdout. Again, I think
Samba just behaves correctly. Just tested this.

Regarding the disappearing icons: Samba does print out a list of the remaining
valid shares. Why nautilus does not display them is up to nautilus. I also
tested smbclient -L against the different situations: smbd lists the valid
shares even when there are invalid ones.

Revision history for this message
masteryoda (hal66rr) wrote :

samba works correctly regarding this matter

The problem is with nautilus, respectively the handeling of the sharing icons by nautilus.

Changed in samba (Ubuntu):
status: Confirmed → Invalid
Changed in nautilus-share (Ubuntu):
status: Triaged → Confirmed
Revision history for this message
Chow Loong Jin (hyperair) wrote :

On 04/05/2012 22:25, masteryoda wrote:
> samba works correctly regarding this matter
>
> The problem is with nautilus, respectively the handeling of the sharing
> icons by nautilus.
>
> ** Changed in: samba (Ubuntu)
> Status: Confirmed => Invalid
>
> ** Changed in: nautilus-share (Ubuntu)
> Status: Triaged => Confirmed
>

The problem here is that "net usershare info" does not return an exit code of 0,
indicating that something has failed somewhere. But I'm guessing from their
response that I'm supposed to parse the output from stdout anyway and ignore the
exit code.

--
Kind regards,
Loong Jin

Revision history for this message
masteryoda (hal66rr) wrote :

new bugreport on bugzilla.gnome:

https://bugzilla.gnome.org/show_bug.cgi?id=675450

Revision history for this message
Chow Loong Jin (hyperair) wrote :

On 04/05/2012 23:18, masteryoda wrote:
> new bugreport on bugzilla.gnome:
>
> https://bugzilla.gnome.org/show_bug.cgi?id=675450
>
> ** Bug watch added: GNOME Bug Tracker #675450
> https://bugzilla.gnome.org/show_bug.cgi?id=675450
>

nautilus-share is not part of nautilus. It is a plugin maintained separately
from Nautilus itself. As I'm not a developer of nautilus, I can't close the bug
myself, so you'll either have to close it yourself or wait for a nautilus
developer to mark it as RESOLVED NOTGNOME.

Nautilus-share itself doesn't seem to have a bugtracker (or I have not found
it), so this and bugs.debian.org are the only location I receive bugs from, as
both the package and upstream maintainer of nautilus-share. However, I don't
have the time to work on this bug at the moment. I would be glad to review and
commit a patch from you if you manage to fix it, though.

--
Kind regards,
Loong Jin

Revision history for this message
masteryoda (hal66rr) wrote :

Regarding the issue of the disappearing icons; isn't this a direct nautilus problem (not nautilus-share)?

As far as I know, the nautilus-share extension package only extends the context menu and communicates with samba via net usershare (which is a samba tool).

Unfortunaltely I only have minor programming skills, and furthermore, I'm not even sure what exactly the problem is (regarding the code).

Revision history for this message
Chow Loong Jin (hyperair) wrote :

On 05/05/2012 01:59, masteryoda wrote:
> Regarding the issue of the disappearing icons; isn't this a direct
> nautilus problem (not nautilus-share)?
>
> As far as I know, the nautilus-share extension package only extends the
> context menu and communicates with samba via net usershare (which is a
> samba tool).
>
>
> Unfortunaltely I only have minor programming skills, and furthermore, I'm not even sure what exactly the problem is (regarding the code).
>

If you're talking about the share emblem that appears on shared folders, that is
handled by nautilus-share. Specifically, nautilus-share tells nautilus to put
the share emblem on folders that have been listed in the output of `net
usershare info'.

--
Kind regards,
Loong Jin

Revision history for this message
masteryoda (hal66rr) wrote :
Revision history for this message
masteryoda (hal66rr) wrote :

Does anyone know where to find to code for nautilus-share?

We got a problem here: https://bugzilla.gnome.org/show_bug.cgi?id=675450#c13

Revision history for this message
Chow Loong Jin (hyperair) wrote :

On 11/05/2012 21:48, masteryoda wrote:
> Does anyone know where to find to code for nautilus-share?
>
> We got a problem here:
> https://bugzilla.gnome.org/show_bug.cgi?id=675450#c13
>

git clone git://git.gnome.org/nautilus-share

--
Kind regards,
Loong Jin

masteryoda (hal66rr)
Changed in nautilus-share (Debian):
importance: Undecided → Unknown
status: New → Unknown
importance: Unknown → Undecided
status: Unknown → New
status: New → Confirmed
Revision history for this message
frodo99 (openwork) wrote :

This bug still exists in Ubuntu 12.10 alpha 3 with Nautilus 3.5.5

Will it be fixed?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.