PNG export writes directly to output filepath

Bug #1771321 reported by ChrisDone
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Undecided
Unassigned

Bug Description

I'm using this Inkscape version:

Inkscape 0.91+devel+osxmenu r12922, built Jun 16 2015, 09:24:00

However, I've looked at the source and confirmed it's on the latest 0.92.x branch.

Here is where the export process opens the filename:

https://git.launchpad.net/inkscape/tree/src/helper/png-write.cpp?h=0.92.x#n143

It finishes up writing here:

https://git.launchpad.net/inkscape/tree/src/helper/png-write.cpp?h=0.92.x#n293

This makes it impossible to use programs that e.g. watch for file modifications and refresh the image elsewhere when working with Inkscape. I'm making sprites in Inkscape for game dev, and I wrote a simple routine to refresh sprites when updated by Inkscape. But it always fails with "invalid PNG" because the file has not finished being written.

If instead, it did the usual "write to temp and then move" approach, then this would be possible:

1. Create a temporary file, write to that with the PNG writer.
2. Run an atomic rename()/mv on the temp file to the target filename.

Then external tools will see an atomic update.

If no one is opposed, I could contribute a patch for this.

Nathan Lee (nathan.lee)
tags: added: bug-migration
Changed in inkscape:
status: New → Invalid
Revision history for this message
Nathan Lee (nathan.lee) wrote :

Hi - thanks for reporting this bug, I've manually migrated it to Inkscape's new bug tracker on GitLab, and closed it here.

Note that inkscape development is currently focused on Inkscape 1.0alpha, though I imagine the relevant code will be similar/the same. If you're still interested in writing a patch, look forward to seeing you around :)

Disclaimer: I don't know if anyone is opposed

Please feel free to file new bugs about the issues you're seeing at
http://inkscape.org/report.

Moved to: https://gitlab.com/inkscape/inbox/issues/463
Closed by: https://gitlab.com/nathanal

Revision history for this message
Nathan Lee (nathan.lee) wrote :

Looks like there is some opposition (see issue)

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.