- Fixed a bug that caused a commond dateformat (YDM-HN) to be misinterpreted
  as a UUID.  Solution is to increase minimum partial UUID length from 9 to
  14.
This commit is contained in:
Paul Beckingham 2012-07-17 18:30:58 -04:00
parent 561102b70b
commit c20c025c8e
4 changed files with 22 additions and 25 deletions

2
NEWS
View file

@ -9,6 +9,8 @@ New Features in taskwarrior 2.1.0
and are deleted. and are deleted.
- Improved UTF8 handling for wide characters. - Improved UTF8 handling for wide characters.
- User defined attributes. - User defined attributes.
- Partial UUIDs must now be at least 14 characters, up from 9. This
disambiguates a commonly date format.
Please refer to the ChangeLog file for full details. There are too many to Please refer to the ChangeLog file for full details. There are too many to
list here. list here.

View file

@ -41,7 +41,7 @@
#include <util.h> #include <util.h>
static const char* _uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; static const char* _uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
static const unsigned int _uuid_min_length = 9; static const unsigned int _uuid_min_length = 14;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Nibbler::Nibbler () Nibbler::Nibbler ()

View file

@ -137,23 +137,23 @@ like ($output, qr/one/, "Found with $short");
($short) = $uuid =~ /^(.{13})/; ($short) = $uuid =~ /^(.{13})/;
$output = qx{../src/task rc:bug.rc $short list 2>&1}; $output = qx{../src/task rc:bug.rc $short list 2>&1};
like ($output, qr/one/, "Found with $short"); unlike ($output, qr/one/, "Not found with $short");
($short) = $uuid =~ /^(.{12})/; ($short) = $uuid =~ /^(.{12})/;
$output = qx{../src/task rc:bug.rc $short list 2>&1}; $output = qx{../src/task rc:bug.rc $short list 2>&1};
like ($output, qr/one/, "Found with $short"); unlike ($output, qr/one/, "Not found with $short");
($short) = $uuid =~ /^(.{11})/; ($short) = $uuid =~ /^(.{11})/;
$output = qx{../src/task rc:bug.rc $short list 2>&1}; $output = qx{../src/task rc:bug.rc $short list 2>&1};
like ($output, qr/one/, "Found with $short"); unlike ($output, qr/one/, "Not found with $short");
($short) = $uuid =~ /^(.{10})/; ($short) = $uuid =~ /^(.{10})/;
$output = qx{../src/task rc:bug.rc $short list 2>&1}; $output = qx{../src/task rc:bug.rc $short list 2>&1};
like ($output, qr/one/, "Found with $short"); unlike ($output, qr/one/, "Not found with $short");
($short) = $uuid =~ /^(.{9})/; ($short) = $uuid =~ /^(.{9})/;
$output = qx{../src/task rc:bug.rc $short list 2>&1}; $output = qx{../src/task rc:bug.rc $short list 2>&1};
like ($output, qr/one/, "Found with $short"); unlike ($output, qr/one/, "Not found with $short");
($short) = $uuid =~ /^(.{8})/; ($short) = $uuid =~ /^(.{8})/;
$output = qx{../src/task rc:bug.rc $short list 2>&1}; $output = qx{../src/task rc:bug.rc $short list 2>&1};

View file

@ -39,15 +39,15 @@ int main (int argc, char** argv)
{ {
#ifdef NIBBLER_FEATURE_DATE #ifdef NIBBLER_FEATURE_DATE
#ifdef NIBBLER_FEATURE_REGEX #ifdef NIBBLER_FEATURE_REGEX
UnitTest t (387); UnitTest t (382);
#else #else
UnitTest t (363); UnitTest t (358);
#endif #endif
#else #else
#ifdef NIBBLER_FEATURE_REGEX #ifdef NIBBLER_FEATURE_REGEX
UnitTest t (337); UnitTest t (332);
#else #else
UnitTest t (313); UnitTest t (308);
#endif #endif
#endif #endif
@ -465,29 +465,24 @@ int main (int argc, char** argv)
t.ok (n.depleted (), "depleted"); t.ok (n.depleted (), "depleted");
n = Nibbler ("a0b1c2d3-e4f5"); n = Nibbler ("a0b1c2d3-e4f5");
t.ok (n.getPartialUUID (s), "partial uuid [13] found"); t.notok (n.getPartialUUID (s), "partial uuid [13] not found");
t.is (s, "a0b1c2d3-e4f5", "partial uuid [13] -> correct"); t.notok (n.depleted (), "depleted");
t.ok (n.depleted (), "depleted");
n = Nibbler ("a0b1c2d3-e4f"); n = Nibbler ("a0b1c2d3-e4f");
t.ok (n.getPartialUUID (s), "partial uuid [12] found"); t.notok (n.getPartialUUID (s), "partial uuid [12] not found");
t.is (s, "a0b1c2d3-e4f", "partial uuid [12] -> correct"); t.notok (n.depleted (), "depleted");
t.ok (n.depleted (), "depleted");
n = Nibbler ("a0b1c2d3-e4"); n = Nibbler ("a0b1c2d3-e4");
t.ok (n.getPartialUUID (s), "partial uuid [11] found"); t.notok (n.getPartialUUID (s), "partial uuid [11] not found");
t.is (s, "a0b1c2d3-e4", "partial uuid [11] -> correct"); t.notok (n.depleted (), "depleted");
t.ok (n.depleted (), "depleted");
n = Nibbler ("a0b1c2d3-e"); n = Nibbler ("a0b1c2d3-e");
t.ok (n.getPartialUUID (s), "partial uuid [10] found"); t.notok (n.getPartialUUID (s), "partial uuid [10] not found");
t.is (s, "a0b1c2d3-e", "partial uuid [10] -> correct"); t.notok (n.depleted (), "depleted");
t.ok (n.depleted (), "depleted");
n = Nibbler ("a0b1c2d3-"); n = Nibbler ("a0b1c2d3-");
t.ok (n.getPartialUUID (s), "partial uuid [9] found"); t.notok (n.getPartialUUID (s), "partial uuid [9] not found");
t.is (s, "a0b1c2d3-", "partial uuid [9] -> correct"); t.notok (n.depleted (), "depleted");
t.ok (n.depleted (), "depleted");
n = Nibbler ("a0b1c2d3"); n = Nibbler ("a0b1c2d3");
t.notok (n.getPartialUUID (s), "partial uuid [8] not found"); t.notok (n.getPartialUUID (s), "partial uuid [8] not found");