mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-22 16:58:55 +00:00
Address some Shellcheck SC2012 warnings (#2306)
This commit is contained in:
parent
3d73d5a687
commit
7e20278489
@ -337,6 +337,7 @@ function test_chown {
|
|||||||
|
|
||||||
# if they're the same, we have a problem.
|
# if they're the same, we have a problem.
|
||||||
local CHANGED_PERMISSIONS
|
local CHANGED_PERMISSIONS
|
||||||
|
# TODO: add helper
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
CHANGED_PERMISSIONS=$(stat -f "%u:%g" "${TEST_TEXT_FILE}")
|
CHANGED_PERMISSIONS=$(stat -f "%u:%g" "${TEST_TEXT_FILE}")
|
||||||
else
|
else
|
||||||
@ -1847,8 +1848,8 @@ function test_concurrent_directory_updates {
|
|||||||
for _ in $(seq 10); do
|
for _ in $(seq 10); do
|
||||||
for i in $(seq 5); do
|
for i in $(seq 5); do
|
||||||
local file
|
local file
|
||||||
# shellcheck disable=SC2012,SC2046
|
# shellcheck disable=SC2046
|
||||||
file=$(ls $(seq 5) | "${SED_BIN}" -n "$((RANDOM % 5 + 1))p")
|
file=$(echo [1-5] | "${SED_BIN}" -n "$((RANDOM % 5 + 1))p")
|
||||||
cat "${file}" >/dev/null || true
|
cat "${file}" >/dev/null || true
|
||||||
rm -f "${file}"
|
rm -f "${file}"
|
||||||
echo "foo" > "${file}" || true
|
echo "foo" > "${file}" || true
|
||||||
@ -1985,8 +1986,7 @@ function test_cache_file_stat() {
|
|||||||
# get cache file inode number
|
# get cache file inode number
|
||||||
#
|
#
|
||||||
local CACHE_FILE_INODE
|
local CACHE_FILE_INODE
|
||||||
# shellcheck disable=SC2012
|
CACHE_FILE_INODE=$(get_inode "${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}")
|
||||||
CACHE_FILE_INODE=$(ls -i "${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}" 2>/dev/null | awk '{print $1}')
|
|
||||||
if [ -z "${CACHE_FILE_INODE}" ]; then
|
if [ -z "${CACHE_FILE_INODE}" ]; then
|
||||||
echo "Not found cache file or failed to get inode: ${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}"
|
echo "Not found cache file or failed to get inode: ${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}"
|
||||||
return 1;
|
return 1;
|
||||||
@ -2029,8 +2029,7 @@ function test_cache_file_stat() {
|
|||||||
#
|
#
|
||||||
# get cache file inode number
|
# get cache file inode number
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2012
|
CACHE_FILE_INODE=$(get_inode "${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}")
|
||||||
CACHE_FILE_INODE=$(ls -i "${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}" 2>/dev/null | awk '{print $1}')
|
|
||||||
if [ -z "${CACHE_FILE_INODE}" ]; then
|
if [ -z "${CACHE_FILE_INODE}" ]; then
|
||||||
echo "Not found cache file or failed to get inode: ${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}"
|
echo "Not found cache file or failed to get inode: ${CACHE_DIR}/${TEST_BUCKET_1}/${CACHE_TESTRUN_DIR}/${BIG_FILE}"
|
||||||
return 1;
|
return 1;
|
||||||
@ -2211,8 +2210,7 @@ function test_ensurespace_move_file() {
|
|||||||
MOVED_PERMISSIONS=$(stat --format=%u:%g "${BIG_FILE}")
|
MOVED_PERMISSIONS=$(stat --format=%u:%g "${BIG_FILE}")
|
||||||
fi
|
fi
|
||||||
local MOVED_FILE_LENGTH
|
local MOVED_FILE_LENGTH
|
||||||
# shellcheck disable=SC2012
|
MOVED_FILE_LENGTH=$(get_size "${BIG_FILE}")
|
||||||
MOVED_FILE_LENGTH=$(ls -l "${BIG_FILE}" | awk '{print $5}')
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# check
|
# check
|
||||||
@ -2547,9 +2545,8 @@ function test_file_names_longer_than_posix() {
|
|||||||
rm -f "${a256}"
|
rm -f "${a256}"
|
||||||
|
|
||||||
echo data | aws_cli s3 cp - "s3://${TEST_BUCKET_1}/${DIR_NAME}/${a256}"
|
echo data | aws_cli s3 cp - "s3://${TEST_BUCKET_1}/${DIR_NAME}/${a256}"
|
||||||
# shellcheck disable=SC2012
|
files=(*)
|
||||||
count=$(ls | wc -l)
|
if [ "${#files[@]}" = 0 ]; then
|
||||||
if [ "${count}" = 0 ]; then
|
|
||||||
echo "failed to list long file name"
|
echo "failed to list long file name"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -95,11 +95,19 @@ function del_xattr() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_inode() {
|
||||||
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
|
stat -f "%i" "$1"
|
||||||
|
else
|
||||||
|
stat --format "%i" "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function get_size() {
|
function get_size() {
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
stat -f "%z" "$1"
|
stat -f "%z" "$1"
|
||||||
else
|
else
|
||||||
stat -c %s "$1"
|
stat --format "%s" "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user