From nobody Wed Mar 13 08:09:30 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Tvjps0jnnz5DZpR for ; Wed, 13 Mar 2024 08:09:41 +0000 (UTC) (envelope-from eugen@freebsd.org) Received: from mail.rdtc.ru (mail.rdtc.ru [62.231.190.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tvjpr5S46z4bMP for ; Wed, 13 Mar 2024 08:09:40 +0000 (UTC) (envelope-from eugen@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: by mail.rdtc.ru (RDTC Post Office Server, from userid 1000) id B02BA1CF18; Wed, 13 Mar 2024 15:09:37 +0700 (+07) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [62.231.161.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: egrosbein@rdtc.ru) by mail.rdtc.ru (RDTC Post Office Server) with ESMTPSA id 338661CF2C; Wed, 13 Mar 2024 15:09:36 +0700 (+07) X-Envelope-From: eugen@freebsd.org X-Envelope-To: brooks@freebsd.org Received: from [10.58.0.10] (dadvw [10.58.0.10]) by eg.sd.rdtc.ru (8.17.1/8.17.1) with ESMTPS id 42D89WTV066491 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 13 Mar 2024 15:09:33 +0700 (+07) (envelope-from eugen@freebsd.org) Subject: Re: git: 7f0dc6e2cdfa - main - mkimg(1): process non-seekable output gracefully To: Brooks Davis References: <202403121600.42CG0OKT011953@gitrepo.freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org From: Eugene Grosbein Message-ID: <7ddc5445-3afe-2447-b400-60f21366935f@freebsd.org> Date: Wed, 13 Mar 2024 15:09:30 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_SOFTFAIL,T_DATE_IN_FUTURE_96_Q,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=4.0.0 X-Spam-Report: * 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 T_DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: * date * -1.9 NICE_REPLY_A Looks like a legit reply (A) * -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on eg.sd.rdtc.ru X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:29072, ipnet:62.231.184.0/21, country:RU] X-Rspamd-Queue-Id: 4Tvjpr5S46z4bMP 12.03.2024 23:58, Brooks Davis wrote: [skip] > It seems weird to cache a single member. For that matter, caching > anyting seems like overkill given than format_selected() just returns a > global variable's value. It is a habit. Why not? :-) I do not like calling a method multiple times after an object settled. [skip] >> +#if defined(SPARSE_WRITE) >> + /* >> + * sparse_write() fails if output is not seekable so fail early >> + * not wasting some load unless output format is raw >> + */ >> + if (strcmp("raw", format_name) && >> + lseek(outfd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) >> + errx(EX_USAGE, "%s: output must be seekable", format_name); >> +#endif > > Maybe add a flag for non-seeking formats rather than hardcoding a > strcmp? I thought about it. A change would be much more invasive without real benefits. I believe there will not be any more non-sparse formats other than raw. If there will, we can improve the code later. For now, I prefer keeping the code and the change as simple as possible. Eugene