summaryrefslogtreecommitdiffstats
path: root/src/ob-applypatches.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-10-09 21:46:21 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-10-09 21:46:21 (EDT)
commitbf23dece9f63633a751b8c7d6e16f07f5d59071e (patch)
tree3a7f30f2ff5a314a1d71eb70b4f60078c17128a1 /src/ob-applypatches.sh
parent771fee237b55c17a6ac38016f498664a667c6089 (diff)
Replace unsafe/unnecessary ls command in for loop.
Diffstat (limited to 'src/ob-applypatches.sh')
-rw-r--r--src/ob-applypatches.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ob-applypatches.sh b/src/ob-applypatches.sh
index 7b43d41..37a8cc3 100644
--- a/src/ob-applypatches.sh
+++ b/src/ob-applypatches.sh
@@ -41,12 +41,19 @@ apply_patches()
if [ -d '../patches' ]; then
# Iterate over patches ordered alphabetically by name.
- for patch in $(ls -1 '../patches' | sort); do
+ # POSIX.1-2008 says that the results of a pathname expansion shall be
+ # "sorted according to the collating sequence in effect in the current
+ # locale". So for consistent results, we first set a standard locale.
+ orig_lang="${LANG}"
+ LANG='POSIX'
+ for patch in '../patches/'*; do
+ LANG="${orig_lang}"
ob_info "$(ob_get_msg 'applying_patch')" "${patch}"
patch -N -p 1 -u -d 'src' -i "../../patches/${patch}" || \
ob_error "$(ob_get_msg 'cant_apply_patch')" "${patch}"
applied='true'
done
+ LANG="${orig_lang}"
fi
${applied} || ob_info "$(ob_get_msg 'no_patches')"