1#!/bin/sh 2# Ensure that tac processes all command line arguments, even 3# when it encounters an error with say the first one. 4# With coreutils-5.2.1 and earlier, this test would fail. 5 6# Copyright (C) 2004-2023 Free Software Foundation, Inc. 7 8# This program is free software: you can redistribute it and/or modify 9# it under the terms of the GNU General Public License as published by 10# the Free Software Foundation, either version 3 of the License, or 11# (at your option) any later version. 12 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17 18# You should have received a copy of the GNU General Public License 19# along with this program. If not, see <https://www.gnu.org/licenses/>. 20 21. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src 22print_ver_ tac 23 24# See if the envvar is defined. 25if test x = "x$FULL_PARTITION_TMPDIR"; then 26 skip_ "FULL_PARTITION_TMPDIR not defined" 27fi 28 29if ! test -d "$FULL_PARTITION_TMPDIR"; then 30 echo "$0: $FULL_PARTITION_TMPDIR:" \ 31 "\$FULL_PARTITION_TMPDIR does not specify a directory" 1>&2 32 Exit 1 33fi 34 35fp_tmp="$FULL_PARTITION_TMPDIR/tac-cont-$$" 36cleanup_() 37{ 38 # Terminate any background process 39 # and remove tmp dir 40 rm -f "$fp_tmp" 41 kill $pid 2>/dev/null && wait $pid 42} 43 44# Make sure we can create an empty file there (i.e., no shortage of inodes). 45if ! touch $fp_tmp; then 46 echo "$0: $fp_tmp: cannot create empty file" 1>&2 47 Exit 1 48fi 49 50# Make sure that we fail when trying to create a file large enough 51# to consume a non-inode block. 52if seq 1000 > $fp_tmp 2>/dev/null; then 53 echo "$0: $FULL_PARTITION_TMPDIR: not a full partition" 1>&2 54 Exit 1 55fi 56 57seq 5 > in 58 59 60# Give tac a fifo command line argument. 61# This makes it try to create a temporary file in $TMPDIR. 62mkfifo_or_skip_ fifo 63seq 1000 > fifo & pid=$! 64TMPDIR=$FULL_PARTITION_TMPDIR tac fifo in >out 2>err && fail=1 65 66cat <<\EOF > exp || framework_failure_ 675 684 693 702 711 72EOF 73 74compare exp out || fail=1 75 76Exit $fail 77