New Upstream Release - erlang-uuid

Ready changes

Summary

Merged new upstream version: 0.5.2 (was: 0.4.6).

Resulting package

Built on 2022-05-16T16:28 (took 1m45s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases erlang-uuid

Lintian Result

Diff

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 0ce5f26..73ca4e9 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1,5 +1,8 @@
 Per Andersson <avtobiff@gmail.com>
 Bip Thelin <bip@kivra.com>
+Iivari Äikäs <iivari.aikas@gmail.com>
 Ryan Flynn <parseerror@gmail.com>
 William Cummings <wcummings22@gmail.com>
 Gianni Gambetti <jex.pwns@gmail.com>
+Peter Hizalev <peter@kato.im>
+Jean Rouge <jer329@cornell.edu>
diff --git a/Makefile b/Makefile
index cc8fd14..e87680f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 APPFILE   := uuid.app
-VERSION   := $(shell sed -n -e '/vsn/ {s/.*,\s*"\([0-9][0-9.]*\)".*/\1/' \
+VERSION   := $(shell sed -n -e '/vsn/ {s/.*,[[:blank:]]*"\([0-9][0-9.]*\)".*/\1/' \
                             -e 'p' -e '}' src/$(APPFILE).src)
 
 PREFIX    ?= /usr
@@ -21,7 +21,7 @@ ebin/$(APPFILE): src/$(APPFILE).src
 	cp $< $@
 
 clean:
-	-rm -rf ebin/$(APPFILE) $(BEAMFILES) $(DIALYZER_PLT)
+	-rm -rf dist ebin/$(APPFILE) $(BEAMFILES) $(DIALYZER_PLT)
 
 $(DIALYZER_PLT): build
 	dialyzer --add_to_plt -r ebin --output_plt $(DIALYZER_PLT)
@@ -33,6 +33,12 @@ test: build
 	erlc -W +debug_info +compressed +strip -o test/ test/*.erl
 	erl -noshell -pa ebin -pa test -eval "uuid_tests:test()" -eval "init:stop()"
 
+dist: build
+	# create dist tarball
+	mkdir -p dist/$(DISTDIR)/ebin
+	install -m0644 ebin/* dist/$(DISTDIR)/ebin
+	(cd dist ; tar zcf $(DISTDIR).tar.gz $(DISTDIR) )
+
 install: build
 	# create dist directory and install files
 	mkdir -p $(DESTDIR)$(ERL_ROOT)$(LIBDIR)/$(DISTDIR)/ebin
diff --git a/README b/README
index de39de6..5624cf2 100644
--- a/README
+++ b/README
@@ -11,11 +11,11 @@ UUID v5 return a UUID generated using SHA1 and a given name within a namespace.
 
 Source tracking available at
 
-    http://gitorious.org/avtobiff/erlang-uuid
+    http://github.com/avtobiff/erlang-uuid
 
 To clone the main developing repository invoke
 
-    git clone git://gitorious.org/avtobiff/erlang-uuid.git
+    git clone https://github.com/avtobiff/erlang-uuid.git
 
 
 
@@ -36,7 +36,7 @@ Install to different $ERL_ROOT ($PREFIX/lib/erlang) by setting PREFIX
 Include in your own project using Rebar. Add this to your rebar.config
 
     {uuid, ".*",
-     {git, "git://gitorious.org/avtobiff/erlang-uuid.git", "master"}}
+     {git, "https://github.com/avtobiff/erlang-uuid.git", "master"}}
 
 
 
diff --git a/debian/changelog b/debian/changelog
index 60bb04f..529f59b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+erlang-uuid (0.5.2-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Mon, 16 May 2022 16:26:37 -0000
+
 erlang-uuid (0.4.6-2) unstable; urgency=medium
 
   * Team upload.
diff --git a/src/uuid.app.src b/src/uuid.app.src
index f848909..f4984a1 100644
--- a/src/uuid.app.src
+++ b/src/uuid.app.src
@@ -1,6 +1,6 @@
 {application, uuid,
  [{description, "Erlang UUID"},
-  {vsn, "0.4.6"},
+  {vsn, "0.5.2"},
   {modules, [uuid]},
   {registered, []},
   {applications, [stdlib, crypto]},
diff --git a/src/uuid.erl b/src/uuid.erl
index b46aabf..38a27c2 100644
--- a/src/uuid.erl
+++ b/src/uuid.erl
@@ -1,5 +1,5 @@
 %% -----------------------------------------------------------------------------
-%% Copyright © 2010-2013 Per Andersson
+%% Copyright © 2010-2018 Per Andersson
 %%
 %% Erlang UUID is free software: you can redistribute it and/or modify
 %% it under the terms of the GNU Lesser General Public License as
@@ -16,7 +16,14 @@
 %% <http://www.gnu.org/licenses/>.
 %% -----------------------------------------------------------------------------
 %% @author Per Andersson <avtobiff@gmail.com>
-%% @copyright 2010-2013 Per Andersson
+%% @copyright 2010-2018 Per Andersson
+%%            2012 Bip Thelin
+%%            2013 Ryan Flynn
+%%            2013 Iivari Äikäs
+%%            2013 William Cummings
+%%            2014 Gianni Gambetti
+%%            2015 Peter Hizalev
+%%            2017 Jean Rouge
 %% @doc
 %% Erlang UUID
 %%
@@ -98,7 +105,7 @@ uuid1_time() ->
     %% Transform unix epoch to 100 nanosecond intervals since 15 October 1582
     %% by adding offset to unix epoch and transforming microseconds epoch to
     %% nanoseconds.
-    {MegaSeconds, Seconds, MicroSeconds} = now(),
+    {MegaSeconds, Seconds, MicroSeconds} = os:timestamp(),
     UnixEpoch =
         (MegaSeconds * 1000000000000 + Seconds * 1000000 + MicroSeconds),
     Timestamp = ?nanosecond_intervals_offset +
@@ -109,8 +116,7 @@ uuid1_time() ->
 %% @doc Use ClockSeq if supplied otherwise Generate random clock sequence.
 -spec uuid1_clockseq(null | binary()) -> <<_:14>>.
 uuid1_clockseq(null) ->
-    random:seed(now_xor_pid()),
-    Rnd = random:uniform(2 bsl 14 - 1),
+    Rnd = random_uniform(now_xor_pid(), 2 bsl 14 - 1),
     <<Rnd:14>>;
 uuid1_clockseq(ClockSeqArg) ->
     <<_:14>> = ClockSeqArg. % make 14 bits wide
@@ -169,7 +175,7 @@ uuid4() ->
     % Set all other bits pseudo-randomly chosen values
     % (as generated by caller).
 
-    <<U0:32, U1:16, _:4, U2:12, _:2, U3:30, U4:32>> = crypto:rand_bytes(16),
+    <<U0:32, U1:16, _:4, U2:12, _:2, U3:30, U4:32>> = crypto:strong_rand_bytes(16),
 
     <<U0:32, U1:16, ?UUIDv4:4, U2:12, ?VARIANT10:2, U3:30, U4:32>>.
 
@@ -326,7 +332,7 @@ hwaddr_find(_) ->
 -spec hwaddr_random() -> binary().
 hwaddr_random() ->
     %% No interface, create random 48-bit number with bit 8 set to one.
-    <<RndHi:7, _:1, RndLow:40>> = crypto:rand_bytes(6),
+    <<RndHi:7, _:1, RndLow:40>> = crypto:strong_rand_bytes(6),
     %% Set 8 to 1
     <<RndHi:7, 1:1, RndLow:40>>.
 
@@ -406,5 +412,36 @@ is_valid(_, _) -> false.
 -spec now_xor_pid() -> {pos_integer(), pos_integer(), pos_integer()}.
 now_xor_pid() ->
     PidSum = erlang:phash2(self()),
-    <<N0:32, N1:32, N2:32>> = crypto:rand_bytes(12),
+    <<N0:32, N1:32, N2:32>> = crypto:strong_rand_bytes(12),
     {N0 bxor PidSum, N1 bxor PidSum, N2 bxor PidSum}.
+
+%% @private
+%% @doc We try to use the newer `rand' module (over the older `random')
+%%      if it's available; we cache the result for efficiency
+random_uniform(Seed, N) ->
+    case application:get_env(uuid, random_uniform_fun) of
+        {ok, RandomUniformFun} ->
+            RandomUniformFun(Seed, N);
+        undefined ->
+            set_random_uniform_fun(),
+            random_uniform(Seed, N)
+    end.
+
+%% @private
+%% @see random_uniform/2.
+set_random_uniform_fun() ->
+    Fun = case code:ensure_loaded(rand) of
+        {module, rand} ->
+            fun(Seed, N) ->
+                rand:seed(exs1024, Seed),
+                rand:uniform(N)
+            end;
+        {error, _} ->
+            fun(Seed, N) ->
+                %% using `erlang:apply/3' is a cheap way of avoiding
+                %% deprecation compilation warnings in OTP >= 19.0
+                erlang:apply(random, seed, [Seed]),
+                erlang:apply(random, uniform, [N])
+            end
+    end,
+    application:set_env(uuid, random_uniform_fun, Fun).
diff --git a/src/uuid.hrl b/src/uuid.hrl
index 66526a7..30ee8b6 100644
--- a/src/uuid.hrl
+++ b/src/uuid.hrl
@@ -1,5 +1,5 @@
 %% -----------------------------------------------------------------------------
-%% Copyright © 2010-2012 Per Andersson
+%% Copyright © 2010-2018 Per Andersson
 %%
 %% Erlang UUID is free software: you can redistribute it and/or modify
 %% it under the terms of the GNU Lesser General Public License as
@@ -16,7 +16,14 @@
 %% <http://www.gnu.org/licenses/>.
 %% -----------------------------------------------------------------------------
 %% @author Per Andersson <avtobiff@gmail.com>
-%% @copyright 2010-2012 Per Andersson
+%% @copyright 2010-2018 Per Andersson
+%%            2012 Bip Thelin
+%%            2013 Ryan Flynn
+%%            2013 Iivari Äikäs
+%%            2013 William Cummings
+%%            2014 Gianni Gambetti
+%%            2015 Peter Hizalev
+%%            2017 Jean Rouge
 %% @doc
 %% Erlang UUID
 %%

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/lib/erlang/lib/uuid-0.5.2/ebin/uuid.app
-rw-r--r--  root/root   /usr/lib/erlang/lib/uuid-0.5.2/ebin/uuid.beam

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/lib/erlang/lib/uuid-0.4.6/ebin/uuid.app
-rw-r--r--  root/root   /usr/lib/erlang/lib/uuid-0.4.6/ebin/uuid.beam

No differences were encountered in the control files

More details

Full run details