diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-14 15:01:37 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-14 15:01:37 (EDT) |
commit | e896f1bd0de35a4c2893f8d7b68028ae6f1c7d23 (patch) | |
tree | 900ba669d4791bd0b22ba5b4e6fcabb0f074c005 /src | |
parent | 4d4570f81329f3e99cf0ce1b8ed61d5b9cb39026 (diff) |
Make redirected FDs explicit
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/include.sh | 2 | ||||
-rw-r--r-- | src/control.sh | 4 | ||||
-rw-r--r-- | src/db.sh | 10 | ||||
-rw-r--r-- | src/garbage.sh | 4 | ||||
-rw-r--r-- | src/include.sh | 10 | ||||
-rw-r--r-- | src/index.sh | 16 | ||||
-rw-r--r-- | src/main.sh | 2 | ||||
-rw-r--r-- | src/output.sh | 12 | ||||
-rw-r--r-- | src/remove.sh | 4 | ||||
-rw-r--r-- | src/suite.sh | 6 |
10 files changed, 35 insertions, 35 deletions
diff --git a/src/cmd/include.sh b/src/cmd/include.sh index 014389e..e389d81 100644 --- a/src/cmd/include.sh +++ b/src/cmd/include.sh @@ -27,7 +27,7 @@ cmd_include_main() init for changes in "${@}"; do - include_changes "${changes}" >/dev/null + include_changes "${changes}" 1>/dev/null done fini diff --git a/src/control.sh b/src/control.sh index 68ef257..29ad6f8 100644 --- a/src/control.sh +++ b/src/control.sh @@ -75,7 +75,7 @@ parse_control() return 0 fi fi - IFS=': ' read name value <<-EOF + IFS=': ' read name value 0<<-EOF ${line} EOF if [ -z "${name}" ]; then @@ -119,7 +119,7 @@ parse_control() value="${value}${LF}${line# }" ;; esac - done <<-EOF + done 0<<-EOF $(cat -- "${file}") EOF @@ -53,7 +53,7 @@ db_set_srcver() dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}" mkdir -p -- "${dir}" - printf '%s\n' "${srcver}" >"${dir}/srcver" + printf '%s\n' "${srcver}" 1>"${dir}/srcver" return 0 } @@ -112,7 +112,7 @@ db_set_binver() dir="${base_dir}/feeds/${chan}/${dist}/.db" dir="${dir}/$(hash_name "${source}")/${source}/${arch}_${plat}" mkdir -p -- "${dir}" - printf '%s\n' "${binver}" >"${dir}/binver" + printf '%s\n' "${binver}" 1>"${dir}/binver" return 0 } @@ -223,7 +223,7 @@ db_add_package() dir="${base_dir}/pool/$(hash_name "${source}")/${source}/.db" dir="${dir}/${binver}_${arch}_${plat}" mkdir -p -- "${dir}" - printf '%s %s %s\n' "${size}" "${sect}" "${pkg}" >>"${dir}/packages" + printf '%s %s %s\n' "${size}" "${sect}" "${pkg}" 1>>"${dir}/packages" return 0 } @@ -267,7 +267,7 @@ db_inc_references() refs=1 mkdir -p -- "${dir}" fi - printf '%d\n' "${refs}" >"${dir}/references" + printf '%d\n' "${refs}" 1>"${dir}/references" printf '%d\n' "${refs}" return 0 @@ -294,7 +294,7 @@ db_dec_references() if [ ${refs} -eq 0 ]; then rm -f -- "${dir}/references" else - printf '%d\n' "${refs}" >"${dir}/references" + printf '%d\n' "${refs}" 1>"${dir}/references" fi printf '%d\n' "${refs}" diff --git a/src/garbage.sh b/src/garbage.sh index 118bce1..04d3980 100644 --- a/src/garbage.sh +++ b/src/garbage.sh @@ -66,7 +66,7 @@ collect_garbage() try_rmdir "${base_dir}/${file}" || : dirs=$((${dirs} - 1)) done - done <"${garbage}" + done 0<"${garbage}" rm -f -- "${garbage}" done @@ -85,7 +85,7 @@ mark_pool_garbage() time=$((${time} + ${conf_pool_gc_delay})) mkdir -p -- "${base_dir}/.db/garbage" - printf '2 %s\n' "${file}" >>"${base_dir}/.db/garbage/${time}" + printf '2 %s\n' "${file}" 1>>"${base_dir}/.db/garbage/${time}" return 0 } diff --git a/src/include.sh b/src/include.sh index 71e82ac..0c27f60 100644 --- a/src/include.sh +++ b/src/include.sh @@ -124,7 +124,7 @@ include_changes() error 2 "$(get_msg 'include_bvap_exists')" \ "${binver}" "${arch}" "${plat}" fi - done <<-EOF + done 0<<-EOF ${bvaps} EOF fi @@ -148,8 +148,8 @@ include_changes() db_set_binver "${chan}" "${dist}" "${arch}" "${plat}" \ "${source}" "${binver}" db_inc_references "${arch}" "${plat}" "${source}" "${binver}" \ - >/dev/null - done <<-EOF + 1>/dev/null + done 0<<-EOF ${bvaps} EOF @@ -159,7 +159,7 @@ include_changes() if [ "x${file##[ ]}" = 'x' ]; then continue fi - IFS='_' read -r pkg binver arch plat <<-EOF + IFS='_' read -r pkg binver arch plat 0<<-EOF ${file%.opk} EOF db_add_package "${arch}" "${plat}" "${source}" "${binver}" \ @@ -171,7 +171,7 @@ include_changes() cp -p -- "${file}" "${base_dir}/${pool_file}" feed_add_package "${chan}" "${dist}" "${arch}" "${plat}" \ "${sect}" "${pkg}" "${size}" "${pool_file}" - done <<-EOF + done 0<<-EOF ${_include_files} EOF diff --git a/src/index.sh b/src/index.sh index 7322798..ac070bc 100644 --- a/src/index.sh +++ b/src/index.sh @@ -65,18 +65,18 @@ feed_add_package() mkdir -p -- "${feed_hash_idx}/info" "${TAR}" -xzOf "${base_dir}/${file}" 'control.tar.gz' | \ "${TAR}" -xzO './control' \ - >"${feed_hash_idx}/info/${pkg}.control" + 1>"${feed_hash_idx}/info/${pkg}.control" printf 'Filename: %s\nSize: %s\nMD5sum: %s\nSHA256sum: %s\n\n' \ "../../../../../../${file}" "${size}" \ "$("${MD5SUM}" "${base_dir}/${file}" | sed 's/ .*$//')" \ "$("${SHA256SUM}" "${base_dir}/${file}" | sed 's/ .*$//')" \ - >>"${feed_hash_idx}/info/${pkg}.control" + 1>>"${feed_hash_idx}/info/${pkg}.control" # Mark feed index fragment as outdated. old_dir="${base_dir}/feeds/.db/${chan}_${dist}/${arch}_${plat}" old_dir="${old_dir}/${sect}" mkdir -p -- "${old_dir}" - >"${old_dir}/${pkg_hash}" + 1>"${old_dir}/${pkg_hash}" return 0 } @@ -109,7 +109,7 @@ feed_remove_package() old_dir="${base_dir}/feeds/.db/${chan}_${dist}/${arch}_${plat}" old_dir="${old_dir}/${sect}" mkdir -p -- "${old_dir}" - >"${old_dir}/${pkg_hash}" + 1>"${old_dir}/${pkg_hash}" return 0 } @@ -174,7 +174,7 @@ update_feeds() # Ensure there are still packages here. if [ -d "${idx}/info" ]; then cat -- "${idx}/info/"*.control \ - >"${idx}/Packages" + 1>"${idx}/Packages" else rm -f -- "${idx}/Packages" rmdir -- "${idx}" @@ -184,16 +184,16 @@ update_feeds() # Ensure there are still packages here. if ! try_rmdir "${sect}/.db"; then cat -- "${sect}/.db/"*/Packages \ - >"${sect}/Packages~" + 1>"${sect}/Packages~" mv -- "${sect}/Packages~" \ "${sect}/Packages" if ${conf_gzip}; then "${GZIP}" -9c -- \ "${sect}/Packages" \ - >"${sect}/Packages.gz" + 1>"${sect}/Packages.gz" fi feed_sign "${sect}/Packages" - printf '%s\n' "${manifest_entry}" >&3 + printf '%s\n' "${manifest_entry}" 1>&3 else rm -f -- "${sect}/Packages" \ "${sect}/Packages.gz" diff --git a/src/main.sh b/src/main.sh index 5ee0027..17ff091 100644 --- a/src/main.sh +++ b/src/main.sh @@ -107,7 +107,7 @@ _lock() { mkdir -p -- "${base_dir}/.db" lock="${base_dir}/.db/lock" - if ! (set -C; printf '%d\n' "${$}" >"${lock}") 2>/dev/null; then + if ! (set -C; printf '%d\n' "${$}" 1>"${lock}") 2>/dev/null; then error 2 "$(get_msg 'lock_fail')" fi } diff --git a/src/output.sh b/src/output.sh index 0c5be34..94cc32a 100644 --- a/src/output.sh +++ b/src/output.sh @@ -26,8 +26,8 @@ error() local fmt="${2}" shift 2 - printf '%s: Error: ' "${0##*/}" >&2 - printf "${fmt}\n" "${@}" >&2 + printf '%s: Error: ' "${0##*/}" 1>&2 + printf "${fmt}\n" "${@}" 1>&2 # In a subshell, this will have no effect, so the shell's exit status # will be 128+SIGINT. Meh. @@ -40,8 +40,8 @@ warn() local fmt="${1}" shift 1 - printf '%s: Warning: ' "${0##*/}" >&2 - printf "${fmt}\n" "${@}" >&2 + printf '%s: Warning: ' "${0##*/}" 1>&2 + printf "${fmt}\n" "${@}" 1>&2 return 0 } @@ -51,8 +51,8 @@ info() local fmt="${1}" shift 1 - printf '%s: ' "${0##*/}" >&2 - printf "${fmt}\n" "${@}" >&2 + printf '%s: ' "${0##*/}" 1>&2 + printf "${fmt}\n" "${@}" 1>&2 return 0 } diff --git a/src/remove.sh b/src/remove.sh index c6b6f9c..aabb310 100644 --- a/src/remove.sh +++ b/src/remove.sh @@ -54,7 +54,7 @@ remove_packages_from_suite_archplat() file="${file}/${pkg}_${binver}_${arch}_${plat}.opk" mark_pool_garbage "${file}" fi - done <<-EOF + done 0<<-EOF $(db_get_packages "${arch}" "${plat}" "${source}" "${binver}") EOF @@ -80,7 +80,7 @@ remove_source_from_suite() while read -r arch plat; do remove_packages_from_suite_archplat \ "${chan}" "${dist}" "${arch}" "${plat}" "${source}" - done <<-EOF + done 0<<-EOF $(db_get_archplats "${chan}" "${dist}" "${source}") EOF diff --git a/src/suite.sh b/src/suite.sh index e091fd7..73170a1 100644 --- a/src/suite.sh +++ b/src/suite.sh @@ -46,7 +46,7 @@ _suite_copy_source() db_set_binver "${dst_chan}" "${dst_dist}" "${arch}" "${plat}" \ "${source}" "${binver}" db_inc_references "${arch}" "${plat}" "${source}" "${binver}" \ - >/dev/null + 1>/dev/null while read -r size sect pkg; do pool_file="pool/$(hash_name "${source}")/${source}" pool_file="${pool_file}/${pkg}_${binver}" @@ -54,11 +54,11 @@ _suite_copy_source() feed_add_package "${dst_chan}" "${dst_dist}" \ "${arch}" "${plat}" \ "${sect}" "${pkg}" "${size}" "${pool_file}" - done <<-EOF + done 0<<-EOF $(db_get_packages "${arch}" "${plat}" \ "${source}" "${binver}") EOF - done <<-EOF + done 0<<-EOF $(db_get_archplats "${src_chan}" "${src_dist}" "${source}") EOF } |