Package: task
Version: 1.9.0-1
Severity: normal
Tags: upstream patch

Task uses uuids to identify tasks. However these uuids are not
conforming to rfc4122.

Steps to reproduce:
Create a task and look at .task/pending.data.
With probability around 98% the generated uuid is invalid.

There are basically two methods to solve this problem:

1) Link against libuuid. Task has support for this, however the Debian
   package does not do this.

2) Fix tasks own implementation for generating uuids. A patch for this
   is attached.

The upstream bugreport can be found at
http://taskwarrior.org/issues/show/394.

As a maintainer reading this, could you link this bug report to the
upstream bug report?

Thanks

Helmut
>From 54495557addff37ff52df7edc3ff4d30e1182571 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <hel...@subdivi.de>
Date: Mon, 8 Mar 2010 17:37:20 +0100
Subject: [PATCH] emit rfc4122 (version 4) conforming uuids

This only applies when not linking against libuuid.
---
 src/util.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/util.cpp b/src/util.cpp
index a10e928..9012ae6 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -313,12 +313,19 @@ const std::string uuid ()
   id[11] = randomHexDigit ();
   id[12] = randomHexDigit ();
   id[13] = '-';
-  id[14] = randomHexDigit ();
+  id[14] = '4';
   id[15] = randomHexDigit ();
   id[16] = randomHexDigit ();
   id[17] = randomHexDigit ();
   id[18] = '-';
   id[19] = randomHexDigit ();
+  switch(id[19])
+  {
+    case '0': case '4': case '8': case 'c': id[19] = '8'; break;
+    case '1': case '5': case '9': case 'd': id[19] = '9'; break;
+    case '2': case '6': case 'a': case 'e': id[19] = 'a'; break;
+    case '3': case '7': case 'b': case 'f': id[19] = 'b'; break;
+  }
   id[20] = randomHexDigit ();
   id[21] = randomHexDigit ();
   id[22] = randomHexDigit ();
-- 
1.6.6.1

Reply via email to