Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4337,7 +4337,7 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type,
newname);
if (nvlist_lookup_string(attrs,
ZPROP_SOURCE, &source) == 0 &&
strcmp(source, ZPROP_SOURCE_VAL_RECVD) != 0)
strcmp(source, fsname) == 0)
continue;
}
/*
Expand Down
3 changes: 2 additions & 1 deletion tests/runfiles/sanity.run
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ tests = ['zfs_receive_001_pos', 'zfs_receive_002_pos', 'zfs_receive_003_pos',
'zfs_receive_016_pos', 'zfs_receive_from_encrypted',
'zfs_receive_to_encrypted', 'zfs_receive_raw',
'zfs_receive_raw_incremental', 'zfs_receive_-e',
'zfs_receive_raw_-d', 'zfs_receive_from_zstd', 'zfs_receive_new_props']
'zfs_receive_raw_-d', 'zfs_receive_from_zstd',
'zfs_receive_new_props', 'receive-x_props_alternation']
tags = ['functional', 'cli_root', 'zfs_receive']

[tests/functional/cli_root/zfs_rename]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/ksh -p
# SPDX-License-Identifier: CDDL-1.0
#
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
# CDDL HEADER END
#

#
# Copyright (c) 2026 by . All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib

#
# DESCRIPTION:
# Verify 'zfs receive -x' consistently excludes a property across
# incremental sends with -p, and does not alternate.
#
# STRATEGY:
# 1. Create source and destination datasets.
# 2. Set a native property (refquota) on source.
# 3. Full send with -p, receive with -x refquota.
# 4. Verify refquota is not set on destination.
# 5. Loop several incremental sends/receives with -p/-x.
# 6. Each iteration verify refquota stays consistently excluded.
#

verify_runnable "global"

function cleanup
{
destroy_dataset "$orig" "-rf"
destroy_dataset "$dest" "-rf"
}

log_assert "'zfs receive -x' consistently excludes properties" \
"across incremental sends."
log_onexit cleanup

orig=$TESTPOOL/$TESTFS1
dest=$TESTPOOL/$TESTFS2

# setup source and destination
log_must zfs create $orig
log_must zfs create $dest

# set a native property on source
log_must zfs set refquota=64M $orig
log_must check_prop_source $orig refquota 67108864 local

# full send with -p, receive with -x
log_must zfs snapshot $orig@snap1
log_must eval "zfs send -p $orig@snap1 | zfs receive -e -x refquota $dest"

# destination should NOT have refquota from the stream
log_must [ "$(get_prop refquota $dest/$TESTFS1)" = "0" ]

# incremental sends: the excluded property must never appear on dest
typeset -i i=2
while (( i <= 4 )); do
log_must zfs snapshot $orig@snap$i
log_must eval "zfs send -p -i $orig@snap$((i-1)) $orig@snap$i \
| zfs receive -e -F -x refquota $dest"
log_must [ "$(get_prop refquota $dest/$TESTFS1)" = "0" ]
(( i = i + 1 ))
done

log_pass "'zfs receive -x' consistently excludes properties" \
"across incremental sends."
Loading