[Pkg-vala-maintainers] Bug#802528: valac: make the generated C files reproducible

Niko Tyni ntyni at debian.org
Tue Oct 20 19:53:43 UTC 2015


Package: valac
Version: 0.30.0-2
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: toolchain randomness
X-Debbugs-Cc: reproducible-builds at lists.alioth.debian.org

While working on the "reproducible builds" effort [1], we have noticed
that the gnome-clocks package doesn't build reproducibly because the
C files generated by valac vary between builds. A sample diff is

  --- a/src/timer.c
  +++ b/src/timer.c
  @@ -1277,8 +1277,8 @@ static void clocks_timer_face_clocks_clock_interface_init (ClocksClockIface * if
   static void clocks_timer_face_instance_init (ClocksTimerFace * self) {
          self->priv = CLOCKS_TIMER_FACE_GET_PRIVATE (self);
          self->priv->_state = CLOCKS_TIMER_FACE_STATE_STOPPED;
  -       g_type_ensure (CLOCKS_TYPE_ANALOG_FRAME);
          g_type_ensure (CLOCKS_TIMER_TYPE_COUNTDOWN_FRAME);
  +       g_type_ensure (CLOCKS_TYPE_ANALOG_FRAME);
          gtk_widget_init_template (GTK_WIDGET (self));
   }

The order of the two g_type_ensure() calls varies more or less randomly.
 
I've tracked this down to a HashSet data structure in Vala.GtkModule
that holds these classes in the C code generation phase. Changing that
to an ordered List type instead fixes the issue. Please consider the
attached patch.

While gnome-clocks seems to be the only affected package, I'm also seeing
this with gnome-contacts when I force regeneration of the C files there.
They are currently not rebuilt from their vala sources during the package
build (#802520).

I'm also attaching a minified test case for your convenience. The generated
t.c varies for me between the compilations with the current valac in sid
but not with a patched one.

[1] https://wiki.debian.org/ReproducibleBuilds
-- 
Niko Tyni   ntyni at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Preserve-order-of-current_required_app_classes-for-r.patch
Type: text/x-diff
Size: 1328 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vala-maintainers/attachments/20151020/14ed14c4/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: valac-reproducibility.tar.gz
Type: application/gzip
Size: 629 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vala-maintainers/attachments/20151020/14ed14c4/attachment.bin>


More information about the Pkg-vala-maintainers mailing list