Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Oct 2001 07:35:03 -0700 (PDT)
From:      Alan Eldridge <alane@geeksrus.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/31508: Coding error in py-4suite: Ft/Lib/Uuid.py throws away half of generated UUID
Message-ID:  <200110261435.f9QEZ3699367@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         31508
>Category:       ports
>Synopsis:       Coding error in py-4suite: Ft/Lib/Uuid.py throws away half of generated UUID
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 26 07:40:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Alan Eldridge
>Release:        4.4-RELEASE
>Organization:
>Environment:
FreeBSD wwweasel.geeksrus.net 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Mon Oct 22 16:59:49 EDT 2001     root@wwweasel.geeksrus.net:/usr/src/sys/compile/WWWEASEL  i386
>Description:
There's a typo (?) in Ft.Lib.Uuid.UuidAsString(uuid), where a loop to convert an integer to a string of bytes is only picking up the lower 4 bits of each byte.

This results in half of the bits of the UUID being thrown away in the conversion to string.

I have not yet checked, but this is probably fixed in the newest version of the the 4suite code.
>How-To-Repeat:
[alane@wwweasel ~/sw/ftom/linkman]$ python
Python 2.1.1 (#1, Sep 13 2001, 18:12:15)
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "copyright", "credits" or "license" for more information.
>Fix:
Make this fix (changing 0xF to 0xFF).

[alane@wwweasel ~/sw/ftom/linkman]$ diff -u Uuid.py.or Uuid.py
--- Uuid.py.or  Sun Dec  3 05:52:27 2000
+++ Uuid.py     Fri Oct 26 10:27:41 2001
@@ -64,7 +64,7 @@
     newUuid = ''
     curUuid = uuid
     for ctr in range(16):
-        num = int(curUuid & 0xF)
+        num = int(curUuid & 0xFF)
         newChar = chr(num)
         curUuid = curUuid >> 8
         newUuid = newChar + newUuid
[alane@wwweasel ~/sw/ftom/linkman]$

>Release-Note:
>Audit-Trail:
>Unformatted:
 >>> import Uuid
 >>> u = Uuid.GenerateUuid()
 >>> u
 293274167793379733969387239632193121121L
 >>> hex(u)
 '0xDCA28CD7BC1B44DDB23830439C76EB61L'
 >>> Uuid.UuidAsString(u)
 'c020c07-c0b-40d-208-30c06b01'
 >>>
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110261435.f9QEZ3699367>