After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 598206 - Nautilus cannot write to shared Vista/Win7 folders with read-only attribute set
Nautilus cannot write to shared Vista/Win7 folders with read-only attribute set
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: smb backend
1.4.x
Other Linux
: Normal major
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2009-10-12 20:46 UTC by NTolerance
Modified: 2011-09-08 14:33 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
resolve the wrong write permissions on readonly-smb-directories (666 bytes, patch)
2011-09-08 08:42 UTC, Andreas Heik
committed Details | Review

Description NTolerance 2009-10-12 20:46:53 UTC
Expectation: To be able to share a folder on a Vista/Win7 PC and have full read/write access to that folder from a Ubuntu PC via the Nautilus file manager.

Actual result: Nautilus cannot gain write access to shared Vista/Win7 folders that contain a desktop.ini file.

Steps to reproduce:

1. Right-click a newly created folder on a Vista/Win7 PC and select "Share with".
2. Use the following dialog to grant network users write access to the folder. At this stage the folder is empty and Nautilus can successfully write to the folder.
3. Right-click the same Vista/Win7 folder and navigate to the "Customize" tab.
4. From the "Optimize this folder..." drop-down menu pick any of the available options. This will add a Windows system file called "desktop.ini" to the folder.
5. Go to a Ubuntu 9.04 PC and browse to the Vista/Win7 PC using the "Network" option in the "Places" menu in Nautilus.
6. Double-click the Vista/Win7 folder you shared to mount it.
7. Attempt to create a new folder or file within the shared folder. Access will be denied.

Interesting notes:

If you go to the ~/.gvfs path via command line and browse to the same mounted network share you will have write access via command line.

This same issue occurs with the smb4k program in KDE4, but not the built-in Samba server browser in Konqueror.

Newly-created shared folders on a Vista/Win7 PC that do not contain a desktop.ini file can be successfully written to with Nautilus.

ProblemType: Bug
Architecture: amd64
DistroRelease: Ubuntu 9.04
ExecutablePath: /usr/bin/nautilus
Package: nautilus 1:2.26.2-0ubuntu2
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: nautilus
Uname: Linux 2.6.28-15-generic x86_64

Tested on Ubuntu 9.04 and 9.10 beta.  Link to Ubuntu Launchpad bug report:

https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/447695
Comment 1 NTolerance 2009-10-12 21:01:03 UTC
I'd like to clarify step #3.  It should read:

3.  Right-click the same Vista/Win7 folder, select "Properties", and navigate to the "Customize" tab.
Comment 2 NTolerance 2009-11-02 19:37:31 UTC
After further investigation, it seems that the existence of desktop.ini is not the root cause.  When a desktop.ini file is created after Windows folder customization, the folder in question is also given the read-only attribute by Windows.  Windows and its applications generally ignore this flag, yet Nautilus honors it and disallows write access.  

Here's a Microsoft document which describes this behavior:

http://support.microsoft.com/kb/326549/

The attrib -r command can be used to disable the read-only flag and write to the folders, but then the folder customization settings are lost, so the issue is ongoing.
Comment 3 Cosimo Cecchi 2009-11-03 00:54:20 UTC
-> gvfs-smb

It's probably the smb backend or the smb library itself to honor the setting here, not Nautilus. Maybe we should really ignore it, as Windows intentionally ignores it as well.
Comment 4 NTolerance 2009-11-03 03:05:10 UTC
Thanks for the info and for moving this bug to the proper place Cosimo.  And I agree; regardless of how strange it is for Windows to set meaningless read-only flags, it would be great if we could ignore those flags and allow these folders to be fully accessed.
Comment 5 Andreas Heik 2011-09-08 08:41:17 UTC
I have the same problem with some directories in shared smb-homes on a NetApp filer by accessing via gvfs-smb.
The directories has all the same features, the DOS attrib +R (read only).

I think, the global setting of ACCESS_WRITE = FALSE for any items with !S_IWUSR in the function set_info_from_stat() in gvfsbackendsmb.c is wrong.
After additional checking for regular files shows nautilus this directories not as readonly and i can copy and touch anything into it.
But i can't delete this directories.

I append my patch.
Comment 6 Andreas Heik 2011-09-08 08:42:50 UTC
Created attachment 195966 [details] [review]
resolve the wrong write permissions on readonly-smb-directories
Comment 7 Tomas Bzatek 2011-09-08 14:33:31 UTC
Fair enough, thanks for finding this out. Further access denials caused by readonly attributes will be handled by respective operations anyway.

commit f07c7d98975809785dc28ad0944e0d9fd70624c1
Author: Andreas Heik <andreas.heik@hrz.tu-chemnitz.de>
Date:   Thu Sep 8 16:26:03 2011 +0200

    smb: Ignore read-only attribute for directories
    
    According to Microsoft Knowledge Base article the read-only attribute
    on a folder is being usually ignored by the system and applications.
    Let's ignore it in gvfs to avoid compatibility issues.
    http://support.microsoft.com/kb/326549/
    
    https://bugzilla.gnome.org/show_bug.cgi?id=598206