Order of attributes is inverted on each save

Bug #166716 reported by Bug Importer
0
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Mental-users

Bug Description

Inkscape-version 0.41
OS: MS Windows XP Pro, SP2
-------------------

When saving an SVG-file in Inkscape the order in the
file is different every time.
This makes it difficult to look at changelogs on a
SVN-file in a file revision system, since a lot of
lines has moved for no visible reason.

I tried to reproduce the case in two files (attached to
bug).
This is what I did.
1) created a SVG-file and saved it.
2) Closed inkscape and opened the file with double-click.
3) Moved the blue rectangle.
4) Saved the file and closed inkscape
5) Made a copy ("before move")
6) Opened the same file with double-click.
7) moved the blue rectangle i little bit.
8) Saved the file and closed inkscape
9) Made a copy ("after move")

then making a diff between "before move" and "after
move" reveals that lots of rows has been swapped.

----- Example from "before move" ----
   sodipodi:docname="test.svg"
   sodipodi:docbase="C:\DOCUME~1\Albin\Desktop"
   inkscape:version="0.40+cvs"
   sodipodi:version="0.32"
   id="svg2"
   height="297mm"
   width="210mm">
---------------
----- The same example from "after move" ----
   width="210mm"
   height="297mm"
   id="svg2"
   sodipodi:version="0.32"
   inkscape:version="0.40+cvs"
   sodipodi:docbase="C:\DOCUME~1\Albin\Desktop"
   sodipodi:docname="test.svg">
---------------

// Albin Sunnanbo (albin [at] sunnanbo [dot] com )

Tags: saving win32
Revision history for this message
Bug Importer (bug-importer) wrote :
Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

In XML, the order of attributes is not significant, so
strictly speaking it's not a bug. But it's still interesting
to find out why this happens, and fix if possible. Maybe
attributes are added by prepend when read but written via a
forward loop, hence the order is inversed.

Revision history for this message
Albinsunnanbo (albinsunnanbo) wrote :

I can not figure out how to attach my other file, but I
suppose that the example above is suficcient to phenomena.

I looked through the rest of my diff and it looks like it's
always a strict inversion of the order of the attributes.

To further support the idéa of inversion I repeated streps
(6) through (8) and copied the file to "third.svg".
Now when I diff "before move" against "third" all attributes
are back "in order" and only the "x" and "y" attributes of
the <rect> and the inkscape:cy attribute of
<sodipodi:namedview> has changed.

Revision history for this message
Mental-users (mental-users) wrote :

Attaching a patch which should remedy the attribute order
reversal.

Revision history for this message
Mental-users (mental-users) wrote :

Please test.

Revision history for this message
Kees Cook (kees) wrote :

Looks/acts fine for me. Committed.

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.