avtobiff / erlang-uuid Goto Github PK
View Code? Open in Web Editor NEWErlang UUID
Home Page: https://github.com/avtobiff/erlang-uuid
License: GNU Lesser General Public License v3.0
Erlang UUID
Home Page: https://github.com/avtobiff/erlang-uuid
License: GNU Lesser General Public License v3.0
17:19:00.019 [info] Application lager started on node nonode@nohost
17:19:00.020 [info] Distributed Erlang is not enabled, generating UUID.
17:19:00.022 [info] Generated UUID: <<158,154,190,66,38,226,17,232,155,216,0,0,0,0>>, converting to string.
17:19:00.022 [error] CRASH REPORT Process <0.1006.0> with 0 neighbours exited with reason: bad argument in uuid:to_string/1 line 238
17:19:00.023 [error] CRASH REPORT Process <0.1004.0> with 0 neighbours exited with reason: {{error,{badarg,[{uuid,to_string,1,[{file,"/tmp/exlam/deps/uuid/src/uuid.erl"},{line,238}]},
This is Amazon Linux.
Now, when I generate identifiers locally, with the same version of Erlang, I'm getting 16 byte identifiers. But, when I run it here, as you can see from the binary above, it's only 14 bytes. This is causing the uuid:to_string
method to throw, because it doesn't match at line 238. Any thoughts on why this would happen on a particular variant of Linux?
I'm using uuid4()
.
I think this package needs comparison functions something like
compare(uuid1,uuid2)->boolean()
or
larger_than(uuid1,uuid2)->boolean() something that can be given to utilities like
lists:sort
I think it can be useful specifically for time based uuids.
p src/uuid.app.src ebin/uuid.app
erl -make
{"init terminating in do_boot",{undef,[{make,all,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
Makefile:17: recipe for target 'build' failed
make: *** [build] Error 1
Is there something i'm missing?
When installing with 'make install' on OSX Mavericks, the install fails due to the appfile version number substitution.
sh-3.2# make install
erl -make
create dist directory and install files
mkdir -p /usr/lib/erlang/lib/uuid- {vsn, "0.4.4"},/ebin
install -m0644 ebin/* /usr/lib/erlang/lib/uuid- {vsn, "0.4.4"},/ebin
install: /usr/lib/erlang/lib/uuid-: Inappropriate file type or format
make: *** [install] Error 71
sh-3.2#
Is it possible to get this as an hex package?
I like this library but we want to publish a hex package, and hex is only supporting publishing of package if all deps is in hex.
If I take a UUIDv1 generated with uuidgen -t
and then take one generated by this library (less than a second later on the same machine, with uuid:to_string(uuid:uuid1())
), the timestamp is wrong in the erlang-uuid version: '2012-12-07 05:27:59+0000' (uuidgen) vs. '1935-10-13 20:22:43+0000' (erlang-uuid). (I am parsing these by way of inserting them as columns into Cassandra, which sorts TimeUUID columns by their associated timestamp and displays them with their time value, not their UUID value, when selecting data at the cqlsh console.)
Howdy, I've got two patches stored in my local git repository.
One corrects the directory hierarchy to move the include file into an include directory.
The other one fixes the case where a system has devices with hardware addresses that are zero or consist of other than six octets. Linux sit devices, for example, default to four bytes of zeros.
I can't create a text patch for the directory layout change, but the byte problem is included below.
If you want the direct (teste) push of both I need permissions.
src/uuid.erl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/uuid.erl b/src/uuid.erl
index 38a27c2..ecb7a66 100644
--- a/src/uuid.erl
+++ b/src/uuid.erl
@@ -318,8 +318,12 @@ hwaddr_find([{"lo", _IfConfig}|Rest]) ->
hwaddr_find(Rest);
hwaddr_find([{_IfName, IfConfig}|Rest]) ->
case lists:keyfind(hwaddr, 1, IfConfig) of
- {hwaddr, HwAddr} ->
+ {hwaddr, [0,0,0,0,0,0] = _HwAddr} ->
+ hwaddr_find(Rest);
+ {hwaddr, HwAddr} when length(HwAddr) == 6 ->
list_to_binary(HwAddr);
+ {hwaddr, _HwAddr} ->
+ hwaddr_find(Rest);
false ->
hwaddr_find(Rest)
end;
--
2.22.0
The same line:
uuid:to_string(uuid:uuid1()))
Fails in Erlang 19.3, but works in 20. In 19.3 it bombs with the error:
Failure/Error: {error,badarg,
[{uuid,to_string,1,
[{file,
"/tmp/_build/default/lib/uuid/src/uuid.erl"},
{line,238}]},
However,
uuid:to_string(uuid:uuid4())
works in both. I'm not an expert in Erlang, HOWEVER my guess is it has something to do with os.timestamp
here: https://github.com/avtobiff/erlang-uuid/blob/master/src/uuid.erl#L101
This is just a guess of where the problem is because I recall that Erlang changed the behavior of this at some point.
sed: 1: "/vsn/ {s/.*,\s*"\([0-9] ...": extra characters at the end of p command
when building on OSX
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.