Bug 579087 - Thunar creates directories with permission mode 0777
Summary: Thunar creates directories with permission mode 0777
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Thunar
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-02 14:53 UTC by Cong Ma
Modified: 2010-10-27 22:43 UTC (History)
4 users (show)

Fixed In Version: Thunar-1.0.2-3.fc13
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-05-04 06:09:38 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Removing the incorrect handling of umask in _thunar_vfs_io_jobs_mkdir() (611 bytes, patch)
2010-04-02 14:53 UTC, Cong Ma
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Xfce 3532 0 None None None Never

Description Cong Ma 2010-04-02 14:53:01 UTC
Created attachment 404192 [details]
Removing the incorrect handling of umask in _thunar_vfs_io_jobs_mkdir()

Description of problem:

The Thunar file manager creates new directories with permission 0777. This is surprising. It is almost certainly not what the user expects.


Version-Release number of selected component (if applicable):

Thunar-1.0.1-3.fc12.i686
Older versions may be affected too.

How reproducible:

Always.


Steps to Reproduce:

1. Start Thunar
2. "File" menu -> "Create Folder"
 

Actual results:

The new directory is created with permission mode 0777.


Expected results:

It should have done what mkdir(1) does, i.e. letting mkdir(2) modify the permission mode 0777 with the user's default umask, which is The Right Thing. The created directory's permission mode should be (0777 & ~umask).


Additional info:

I took a casual look at the code. It seems to me that the author created an interesting bug by abusing umask(2). Here is the relevant code snippet:
(in file Thunar-1.0.1/thunar-vfs/thunar-vfs-io-jobs.c, line 710)

      /* try to create the target directory */
      if (!_thunar_vfs_io_ops_mkdir (lp->data, 0777 & ~umask(0), THUNAR_VFS_IO_OPS_NONE, error))
        return FALSE;

I don't know what was in the coder's mind when he wrote this. Even if an empty umask is the desired thing, this call will only make the *second* run of _thunar_vfs_io_ops_mkdir() use the empty umask. In other words, this is just wrong.

I've created a patch to remove this insanity. I tested it on my own computer and it looked fine to me ;)

Comment 1 Kevin Fenzi 2010-04-13 23:05:11 UTC
Hum. I can't duplicate this here, nor have I seen any other reports. 

What is your umask set to? Is it something other than the default 022?

Comment 2 Cong Ma 2010-04-14 02:50:45 UTC
(In reply to comment #1)
> Hum. I can't duplicate this here, 

For each Thunar process (incl. daemonized), the first directory created will not be affected. This bug only affects the second and later directories created in Thunar.

> nor have I seen any other reports. 

XFCE userbase is too small in size compared with GNOME or KDE, and bugs take longer to get noticed...

> What is your umask set to? Is it something other than the default 022?    

No. It's 022.

Comment 3 Kevin Fenzi 2010-04-14 03:57:23 UTC
Oops. I am just blind... it was fixed upstream a while back, there just haven't been any Thunar releases since then. ;( 

See http://bugzilla.xfce.org/show_bug.cgi?id=3532

I'll look at applying the upstream patch here soon. 

Thanks for the report.

Comment 4 Cong Ma 2010-04-14 06:18:09 UTC
(In reply to comment #3)
> Oops. I am just blind... it was fixed upstream a while back, there just haven't
> been any Thunar releases since then. ;( 
> 
> See http://bugzilla.xfce.org/show_bug.cgi?id=3532
> 
> I'll look at applying the upstream patch here soon. 
> 
> Thanks for the report.    

Fine. I'm glad to know there's a upstream fix. Please ignore my patch and use the upstream one (http://git.xfce.org/xfce/thunar/commit/?id=eb58c6a6ba7f77c2c16016db064524df598ef421).

Heck, I even opened a bug report over there. Moving off to xfce.org and closing that one :p

Comment 5 Fedora Update System 2010-04-15 19:59:46 UTC
Thunar-1.0.1-6.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/Thunar-1.0.1-6.fc13

Comment 6 Fedora Update System 2010-04-15 20:57:37 UTC
Thunar-1.0.1-6.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/Thunar-1.0.1-6.fc12

Comment 7 Cong Ma 2010-04-16 07:19:15 UTC
Thanks for the update. It works ;)

Comment 8 Fedora Update System 2010-04-16 23:31:18 UTC
Thunar-1.0.1-6.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update Thunar'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/Thunar-1.0.1-6.fc13

Comment 9 Fedora Update System 2010-04-16 23:37:54 UTC
Thunar-1.0.1-6.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update Thunar'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/Thunar-1.0.1-6.fc12

Comment 10 Fedora Update System 2010-05-04 06:09:33 UTC
Thunar-1.0.1-6.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2010-10-17 18:14:39 UTC
Thunar-1.0.2-3.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/Thunar-1.0.2-3.fc13

Comment 12 addammo 2010-10-19 09:00:57 UTC
(In reply to comment #11)
> Thunar-1.0.2-3.fc13 has been submitted as an update for Fedora 13.
> https://admin.fedoraproject.org/updates/Thunar-1.0.2-3.fc13

Thunar 1.0.2-2.fc13 creates directories with umask 776

Comment 13 addammo 2010-10-19 09:03:47 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > Thunar-1.0.2-3.fc13 has been submitted as an update for Fedora 13.
> > https://admin.fedoraproject.org/updates/Thunar-1.0.2-3.fc13
> 
> Thunar 1.0.2-2.fc13 creates directories with umask 776

Sorry, Thunar 1.0.2-2.fc13 creates directories with umask 775

Comment 14 Kevin Fenzi 2010-10-19 16:01:22 UTC
Odd. 1.0.2 has the patch for this. 

I'll try and duplicate. What is your umask set to? You see this on every directory create after the first one?

Comment 15 addammo 2010-10-19 16:31:38 UTC
(In reply to comment #14)
> Odd. 1.0.2 has the patch for this. 
> 
> I'll try and duplicate. What is your umask set to? You see this on every
> directory create after the first one?

Umask command tell me: 0002. I don't know what it means.
I have created three directory from the top menu File and three directory from the right menu (with the mouse) and the command "ls -l" tell me:

drwxrwxr-x   2 francesco francesco   4096 19 ott 18:26 xxxxx
drwxrwxr-x   2 francesco francesco   4096 19 ott 18:26 xxxxx3
drwxrwxr-x   2 francesco francesco   4096 19 ott 18:26 xxxxx4
drwxrwxr-x   2 francesco francesco   4096 19 ott 18:26 yyyy3
drwxrwxr-x   2 francesco francesco   4096 19 ott 18:26 yyyyy1
drwxrwxr-x   2 francesco francesco   4096 19 ott 18:26 yyyyy2


My settings are Fedora 13 defaults.

Comment 16 Kevin Fenzi 2010-10-19 19:33:17 UTC
Thats correct when your umask is 0002. 

The default umask used to be 0022, but I guess it's not anymore. 

So, these permissions look ok to me, what issues are you seeing due to them?

Comment 17 addammo 2010-10-20 07:25:05 UTC
(In reply to comment #16)
> Thats correct when your umask is 0002. 
> 
> The default umask used to be 0022, but I guess it's not anymore. 
> 
> So, these permissions look ok to me, what issues are you seeing due to them?

Not any issue, i'm telling that that version of Thunar, 1.0.2-2.fc13, creates directoies with the right permission. I don't have changed the default umask into my Fedora 13 installation and tha patch proposed to solve the permission issue could be wrong for me. I only warned of possible error. I have no issues.

Comment 18 Fedora Update System 2010-10-27 22:43:02 UTC
Thunar-1.0.2-3.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.