Don't use FileUtils.set_contents()

Bug #1021860 reported by Sergey "Shnatsel" Davidoff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Feedler
Fix Committed
Low
Marcus Lundgren
Footnote
Fix Committed
Undecided
Marcus Lundgren
Maya
Fix Released
Undecided
Marcus Lundgren
Midori Web Browser
Invalid
Undecided
Unassigned
Scratch
Fix Released
Undecided
Unassigned

Bug Description

Do not use FileUtils.set_contents() also known as g_file_set_contents() for overwriting files, because it resets file permissions to default permissive policy and can potentially expose files that were made private. Its behavior of creating a new file and substituting the old one with it also makes the older file impossible to shred and makes automated data recovery harder on many filesystems.
GIO function document.file.replace_contents() should be used instead.

See http://valadoc.org/#!api=gio-2.0/GLib.File.replace_contents for documentation. There's also replace_contents_async() which can be useful.
An example of transitioning code to that function can be found in http://bazaar.launchpad.net/~elementary-apps/scratch/scratch/revision/782 in Tab.Vala

I'm marking all projects in which I've grepped either form of this function as affected.

Related branches

Changed in scratch:
status: New → Fix Committed
description: updated
Changed in scratch:
milestone: none → luna-beta1
Changed in maya:
milestone: none → 0.1-luna-beta1
description: updated
Changed in maya:
assignee: nobody → Marcus Lundgren (marcus-lundgren)
status: New → In Progress
Changed in feedler:
assignee: nobody → Marcus Lundgren (marcus-lundgren)
status: New → In Progress
Changed in footnote:
assignee: nobody → Marcus Lundgren (marcus-lundgren)
status: New → In Progress
Changed in maya:
status: In Progress → Fix Committed
Changed in scratch:
status: Fix Committed → Fix Released
Changed in maya:
status: Fix Committed → Fix Released
Changed in footnote:
status: In Progress → Fix Committed
Cris Dywan (kalikiana)
Changed in midori:
status: New → Fix Committed
status: Fix Committed → Invalid
Changed in feedler:
status: In Progress → Fix Committed
Changed in feedler:
importance: Undecided → Low
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.