Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2019 01:38:35 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r347604 - stable/12/cddl/contrib/opensolaris/cmd/zfs
Message-ID:  <201905150138.x4F1cZx4033514@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed May 15 01:38:34 2019
New Revision: 347604
URL: https://svnweb.freebsd.org/changeset/base/347604

Log:
  MFC r347240: 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  -

Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
==============================================================================
--- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c	Wed May 15 00:38:52 2019	(r347603)
+++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c	Wed May 15 01:38:34 2019	(r347604)
@@ -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?201905150138.x4F1cZx4033514>