summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/0001-tools-mtime.sh-Parse-ls-output-with-read-not-cut.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/patches/0001-tools-mtime.sh-Parse-ls-output-with-read-not-cut.patch b/patches/0001-tools-mtime.sh-Parse-ls-output-with-read-not-cut.patch
new file mode 100644
index 0000000..e24ae4b
--- /dev/null
+++ b/patches/0001-tools-mtime.sh-Parse-ls-output-with-read-not-cut.patch
@@ -0,0 +1,49 @@
+From 0e7634fee188d25165661044c3eb719e333d6ca3 Mon Sep 17 00:00:00 2001
+From: Patrick McDermott <patrick.mcdermott@libiquity.com>
+Date: Thu, 21 Mar 2019 15:58:08 -0400
+Subject: [PATCH] tools/mtime.sh: Parse ls output with read, not cut
+
+cut treats multiple delimiter characters as empty fields, increasing the
+field count an indeterminate amount for fields with whitespace delimiter
+padding. BusyBox's ls outputs:
+
+ -rw-r--r-- 1 1000 1000 1935 Mar 16 16:31 man/opkbuild.1in
+
+cut counts the owner field, not the month, as field 6. And fields 7 and
+8 are empty.
+
+The shell interpreter's field splitting is better suited for this job,
+so just use read.
+---
+ tools/mtime.sh | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/tools/mtime.sh b/tools/mtime.sh
+index c2f9dfa..7207f9e 100755
+--- a/tools/mtime.sh
++++ b/tools/mtime.sh
+@@ -23,14 +23,19 @@ get_mtime()
+ {
+ local file="${1}"
+ shift 1
++ local mode=
++ local links=
++ local owner=
++ local group=
++ local size=
+ local m=
+ local d=
+ local y=
+ local now_m=
+ local now_y=
+
+- read m d y <<-EOF
+- $(LC_ALL=POSIX ls -l "${file}" | cut -d ' ' -f 6-8)
++ read -r mode links owner group size m d y <<-EOF
++ $(LC_ALL=POSIX ls -l "${file}")
+ EOF
+ case "${m}" in
+ 'Jan') m=1;; 'Feb') m=2;; 'Mar') m=3;; 'Apr') m=4;;
+--
+2.1.4
+