Re: [PATCH] dtdiff: change to POSIX shell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 01 Feb 2018 22:35, Kyle Evans wrote:
> On Thu, Feb 1, 2018 at 10:14 PM, Mike Frysinger <vapier@xxxxxxxxxx> 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@xxxxxxxxxxxx>
> >>
> >> 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: signature.asc
Description: Digital signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux