devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] dtdiff: change to POSIX shell
Date: Wed, 10 Jan 2018 16:57:18 +1100	[thread overview]
Message-ID: <20180110055718.GG19773@umbus.fritz.box> (raw)
In-Reply-To: <20180110054756.23464-1-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]

On Wed, Jan 10, 2018 at 12:47:56AM -0500, Mike Frysinger wrote:
> 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>

Yeah, sorry, replacing a dependency on a complex but widely available
shell with a much more cryptic dependency on a Linux specific feature
does not seem like a win to me.

> ---
>  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"
> +)

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2018-01-10  5:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180110055718.GG19773@umbus.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).