Comments…
> On Nov 9, 2020, at 7:22 PM, Yousong Zhou <[email protected]> wrote: > > This is mainly to handle stderr message "Broken pipe", "F+P records > in/out" by common pattern "xcat | dd .." > > Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 > Reported-by: Philip Prindeville <[email protected]> > Signed-off-by: Yousong Zhou <[email protected]> > --- > package/base-files/files/lib/upgrade/common.sh | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/package/base-files/files/lib/upgrade/common.sh > b/package/base-files/files/lib/upgrade/common.sh > index e12dfc9678..6c09908ee3 100644 > --- a/package/base-files/files/lib/upgrade/common.sh > +++ b/package/base-files/files/lib/upgrade/common.sh > @@ -94,6 +94,12 @@ get_image() { # <source> [ <command> ] > $cmd <"$from" > } > > +get_image_dd() { > + local from="$1"; shift > + > + ( get_image "$from" | dd "$@" ) 2>&1 | grep -v -E ': Broken pipe| > records (in|out)' Can you through stdout onto another descriptor first, like 3, then move 2 to 1, run the grep, and then after the grep put 3 back onto 1? I don’t like the idea of co-mingling stdout and stderr… Thanks > +} > + > get_magic_word() { > (get_image "$@" | dd bs=2 count=1 | hexdump -v -n 2 -e '1/1 "%02x"') > 2>/dev/null > } _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
