Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 May 2019 01:35:43 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r347240 - head/cddl/contrib/opensolaris/cmd/zfs
Message-ID:  <201905080135.x481ZhPS058170@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed May  8 01:35:43 2019
New Revision: 347240
URL: https://svnweb.freebsd.org/changeset/base/347240

Log:
  Fix dataset name comparison in zfs_compare().
  
  The code never returned match comparing two datasets (not snapshots).
  As result, uu_avl_find(), called from zfs_callback(), never succeeded,
  allowing to add same dataset into the list multiple times, for example:
  
  	# zfs get name pers pers pers@z pers@z
  	NAME    PROPERTY  VALUE   SOURCE
  	pers    name      pers    -
  	pers    name      pers    -
  	pers@z  name      pers@z  -
  
  With the patch:
  
  	# zfs get name pers pers pers@z pers@z
  	NAME    PROPERTY  VALUE   SOURCE
  	pers    name      pers    -
  	pers@z  name      pers@z  -
  
  MFC after:	1 week
  Sponsored by:	iXsystems, Inc.

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c	Wed May  8 00:45:16 2019	(r347239)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c	Wed May  8 01:35:43 2019	(r347240)
@@ -225,7 +225,7 @@ zfs_compare(const void *larg, const void *rarg, void *
 		*rat = '\0';
 
 	ret = strcmp(lname, rname);
-	if (ret == 0) {
+	if (ret == 0 && (lat != NULL || rat != NULL)) {
 		/*
 		 * If we're comparing a dataset to one of its snapshots, we
 		 * always make the full dataset first.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905080135.x481ZhPS058170>