Hi Josh,

Johannes 'josch' Schauer a écrit le 27/10/2020 à 18:45 :
> Package: libhdf5-openmpi-dev
> Version: 1.10.6+repack-2
> Severity: wishlist
> 
> Hi,
> 
> when installing libhdf5-openmpi-dev in a chroot that doesn't have /proc
> mounted, one will get the following error:
> 
> Setting up libhdf5-openmpi-dev (1.10.6+repack-2) ...
> /var/lib/dpkg/info/libhdf5-openmpi-dev.postinst: line 56: /dev/fd/63: No such 
> file or directory
> dpkg: error processing package libhdf5-openmpi-dev (--configure):
>  installed libhdf5-openmpi-dev package post-installation script subprocess 
> returned error exit status 1
> 
> The problem is, that the postinst script uses the bash-feature to write:
> 
>     while read x; do ... done < <(cmd2 args ...)
> 
> Fortunately, these instances can easily be rewritten as:
> 
>     cmd2 args | while read x; do ... done
> 
> Please consider making this change.

Unfortunately it doesn't work this way. Consider this test script:

$ cat test.sh
#!/bin/bash
declare -A foo bar
while read var; do
  foo["$var"]="$var"
done < <(seq 1 3)
seq 1 3 | while read var; do
  bar["$var"]="$var"
done
echo "foo=${foo[@]}"
echo "bar=${bar[@]}"

$ ./test.sh
foo=3 2 1
bar=

Using a pipe makes variable assignments into the while loop inefficient.
That's why I had to use the process substitution syntax.

Any other idea?

Thanks,

_g.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to