devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dtdiff: change to POSIX shell
@ 2018-01-10  5:47 Mike Frysinger
       [not found] ` <20180110054756.23464-1-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2018-01-10  5:47 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

From: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

This changes from the bash-specific process substitution feature to
reading with pipes.  It relies on /dev/fd or /proc/self/fd existing.

URL: https://crbug.com/756559
Signed-off-by: Mike Frysinger <vapier-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 dtdiff | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/dtdiff b/dtdiff
index 5fa772b0ab62..4d1b71756c2f 100644
--- a/dtdiff
+++ b/dtdiff
@@ -1,8 +1,4 @@
-#! /bin/bash
-
-# This script uses the bash <(...) extension.
-# If you want to change this to work with a generic /bin/sh, make sure
-# you fix that.
+#! /bin/sh
 
 
 DTC=dtc
@@ -35,4 +31,15 @@ if [ $# != 2 ]; then
     exit 1
 fi
 
-diff -u <(source_and_sort "$1") <(source_and_sort "$2")
+for dir in /dev/fd /proc/self/fd; do
+    if [ -d "${dir}" ]; then
+        break
+    fi
+done
+
+source_and_sort "$1" | (
+    # Duplicate current stdin from the first file to fd 3 so we can change fd 0
+    # to the second file.
+    exec 3<&0
+    source_and_sort "$2" | diff -u "${dir}/3" "${dir}/0"
+)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-05 18:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10  5:47 [PATCH] dtdiff: change to POSIX shell Mike Frysinger
     [not found] ` <20180110054756.23464-1-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2018-01-10  5:57   ` David Gibson
     [not found]     ` <20180110055718.GG19773-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-02-02  4:14       ` Mike Frysinger
2018-02-02  4:35         ` Kyle Evans
     [not found]           ` <CACNAnaESOk5Wb+Y1Sy2X3AuCqXFMj1QZ6_CFORTE=AcFRckM4A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-05 18:31             ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).