From 9ca6f883665aa57fc850fe3bf1e3e8a9b182acc9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 14 Apr 2005 20:35:34 +0000 Subject: [PATCH] (dot_mount_point): Use stat rather than df, as it's more reliable. (other_partition_tmpdir): Remove df from name as that would be misleading now. --- tests/mv/setup | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/mv/setup b/tests/mv/setup index 6b03482b6a..591b80f23d 100755 --- a/tests/mv/setup +++ b/tests/mv/setup @@ -1,6 +1,6 @@ #! /bin/sh -# Use df to find a writable directory on a file system different from that +# Use stat to find a writable directory on a file system different from that # of the current directory. If one is found, create a temporary directory # inside it. @@ -9,22 +9,20 @@ test "${CANDIDATE_TMP_DIRS+set}" = set \ other_partition_tmpdir= -# WARNING: using sed like this to extract the mount point will fail -# if the mount point name contains `% '. -dot_mount_point=`df --no-sync -P . | sed -n '2s/.*% *//p'` +dot_mount_point=`stat -c %d .` for d in $CANDIDATE_TMP_DIRS; do # Skip nonexistent directories. test -d $d || continue - d_mount_point=`df --no-sync -P $d | sed -n '2s/.*% *//p'` + d_mount_point=`stat -c %d $d` # Same partition? Skip it. test x$d_mount_point = x$dot_mount_point && continue # See if we can create a directory in it. - if mkdir "$d/df-$$" > /dev/null 2>&1; then - other_partition_tmpdir="$d/df-$$" + if mkdir "$d/tmp$$" > /dev/null 2>&1; then + other_partition_tmpdir="$d/tmp$$" break fi -- 2.47.3