config file mode always changed to 0600

Bug #519455 reported by Geoff Gardiner
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Low
OpenERP's Framework R&D

Bug Description

When you change the config file, say if you change the password, then it gets re-written with a new mode of 0600.

This is Ok if you have no file to begin with, but if you already have a file you want to keep it in the mode that it already has (in my case 640).

Regards, Geoff

Related branches

Revision history for this message
Geoff Gardiner (geoff-gardiner) wrote :

This is for revno 1966, but has probably been in existence for a long time.

Revision history for this message
marc0s (marc0s) wrote :

Just hoped on this bug report and I'm proposing a patch for fixing it.

It's my first patch, so comments are more than welcome :)

Revision history for this message
marc0s (marc0s) wrote :

I'm pasting the patch here because Launchpad refuses to accept an attachment...

=== modified file 'bin/tools/config.py'
--- bin/tools/config.py 2010-03-15 12:27:55 +0000
+++ bin/tools/config.py 2010-03-17 21:41:09 +0000
@@ -380,8 +380,11 @@
             if not os.path.exists(os.path.dirname(self.rcfile)):
                 os.makedirs(os.path.dirname(self.rcfile))
             try:
+ perms = 0600
+ if os.path.exists(self.rcfile): # preserve file permissions if file already exists
+ perms = os.stat(self.rcfile).st_mode
                 p.write(file(self.rcfile, 'w'))
- os.chmod(self.rcfile, 0600)
+ os.chmod(self.rcfile, perms)
             except IOError:
                 sys.stderr.write("ERROR: couldn't write the config file\n")

Revision history for this message
marc0s (marc0s) wrote :

I'm now sending the patch as an attachment

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Fix landed in rev 2993 <email address hidden>

Thanks for reporting!

Changed in openobject-server:
milestone: none → 6.0-rc2
status: Confirmed → Fix Released
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.