Edgewall Software

Ticket #6604: file-creation-mode-0666.patch

File file-creation-mode-0666.patch, 1.0 KB (added by Remy Blank <remy.blank@…>, 4 months ago)

Patch against 0.11-stable [7346] setting mode of created files to 0666 instead of 0777

  • trac/admin/web_ui.py

    diff --git a/trac/admin/web_ui.py b/trac/admin/web_ui.py
    a b  
    429429        except AttributeError: 
    430430            # OS_BINARY not available on every platform 
    431431            pass 
    432         target_file = os.fdopen(os.open(target_path, flags), 'w') 
     432        target_file = os.fdopen(os.open(target_path, flags, 0666), 'w') 
    433433        try: 
    434434            shutil.copyfileobj(upload.file, target_file) 
    435435            self.log.info('Plugin %s installed to %s', plugin_filename, 
  • trac/util/__init__.py

    diff --git a/trac/util/__init__.py b/trac/util/__init__.py
    a b  
    7777            flags = os.O_CREAT + os.O_WRONLY + os.O_EXCL 
    7878            if hasattr(os, 'O_BINARY'): 
    7979                flags += os.O_BINARY 
    80             return path, os.fdopen(os.open(path, flags), 'w') 
     80            return path, os.fdopen(os.open(path, flags, 0666), 'w') 
    8181        except OSError: 
    8282            idx += 1 
    8383            # A sanity check