1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or https://opensource.org/licenses/CDDL-1.0. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23. $STF_SUITE/include/libtest.shlib 24 25# 26# DESCRIPTION: 27# Verify that datasets mounted at directories with whitespace are properly escaped 28# both going in (for mountd consumption) and going out (for removing from export list) 29# 30# STRATEGY: 31# 1. Create and share a dataset with spaces, tabs, and newlines 32# 2. Verify it's shared 33# 3. Unshare it 34# 4. Verify it's not shared 35# 36 37shares_can_have_whitespace || log_unsupported "Platform doesn't permit whitespace in NFS shares" 38basename='a + b 39 c d' 40escname='a\040+\040b\012\040c\011d' 41 42verify_runnable "global" 43 44function cleanup 45{ 46 datasetexists "$TESTPOOL/$TESTFS/shared1" && \ 47 destroy_dataset "$TESTPOOL/$TESTFS/shared1" -f 48} 49 50log_assert "Datasets with spaces are properly shared and unshared." 51log_onexit cleanup 52 53log_must zfs create -o sharenfs=on -o mountpoint="$TESTDIR/$basename" "$TESTPOOL/$TESTFS/shared1" 54log_must is_shared "$TESTDIR/$escname" 55log_must zfs unshare "$TESTPOOL/$TESTFS/shared1" 56log_mustnot is_shared "$TESTDIR/$escname" 57 58log_pass "Datasets with spaces are properly shared and unshared." 59