From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 232B31F8C8 for ; Mon, 4 Oct 2021 16:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235293AbhJDQSj (ORCPT ); Mon, 4 Oct 2021 12:18:39 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:58310 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbhJDQSi (ORCPT ); Mon, 4 Oct 2021 12:18:38 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 23872EAE7D; Mon, 4 Oct 2021 12:16:49 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:message-id:mime-version:content-type :content-transfer-encoding; s=sasl; bh=Fc0o+T5u3H6qnF0VAbXOCn3NZ 5TtyfFzNuCN+ExBzUA=; b=katy+9yP7rnF03mpTxQEWDFN5zashs82JMTA8yZ90 VEqwjBk12wiKTjgq5glay9J8sx8IupZo5fc3ykmFUSZUR00kDZXjL/Pk97S/qfco izvhdknvhuhnIXq9hDQeJaMaSrCJTjh0A+WBLWV9HRPAz2jxF7Jrb9RXGO70H4DZ YY= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 1B6B5EAE7C; Mon, 4 Oct 2021 12:16:49 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 82902EAE76; Mon, 4 Oct 2021 12:16:48 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: Taylor Blau , =?utf-8?Q?Ren=C3=A9?= Scharfe , Git List , Jeff King Subject: Re: [PATCH] p5311: handle spaces in wc(1) output References: <87wnmuo7ii.fsf@evledraar.gmail.com> Date: Mon, 04 Oct 2021 09:16:47 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: 79E67E26-252E-11EC-AD14-62A2C8D8090B-77302942!pb-smtp1.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason writes: > This approach seems like a bit of plastering over the real problem. It'= s > fine to use the output of "wc -l" or "wc -c" in the context of the > shell's whitespace handling. That's why in various places we do: Sorry, but I am confused. > test $(wc -l <$file>) =3D 1 > > Or similar, but *don't* put that $() in double-quotes. I.e. we're > relying on the shell's whitespace semantics. > > So isn't it better to just pass this through the shell's own handling > before emitting the data, something like this POC: > > $ stripspace() { var=3D$1; echo $@; }; x=3D$(stripspace " hi" " t= here "); echo "\"$x\"" > "hi there" All of the above are not wrong per-se, but if I read the scaffolding code correctly, the way the output from "wc -c" is used is not via a variable, but test_size_ () { say >&3 "running: $2" if test_eval_ "$2" 3>"$base".result; then test_ok_ "$1" else test_failure_ "$@" fi } test_size () { test_wrapper_ test_size_ "$@" } where "$2" gets the script given to test_size, e.g. test_size "size $title" ' wc -c Of course fixing it up after that in Perl will work just as well, so I > guess this is just an asthetic preference for having the shell handle > the shell's output issues with what's guaranteed to be shell-portable > solutions... :) Meaning we could rewrite aggregation in shell, then we can say we are not making Perl clean up after mess sh creates? I dunno... Thanks.