Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] uuidgen: print warning if uuidd isn't running
@ 2011-06-08 13:35 Ludwig Nussel
  2011-06-14 11:45 ` Karel Zak
  0 siblings, 1 reply; 6+ messages in thread
From: Ludwig Nussel @ 2011-06-08 13:35 UTC (permalink / raw)
  To: util-linux; +Cc: Ludwig Nussel

---
 misc-utils/uuidgen.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c
index 3cf6ec9..47f8e8f 100644
--- a/misc-utils/uuidgen.c
+++ b/misc-utils/uuidgen.c
@@ -59,7 +59,9 @@ main (int argc, char *argv[])
 
 	switch (do_type) {
 	case DO_TYPE_TIME:
-		uuid_generate_time(uu);
+		if (uuid_generate_time_safe(uu)) {
+			fprintf(stderr, _("Warning: uuidd not running or not operational. Time based uuid may not be unique.\n"));
+		}
 		break;
 	case DO_TYPE_RANDOM:
 		uuid_generate_random(uu);
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] uuidgen: print warning if uuidd isn't running
  2011-06-08 13:35 [PATCH] uuidgen: print warning if uuidd isn't running Ludwig Nussel
@ 2011-06-14 11:45 ` Karel Zak
  2011-06-14 11:51   ` Karel Zak
  0 siblings, 1 reply; 6+ messages in thread
From: Karel Zak @ 2011-06-14 11:45 UTC (permalink / raw)
  To: Ludwig Nussel; +Cc: util-linux

On Wed, Jun 08, 2011 at 03:35:01PM +0200, Ludwig Nussel wrote:
> ---
>  misc-utils/uuidgen.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c
> index 3cf6ec9..47f8e8f 100644
> --- a/misc-utils/uuidgen.c
> +++ b/misc-utils/uuidgen.c
> @@ -59,7 +59,9 @@ main (int argc, char *argv[])
>  
>  	switch (do_type) {
>  	case DO_TYPE_TIME:
> -		uuid_generate_time(uu);
> +		if (uuid_generate_time_safe(uu)) {
> +			fprintf(stderr, _("Warning: uuidd not running or not operational. Time based uuid may not be unique.\n"));

IMHO this is overkill -- the uuidd is used very rarely (usually on
large systems with SAP) and it's disabled by default in many
distributions, but the uuidgen(1) util is available everywhere and
used probably often used by admins/scripts.

It would be better to add some WARNING section to the uuidgen(1) man
page to inform users about the disadvantage.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] uuidgen: print warning if uuidd isn't running
  2011-06-14 11:45 ` Karel Zak
@ 2011-06-14 11:51   ` Karel Zak
  2011-06-14 12:06     ` Ludwig Nussel
  0 siblings, 1 reply; 6+ messages in thread
From: Karel Zak @ 2011-06-14 11:51 UTC (permalink / raw)
  To: Ludwig Nussel; +Cc: util-linux

On Tue, Jun 14, 2011 at 01:45:34PM +0200, Karel Zak wrote:
> On Wed, Jun 08, 2011 at 03:35:01PM +0200, Ludwig Nussel wrote:
> > ---
> >  misc-utils/uuidgen.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c
> > index 3cf6ec9..47f8e8f 100644
> > --- a/misc-utils/uuidgen.c
> > +++ b/misc-utils/uuidgen.c
> > @@ -59,7 +59,9 @@ main (int argc, char *argv[])
> >  
> >  	switch (do_type) {
> >  	case DO_TYPE_TIME:
> > -		uuid_generate_time(uu);
> > +		if (uuid_generate_time_safe(uu)) {
> > +			fprintf(stderr, _("Warning: uuidd not running or not operational. Time based uuid may not be unique.\n"));
> 
> IMHO this is overkill -- the uuidd is used very rarely (usually on
> large systems with SAP) and it's disabled by default in many
> distributions, but the uuidgen(1) util is available everywhere and
> used probably often used by admins/scripts.
> 
> It would be better to add some WARNING section to the uuidgen(1) man
> page to inform users about the disadvantage.

 ... we can also add a new option (e.g. --safe) to use 
 uuid_generate_time_safe().

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] uuidgen: print warning if uuidd isn't running
  2011-06-14 11:51   ` Karel Zak
@ 2011-06-14 12:06     ` Ludwig Nussel
  2011-06-14 12:17       ` Voelker, Bernhard
  2011-06-14 14:38       ` Karel Zak
  0 siblings, 2 replies; 6+ messages in thread
From: Ludwig Nussel @ 2011-06-14 12:06 UTC (permalink / raw)
  To: util-linux

Karel Zak wrote:
> On Tue, Jun 14, 2011 at 01:45:34PM +0200, Karel Zak wrote:
> > On Wed, Jun 08, 2011 at 03:35:01PM +0200, Ludwig Nussel wrote:
> > > ---
> > >  misc-utils/uuidgen.c |    4 +++-
> > >  1 files changed, 3 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c
> > > index 3cf6ec9..47f8e8f 100644
> > > --- a/misc-utils/uuidgen.c
> > > +++ b/misc-utils/uuidgen.c
> > > @@ -59,7 +59,9 @@ main (int argc, char *argv[])
> > >  
> > >  	switch (do_type) {
> > >  	case DO_TYPE_TIME:
> > > -		uuid_generate_time(uu);
> > > +		if (uuid_generate_time_safe(uu)) {
> > > +			fprintf(stderr, _("Warning: uuidd not running or not operational. Time based uuid may not be unique.\n"));
> > 
> > IMHO this is overkill -- the uuidd is used very rarely (usually on
> > large systems with SAP) and it's disabled by default in many
> > distributions, but the uuidgen(1) util is available everywhere and
> > used probably often used by admins/scripts.

That's the problem exactly. uuidgen seems to work for them at first
until lots of uuids within a short time are required. It's a mean
trap.

> > It would be better to add some WARNING section to the uuidgen(1) man
> > page to inform users about the disadvantage.

Well, who reads docu if uuidgen -t appears to work?

>  ... we can also add a new option (e.g. --safe) to use 
>  uuid_generate_time_safe().

... or make -t fail if it's not safe and add a --unsafe option. That
would be the fail-safe approach :-)

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] uuidgen: print warning if uuidd isn't running
  2011-06-14 12:06     ` Ludwig Nussel
@ 2011-06-14 12:17       ` Voelker, Bernhard
  2011-06-14 14:38       ` Karel Zak
  1 sibling, 0 replies; 6+ messages in thread
From: Voelker, Bernhard @ 2011-06-14 12:17 UTC (permalink / raw)
  To: Ludwig Nussel, util-linux@vger.kernel.org

Ludwig Nussel wrote:
> Karel Zak wrote:
>
> Well, who reads docu if uuidgen -t appears to work?
> 
>>  ... we can also add a new option (e.g. --safe) to use 
>>  uuid_generate_time_safe().
> 
> ... or make -t fail if it's not safe and add a --unsafe option. That
> would be the fail-safe approach :-)

Wasn't there a similar discussion back in Feb. when the *_safe()
function was introduced?
http://www.spinics.net/lists/util-linux-ng/msg03933.html
http://www.spinics.net/lists/util-linux-ng/msg04092.html


Bye,
Berny

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] uuidgen: print warning if uuidd isn't running
  2011-06-14 12:06     ` Ludwig Nussel
  2011-06-14 12:17       ` Voelker, Bernhard
@ 2011-06-14 14:38       ` Karel Zak
  1 sibling, 0 replies; 6+ messages in thread
From: Karel Zak @ 2011-06-14 14:38 UTC (permalink / raw)
  To: Ludwig Nussel; +Cc: util-linux

On Tue, Jun 14, 2011 at 02:06:10PM +0200, Ludwig Nussel wrote:
> Karel Zak wrote:
> > On Tue, Jun 14, 2011 at 01:45:34PM +0200, Karel Zak wrote:
> > > On Wed, Jun 08, 2011 at 03:35:01PM +0200, Ludwig Nussel wrote:
> > > > ---
> > > >  misc-utils/uuidgen.c |    4 +++-
> > > >  1 files changed, 3 insertions(+), 1 deletions(-)
> > > > 
> > > > diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c
> > > > index 3cf6ec9..47f8e8f 100644
> > > > --- a/misc-utils/uuidgen.c
> > > > +++ b/misc-utils/uuidgen.c
> > > > @@ -59,7 +59,9 @@ main (int argc, char *argv[])
> > > >  
> > > >  	switch (do_type) {
> > > >  	case DO_TYPE_TIME:
> > > > -		uuid_generate_time(uu);
> > > > +		if (uuid_generate_time_safe(uu)) {
> > > > +			fprintf(stderr, _("Warning: uuidd not running or not operational. Time based uuid may not be unique.\n"));
> > > 
> > > IMHO this is overkill -- the uuidd is used very rarely (usually on
> > > large systems with SAP) and it's disabled by default in many
> > > distributions, but the uuidgen(1) util is available everywhere and
> > > used probably often used by admins/scripts.
> 
> That's the problem exactly. uuidgen seems to work for them at first
> until lots of uuids within a short time are required. It's a mean
> trap.
> 
> > > It would be better to add some WARNING section to the uuidgen(1) man
> > > page to inform users about the disadvantage.
> 
> Well, who reads docu if uuidgen -t appears to work?
> 
> >  ... we can also add a new option (e.g. --safe) to use 
> >  uuid_generate_time_safe().
> 
> ... or make -t fail if it's not safe and add a --unsafe option. That
> would be the fail-safe approach :-)

 OK. What about --force rather than --unsafe?

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-14 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 13:35 [PATCH] uuidgen: print warning if uuidd isn't running Ludwig Nussel
2011-06-14 11:45 ` Karel Zak
2011-06-14 11:51   ` Karel Zak
2011-06-14 12:06     ` Ludwig Nussel
2011-06-14 12:17       ` Voelker, Bernhard
2011-06-14 14:38       ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox