From c3ad1e313f1130d857135acb4e54a99d980742c5 Mon Sep 17 00:00:00 2001
From: Anthony Mallet <anthony.mallet@laas.fr>
Date: Wed, 6 May 2015 11:36:28 +0200
Subject: [PATCH] [wip/genom3-ros] Workaround a (complex) bug in tcl-8.6.0

Bump PKGREVISION
---
 genom3-ros/Makefile         |  1 +
 genom3-ros/distinfo         |  1 +
 genom3-ros/patches/patch-aa | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 genom3-ros/patches/patch-aa

diff --git a/genom3-ros/Makefile b/genom3-ros/Makefile
index 2db62d0e..73ddaa6d 100644
--- a/genom3-ros/Makefile
+++ b/genom3-ros/Makefile
@@ -2,6 +2,7 @@
 # Created:			Anthony Mallet on Fri, 19 Oct 2012
 #
 
+PKGREVISION=	1
 DISTNAME=	genom3-ros-1.10
 CATEGORIES=	architecture
 MASTER_SITES=	${MASTER_SITE_OPENROBOTS:=genom3-ros/}
diff --git a/genom3-ros/distinfo b/genom3-ros/distinfo
index bb689a46..2cee4a8f 100644
--- a/genom3-ros/distinfo
+++ b/genom3-ros/distinfo
@@ -1,3 +1,4 @@
 SHA1 (genom3-ros-1.10.tar.gz) = 413014351c46f50d57b4c859d4ff0c3300d1c404
 RMD160 (genom3-ros-1.10.tar.gz) = 0cc9eaf2bfb449d9be9e7657a202af65160c857d
 Size (genom3-ros-1.10.tar.gz) = 390003 bytes
+SHA1 (patch-aa) = 85cae81cae4dcda2f42c971561498522a3dba456
diff --git a/genom3-ros/patches/patch-aa b/genom3-ros/patches/patch-aa
new file mode 100644
index 00000000..010c0ad6
--- /dev/null
+++ b/genom3-ros/patches/patch-aa
@@ -0,0 +1,33 @@
+From 8c2c0b2061a04a8d2e2dbb279e44a60828ba881a Mon Sep 17 00:00:00 2001
+From: Anthony Mallet <anthony.mallet@laas.fr>
+Date: Wed, 6 May 2015 11:14:11 +0200
+Subject: [PATCH] Workaround a strange bug in tcl-8.6.0
+
+It looks like using expr { int([$object proc]) } in the context of a genom
+template triggers a bug (NULL pointer dereference) when tcl tries to get the
+current line number (requested by the genom template parser).
+
+It happens that using the equvalent tcl::mathfunc::int procedure does not
+trigger this issue, so use that instead.
+---
+ server/control-task.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git server/control-task.cc server/control-task.cc
+index 22b36e4..94e057b 100644
+--- server/control-task.cc
++++ server/control-task.cc
+@@ -272,9 +272,9 @@ genom_component_data::timercb(const ros::TimerEvent &e)
+ <'  foreach task [$component tasks] {'>
+ <'    if {![catch {$task period} period]} {'>
+ <'
+-      set ticks [expr {int([$period value]/[$rate value])}]
++      set ticks [tcl::mathfunc::int [expr {[$period value]/[$rate value]}]]
+       if {![catch {$task delay} delay]} {
+-        set d [expr {int([$delay value]/[$rate value])}]
++        set d [tcl::mathfunc::int [expr {[$delay value]/[$rate value]}]]
+       } else {
+         set d 0
+       }
+-- 
+1.9.1
-- 
GitLab