devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: Kyle Evans <kevans-h+KGxgPPiopAfugRpC6u6w@public.gmane.org>
Cc: David Gibson
	<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] dtdiff: change to POSIX shell
Date: Mon, 5 Feb 2018 13:31:11 -0500	[thread overview]
Message-ID: <20180205183111.GE27582@vapier> (raw)
In-Reply-To: <CACNAnaESOk5Wb+Y1Sy2X3AuCqXFMj1QZ6_CFORTE=AcFRckM4A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

On 01 Feb 2018 22:35, Kyle Evans wrote:
> On Thu, Feb 1, 2018 at 10:14 PM, Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org> wrote:
> > On 10 Jan 2018 16:57, David Gibson wrote:
> >> On Wed, Jan 10, 2018 at 12:47:56AM -0500, Mike Frysinger wrote:
> >> > 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.
> >
> > bash's <(...) only works when the host supports either /dev/fd or /proc/self/fd,
> > so i don't think this is less portable.  /dev/fd also isn't Linux-specific.
> 
> For what it's worth, this isn't completely true. Bash can also use
> FIFOs for process substitution [1]. FreeBSD does not use fdescfs by
> default, but it can be mounted, and using fdescfs for process
> substitution is provided as an optional feature in shells/bash. It
> would be nice to not grow a dependency on fdescfs for dtc. =)
> 
> [1] https://www.gnu.org/software/bash/manual/html_node/Process-Substitution.html

sorry, you're right.  i didn't fully trace the bash source.  that man page
matches the current sources in that either named fifos or /dev/fd are needed.

Simon suggested i just use tempfiles myself.  i had avoided them because the
current method makes it easy to avoid leaks (for whatever reason), but if it
isn't a big deal, that'd be an easy fix.
-mike

TMP1= TMP2=
trap 'rm -f "${TMP1}" "${TMP2}"' EXIT
TMP1=$(mktemp)
TMP2=$(mktemp)

source_and_sort "$1" "${TMP1}"
source_and_sort "$2" "${TMP2}"
diff -u "${TMP1}" "${TMP2}"

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

      parent reply	other threads:[~2018-02-05 18:31 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
     [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 message]

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=20180205183111.GE27582@vapier \
    --to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
    --cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kevans-h+KGxgPPiopAfugRpC6u6w@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).