Util-Linux package development
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: Sami Kerola <kerolasa@iki.fi>
Subject: [PATCH 4/9] uuidparse: nil uuid have all bits set to zero
Date: Mon, 31 Jul 2017 20:55:03 +0100	[thread overview]
Message-ID: <20170731195508.11661-5-kerolasa@iki.fi> (raw)
In-Reply-To: <20170731195508.11661-1-kerolasa@iki.fi>

The nil UUID is special form of UUID that is specified to have all 128 bits
set to zero.

Reference: https://tools.ietf.org/html/rfc4122#section-4.1.7
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/uuidparse.c        | 5 ++++-
 tests/expected/uuid/uuidparse | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/misc-utils/uuidparse.c b/misc-utils/uuidparse.c
index 49225ae2c..5fa34b23d 100644
--- a/misc-utils/uuidparse.c
+++ b/misc-utils/uuidparse.c
@@ -195,7 +195,10 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid)
 			}
 			switch (type) {
 			case 0:
-				str = xstrdup(_("nil"));
+				if (strspn(uuid, "0-") == 36)
+					str = xstrdup(_("nil"));
+				else
+					str = xstrdup(_("unknown"));
 				break;
 			case 1:
 				str = xstrdup(_("time-based"));
diff --git a/tests/expected/uuid/uuidparse b/tests/expected/uuid/uuidparse
index 7fc64bcd2..c4959be8d 100644
--- a/tests/expected/uuid/uuidparse
+++ b/tests/expected/uuid/uuidparse
@@ -6,20 +6,20 @@ UUID                                  VARIANT   TYPE       TIME
 00000000-0000-4000-0000-000000000000  NCS       random     
 00000000-0000-5000-0000-000000000000  NCS       sha1-based 
 00000000-0000-6000-0000-000000000000  NCS       unknown    
-00000000-0000-0000-8000-000000000000  DCE       nil        
+00000000-0000-0000-8000-000000000000  DCE       unknown    
 00000000-0000-2000-8000-000000000000  DCE       DCE        
 00000000-0000-3000-8000-000000000000  DCE       name-based 
 00000000-0000-4000-8000-000000000000  DCE       random     
 00000000-0000-5000-8000-000000000000  DCE       sha1-based 
 00000000-0000-6000-8000-000000000000  DCE       unknown    
-00000000-0000-0000-d000-000000000000  Microsoft nil        
+00000000-0000-0000-d000-000000000000  Microsoft unknown    
 00000000-0000-1000-d000-000000000000  Microsoft time-based 
 00000000-0000-2000-d000-000000000000  Microsoft DCE        
 00000000-0000-3000-d000-000000000000  Microsoft name-based 
 00000000-0000-4000-d000-000000000000  Microsoft random     
 00000000-0000-5000-d000-000000000000  Microsoft sha1-based 
 00000000-0000-6000-d000-000000000000  Microsoft unknown    
-00000000-0000-0000-f000-000000000000  other     nil        
+00000000-0000-0000-f000-000000000000  other     unknown    
 00000000-0000-1000-f000-000000000000  other     time-based 
 00000000-0000-2000-f000-000000000000  other     DCE        
 00000000-0000-3000-f000-000000000000  other     name-based 
-- 
2.13.3


  parent reply	other threads:[~2017-07-31 19:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31 19:54 [PATCH 0/9] pull: various removals and few fixes Sami Kerola
2017-07-31 19:55 ` [PATCH 1/9] chfn, chsh: merge auth.h, islocal.h and libuser.h to ch-common.h Sami Kerola
2017-08-01  9:27   ` Karel Zak
2017-08-05 16:33     ` Sami Kerola
2017-07-31 19:55 ` [PATCH 2/9] include: move pamfail.h to auth.c Sami Kerola
2017-07-31 19:55 ` [PATCH 3/9] vipw: use explicit_bzero() to clear buffer after copy Sami Kerola
2017-07-31 19:55 ` Sami Kerola [this message]
2017-07-31 19:55 ` [PATCH 5/9] libuuid: use access(2) when checking /dev/random availability Sami Kerola
2017-07-31 19:55 ` [PATCH 6/9] bash-completion: look for look completions Sami Kerola
2017-07-31 19:55 ` [PATCH 7/9] agetty: remove dead DO_DEVFS_FIDDLING code segment Sami Kerola
2017-07-31 19:55 ` [PATCH 8/9] agetty: add --compile-time option Sami Kerola
2017-08-01  9:41   ` Karel Zak
2017-08-05 16:44     ` Sami Kerola
2017-07-31 19:55 ` [PATCH 9/9] agetty: fix invalid usage crash Sami Kerola
2017-08-01  9:42   ` Karel Zak
2017-08-05 16:34     ` Sami Kerola
2017-08-07  7:54 ` [PATCH 0/9] pull: various removals and few fixes Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170731195508.11661-5-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox