UUIDTool and weird timestamp split error


#1

Hi,

I am using UUIDTools to generate my Guids. It works fine on my computer
(Windows Xp), but doesn’t work on my host (TextDrive)

The error is:

Loading production environment.

UUID.timestamp_create.to_s
/sbin/ifconfig: Permission denied
NoMethodError: private method split' called for nil:NilClass from ./script/../config/../config/../lib/uuidtools.rb:236:intimestamp_create’
from ./script/…/config/…/config/…/lib/uuidtools.rb:226:in
synchronize' from ./script/../config/../config/../lib/uuidtools.rb:226:intimestamp_create’
from (irb):8

Any ideas what this could be? I am using ver 1.0 of UUIDtools.

Any help would be a life saver
Joerg


#2

Hi-

I’m completely new to rails - and ruby for that matter - but your
problem seems to be that UUIDTools try getting the MAC Address of
your network card by calling the program /sbin/ifconfig , which the user
rails runs under cannot execute.
Some soultions:

  • Convince your provider to give oyur rails user execute permission on
    /sbin/ifconfig
  • install ifconfig for your rails user (you might also have to convince
    the UUID code to use your local copy of ifconfig instad)
  • convince the maintainer of the UUIDTools to implement another way to
    retrieve the MAC address
  • overwrite UUID.get_mac_address to return teh mac adress from a config
    file instead of actually getting it from the network card

HTH,
-markus


#3

Cool. Just found another way … you can use UUID.random_create to get a
Guid … doesn’t use the MAC address.

Markus Strickler wrote:

Hi-

I’m completely new to rails - and ruby for that matter - but your
problem seems to be that UUIDTools try getting the MAC Address of
your network card by calling the program /sbin/ifconfig , which the user
rails runs under cannot execute.
Some soultions:

  • Convince your provider to give oyur rails user execute permission on
    /sbin/ifconfig
  • install ifconfig for your rails user (you might also have to convince
    the UUID code to use your local copy of ifconfig instad)
  • convince the maintainer of the UUIDTools to implement another way to
    retrieve the MAC address
  • overwrite UUID.get_mac_address to return teh mac adress from a config
    file instead of actually getting it from the network card

HTH,
-markus


#4

Joerg D. wrote:

Cool. Just found another way … you can use UUID.random_create to get a
Guid … doesn’t use the MAC address.

Doesn’t that defeat the purpose? I thought the only way you could
guarantee
that an ID was truly unique was to include another unique ID, e.g. the
MAC
address, CPU ID, or some other hardware serial number.

A random ID, even combined with date/time, could still theoretically
collide
(e.g. if two machines happened to pick the same random value at the same
time).

– Steve


#5

Steve S. wrote:

A random ID, even combined with date/time, could still theoretically
collide (e.g. if two machines happened to pick the same random value
at the same time).

To have a ~50% chance of a collision, you must generate ~2^64 random
128-bit numbers. Considering the small subset of those 2^64 that will
actually be generated, the chance of duplicates happening randomly can
be ignored — and its far less than the chance of either bugs in the
implementation or even duplicate MAC addresses accidentally being
assigned.