Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2019 01:40:40 +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-11@freebsd.org
Subject:   svn commit: r347605 - stable/11/cddl/contrib/opensolaris/cmd/zfs
Message-ID:  <201905150140.x4F1eeVr033690@repo.freebsd.org>

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

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/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
==============================================================================
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c	Wed May 15 01:38:34 2019	(r347604)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c	Wed May 15 01:40:40 2019	(r347605)
@@ -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?201905150140.x4F1eeVr033690>