diff options
author | наб <[email protected]> | 2021-12-10 00:02:52 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-04-01 09:58:45 -0700 |
commit | 5a21214be84e4b00f419220e4da51f16cee13cad (patch) | |
tree | f9f42c1851816b01a8bfbbcb6db684865e8b7109 /tests | |
parent | 52bad4f23daaa5f827f802c8d05785a27b80275d (diff) |
zfs, libzfs: diff: accept -h/ZFS_DIFF_NO_MANGLE, disabling path escaping
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Rich Ercolani <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Upstream-commit: 344bbc82e7054f61d5e7b3610b119820285fd2cb
Closes #12829
Diffstat (limited to 'tests')
4 files changed, 52 insertions, 3 deletions
diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index aefcd9843..19919a00a 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -178,7 +178,7 @@ tags = ['functional', 'cli_root', 'zfs_destroy'] [tests/functional/cli_root/zfs_diff] tests = ['zfs_diff_changes', 'zfs_diff_cliargs', 'zfs_diff_timestamp', - 'zfs_diff_types', 'zfs_diff_encrypted'] + 'zfs_diff_types', 'zfs_diff_encrypted', 'zfs_diff_mangle'] tags = ['functional', 'cli_root', 'zfs_diff'] [tests/functional/cli_root/zfs_get] diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am index db90e0585..bfb01dcb8 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am @@ -8,6 +8,7 @@ dist_pkgdata_SCRIPTS = \ zfs_diff_changes.ksh \ zfs_diff_cliargs.ksh \ zfs_diff_encrypted.ksh \ + zfs_diff_mangle.ksh \ zfs_diff_timestamp.ksh \ zfs_diff_types.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_cliargs.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_cliargs.ksh index 7063bbe9c..67eb18fa4 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_cliargs.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_cliargs.ksh @@ -39,8 +39,8 @@ function cleanup log_assert "'zfs diff' should only work with supported options." log_onexit cleanup -typeset goodopts=("" "-F" "-H" "-t" "-FH" "-Ft" "-Ht" "-FHt") -typeset badopts=("-f" "-h" "-h" "-T" "-Fx" "-Ho" "-tT" "-") +typeset goodopts=("" "-h" "-t" "-th" "-H" "-Hh" "-Ht" "-Hth" "-F" "-Fh" "-Ft" "-Fth" "-FH" "-FHh" "-FHt" "-FHth") +typeset badopts=("-f" "-T" "-Fx" "-Ho" "-tT" "-") DATASET="$TESTPOOL/$TESTFS" TESTSNAP1="$DATASET@snap1" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_mangle.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_mangle.ksh new file mode 100755 index 000000000..ffce9f068 --- /dev/null +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_mangle.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh -p +# +# 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. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# 'zfs diff' escapes filenames as expected, 'zfs diff -h' doesn't +# +# STRATEGY: +# 1. Prepare a dataset +# 2. Create some files +# 3. verify 'zfs diff' mangles them and 'zfs diff -h' doesn't +# + +verify_runnable "both" + +function cleanup +{ + log_must zfs destroy -r "$DATASET" +} + +log_assert "'zfs diff' mangles filenames, 'zfs diff -h' doesn't" +log_onexit cleanup + +DATASET="$TESTPOOL/$TESTFS/fs" +TESTSNAP1="$DATASET@snap1" + +# 1. Prepare a dataset +log_must zfs create "$DATASET" +MNTPOINT="$(get_prop mountpoint "$DATASET")" +log_must zfs snapshot "$TESTSNAP1" + +printf '%c\t'"$MNTPOINT/"'%s\n' M '' + 'śmieszny żupan' + 'достопримечательности' | sort > "$MNTPOINT/śmieszny żupan" +printf '%c\t'"$MNTPOINT/"'%s\n' M '' + '\0305\0233mieszny\0040\0305\0274upan' + '\0320\0264\0320\0276\0321\0201\0321\0202\0320\0276\0320\0277\0321\0200\0320\0270\0320\0274\0320\0265\0321\0207\0320\0260\0321\0202\0320\0265\0320\0273\0321\0214\0320\0275\0320\0276\0321\0201\0321\0202\0320\0270' | sort > "$MNTPOINT/достопримечательности" +log_must diff -u <(zfs diff -h "$TESTSNAP1" | grep -vF '<xattrdir>' | sort) "$MNTPOINT/śmieszny żupan" +log_must diff -u <(zfs diff "$TESTSNAP1" | grep -vF '<xattrdir>' | sort) "$MNTPOINT/достопримечательности" + +log_pass "'zfs diff' mangles filenames, 'zfs diff -h' doesn't" |