From owner-freebsd-hackers@freebsd.org Sun Jan 24 12:19:41 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC5A74F9B6A for ; Sun, 24 Jan 2021 12:19:41 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNsWK0Xclz3CBQ; Sun, 24 Jan 2021 12:19:40 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: by mail-wm1-x332.google.com with SMTP id y187so8330026wmd.3; Sun, 24 Jan 2021 04:19:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vxB7sFIhkdFfNASyegI8j5fZfgIskJRC51MEpIRmbBA=; b=dacZbrzlGb4FT8BBTvRaDqhJvckM60roK7MwqkJOCW99h2S6ouYuHFiT32/Kue5cyW zeT2wuVwW/U25GFILMXUlo7uEDvA04wVIBWfhSws2vfKi1i22tcKWuyE2VQZrmWhzKe5 KaGXJUlyQ4psiIzODB1Lp/G3PhVl8IUDFzKsmhuLL9s5F/NYoXe9XDusMRzx+pwI5TrW oQ3viZZ8/S3oeotjZqiPAFiNCRLcxOIQmZErY9+Gt2tZWDLtYR9l6+BoN0Y1Cm0Xt9qH vp6jALRBE6v3oNQHUH88n3nRInfoh0jH2+u6OCiJ+uF3qvSfpQNSQxJcOC4tZOSW8lWL AM2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vxB7sFIhkdFfNASyegI8j5fZfgIskJRC51MEpIRmbBA=; b=AYzH7KhaNnG0Jdp3yZu7cITDiyKJ22ELBu/iHAv1NlsgbFbDbn8QU/n5lHmEmbhdXN DG3rZyQtS8Sk+aO/7oA9ob3VnZMMjHVTX5QWHgOgWhJeHbP3uByXjEi9Wx/Vb0XZCF/j gZ+ZsRTqUZ8nvUITdPJD0vatmXXPZI6iIczBgZea1a9e++4Iadj/6wTtGv+dfhupZJSE b8lCxRmjyJfRff1UyqSre+oJfqESfeZXRkDuMgvJ3euYTvtWhHwWFezidrPBhypc5W1Q 8qz604sFxTCbeleu1hx+ax1T9DTkFQRNUZlX2s652J1zgIIFQ4BDY9CvUyw7c+UeINBi VFLA== X-Gm-Message-State: AOAM5311S0PhDdAcKtEMJgWymhL31Rv89FKxhqy8sSz9EOT0Cnxy7/KQ H9qJnssAg9v40EosjXjrPww= X-Google-Smtp-Source: ABdhPJz5Z5GPSB9eGxsrOUhA1AgtLGKGLG0h4QMnBuo5WBtxvT4ResoOf2VKlRavQFLJikqXsiz/+Q== X-Received: by 2002:a05:600c:230e:: with SMTP id 14mr2173459wmo.161.1611490779526; Sun, 24 Jan 2021 04:19:39 -0800 (PST) Received: from debian.vlc ([170.253.51.130]) by smtp.gmail.com with ESMTPSA id n16sm18680871wrj.26.2021.01.24.04.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Jan 2021 04:19:38 -0800 (PST) From: Alejandro Colomar To: Bernhard Voelker , Alex Henrie , Christian Groessler , =?UTF-8?q?P=C3=A1draig=20Brady?= , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton Cc: Alejandro Colomar , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org Subject: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout Date: Sun, 24 Jan 2021 13:18:46 +0100 Message-Id: <20210124121845.38293-1-alx.manpages@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4DNsWK0Xclz3CBQ X-Spamd-Bar: +++++++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=dacZbrzl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of alxmanpages@gmail.com designates 2a00:1450:4864:20::332 as permitted sender) smtp.mailfrom=alxmanpages@gmail.com X-Spamd-Result: default: False [7.35 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GREYLIST(0.00)[pass,meta]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FREEMAIL_TO(0.00)[bernhard-voelker.de,gmail.com,groessler.org,draigbrady.com,gnu.org,25thandclement.com,unix-ag.uni-kl.de]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::332:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RECEIVED_SPAMHAUS_PBL(0.00)[170.253.51.130:received]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.85)[0.847]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::332:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000]; RCPT_COUNT_TWELVE(0.00)[18]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::332:from]; FREEMAIL_CC(0.00)[gmail.com,mykolab.com,openbsd.org,freebsd.org,vger.kernel.org,clockworksquid.com,nuxi.nl]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-Spam: Yes X-Mailman-Approved-At: Sun, 24 Jan 2021 13:12:08 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 12:19:42 -0000 This is useful for using tee to just write to a file, at the end of a pipeline, without having to redirect to /dev/null Example: echo 'foo' | sudo tee -q /etc/foo; is equivalent to the old (and ugly) echo 'foo' | sudo tee /etc/foo >/dev/null; Signed-off-by: Alejandro Colomar --- Resend as v3. I forgot to change the subject line. Everything else is the same as in <20210123145356.53962-1-alx.manpages@gmail.com>. src/tee.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/tee.c b/src/tee.c index c81faea91..1dfa92cf2 100644 --- a/src/tee.c +++ b/src/tee.c @@ -45,6 +45,9 @@ static bool append; /* If true, ignore interrupts. */ static bool ignore_interrupts; +/* Don't write to stdout */ +static bool quiet; + enum output_error { output_error_sigpipe, /* traditional behavior, sigpipe enabled. */ @@ -61,6 +64,8 @@ static struct option const long_options[] = {"append", no_argument, NULL, 'a'}, {"ignore-interrupts", no_argument, NULL, 'i'}, {"output-error", optional_argument, NULL, 'p'}, + {"quiet", no_argument, NULL, 'q'}, + {"silent", no_argument, NULL, 'q'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} @@ -93,6 +98,7 @@ Copy standard input to each FILE, and also to standard output.\n\ "), stdout); fputs (_("\ -p diagnose errors writing to non pipes\n\ + -q, --quiet, --silent don't write to standard output\n\ --output-error[=MODE] set behavior on write error. See MODE below\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -130,8 +136,9 @@ main (int argc, char **argv) append = false; ignore_interrupts = false; + quiet = false; - while ((optc = getopt_long (argc, argv, "aip", long_options, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "aipq", long_options, NULL)) != -1) { switch (optc) { @@ -151,6 +158,10 @@ main (int argc, char **argv) output_error = output_error_warn_nopipe; break; + case 'q': + quiet = true; + break; + case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); @@ -235,8 +246,9 @@ tee_files (int nfiles, char **files) break; /* Write to all NFILES + 1 descriptors. - Standard output is the first one. */ - for (i = 0; i <= nfiles; i++) + Standard output is the first one. + If 'quiet' is true, write to descriptors 1 and above (omit stdout) */ + for (i = quiet; i <= nfiles; i++) if (descriptors[i] && fwrite (buffer, bytes_read, 1, descriptors[i]) != 1) { -- 2.30.0 From owner-freebsd-hackers@freebsd.org Sun Jan 24 16:12:38 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 632684D1435 for ; Sun, 24 Jan 2021 16:12:38 +0000 (UTC) (envelope-from sega01@go-beyond.org) Received: from haggis.mythic-beasts.com (haggis.mythic-beasts.com [IPv6:2a00:1098:0:86:1000:0:2:1]) (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 4DNyh52TXBz3l5Z; Sun, 24 Jan 2021 16:12:36 +0000 (UTC) (envelope-from sega01@go-beyond.org) Received: from [174.126.29.109] (port=59666 helo=localhost) by haggis.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1l3hza-0007wT-1G; Sun, 24 Jan 2021 16:11:59 +0000 Date: Sun, 24 Jan 2021 16:11:34 +0000 From: Teran McKinney To: Alejandro Colomar Cc: Bernhard Voelker , Alex Henrie , Christian Groessler , P??draig Brady , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout Message-ID: References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210124121845.38293-1-alx.manpages@gmail.com> X-BlackCat-Spam-Score: 4 X-Spam-Status: No, score=0.4 X-Rspamd-Queue-Id: 4DNyh52TXBz3l5Z X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of sega01@go-beyond.org designates 2a00:1098:0:86:1000:0:2:1 as permitted sender) smtp.mailfrom=sega01@go-beyond.org X-Spamd-Result: default: False [-1.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1098::86:1000:0:2:1]; RCVD_IN_DNSWL_MED(-0.20)[2a00:1098:0:86:1000:0:2:1:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1098:0:86:1000:0:2:1:from]; ASN(0.00)[asn:44684, ipnet:2a00:1098::/32, country:GB]; R_DKIM_NA(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[go-beyond.org]; SPAMHAUS_ZRD(0.00)[2a00:1098:0:86:1000:0:2:1:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[18]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[bernhard-voelker.de,gmail.com,groessler.org,draigbrady.com,gnu.org,25thandclement.com,unix-ag.uni-kl.de,mykolab.com,openbsd.org,freebsd.org,vger.kernel.org,clockworksquid.com,nuxi.nl]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; RCVD_COUNT_TWO(0.00)[2] X-Mailman-Approved-At: Mon, 25 Jan 2021 06:20:00 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 16:12:40 -0000 On 2021-01-24 13-18-46 , Alejandro Colomar wrote: > This is useful for using tee to just write to a file, > at the end of a pipeline, > without having to redirect to /dev/null > > Example: > > echo 'foo' | sudo tee -q /etc/foo; > > is equivalent to the old (and ugly) > > echo 'foo' | sudo tee /etc/foo >/dev/null; > > Signed-off-by: Alejandro Colomar > --- > > Resend as v3. I forgot to change the subject line. > Everything else is the same as in > <20210123145356.53962-1-alx.manpages@gmail.com>. > > src/tee.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/src/tee.c b/src/tee.c > index c81faea91..1dfa92cf2 100644 > --- a/src/tee.c > +++ b/src/tee.c > @@ -45,6 +45,9 @@ static bool append; > /* If true, ignore interrupts. */ > static bool ignore_interrupts; > > +/* Don't write to stdout */ > +static bool quiet; > + > enum output_error > { > output_error_sigpipe, /* traditional behavior, sigpipe enabled. */ > @@ -61,6 +64,8 @@ static struct option const long_options[] = > {"append", no_argument, NULL, 'a'}, > {"ignore-interrupts", no_argument, NULL, 'i'}, > {"output-error", optional_argument, NULL, 'p'}, > + {"quiet", no_argument, NULL, 'q'}, > + {"silent", no_argument, NULL, 'q'}, > {GETOPT_HELP_OPTION_DECL}, > {GETOPT_VERSION_OPTION_DECL}, > {NULL, 0, NULL, 0} > @@ -93,6 +98,7 @@ Copy standard input to each FILE, and also to standard output.\n\ > "), stdout); > fputs (_("\ > -p diagnose errors writing to non pipes\n\ > + -q, --quiet, --silent don't write to standard output\n\ > --output-error[=MODE] set behavior on write error. See MODE below\n\ > "), stdout); > fputs (HELP_OPTION_DESCRIPTION, stdout); > @@ -130,8 +136,9 @@ main (int argc, char **argv) > > append = false; > ignore_interrupts = false; > + quiet = false; > > - while ((optc = getopt_long (argc, argv, "aip", long_options, NULL)) != -1) > + while ((optc = getopt_long (argc, argv, "aipq", long_options, NULL)) != -1) > { > switch (optc) > { > @@ -151,6 +158,10 @@ main (int argc, char **argv) > output_error = output_error_warn_nopipe; > break; > > + case 'q': > + quiet = true; > + break; > + > case_GETOPT_HELP_CHAR; > > case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); > @@ -235,8 +246,9 @@ tee_files (int nfiles, char **files) > break; > > /* Write to all NFILES + 1 descriptors. > - Standard output is the first one. */ > - for (i = 0; i <= nfiles; i++) > + Standard output is the first one. > + If 'quiet' is true, write to descriptors 1 and above (omit stdout) */ > + for (i = quiet; i <= nfiles; i++) > if (descriptors[i] > && fwrite (buffer, bytes_read, 1, descriptors[i]) != 1) > { > -- > 2.30.0 > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" Hi, Why is this a thing? The point of tee is to write a file *and* to stdout. If you don't want use that, use: `> file` To overwrite. Or `>> file` To append. I guess the only reason this would be used is if you wanted to write multiple files at the same time, which tee supports. -Teran From owner-freebsd-hackers@freebsd.org Sun Jan 24 16:22:17 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1131F4D1AA7 for ; Sun, 24 Jan 2021 16:22:17 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNyvD6nlvz3lgs; Sun, 24 Jan 2021 16:22:16 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: by mail-wr1-x42a.google.com with SMTP id r9so3220407wro.9; Sun, 24 Jan 2021 08:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Tge0WSYAniqWcuAqFQnVZg2cTSD1QDk4FhLRTYjLR/s=; b=Hw1B4e8N4Fe0pkBG5w5A00v/NQXUIeI5wICQUupXjU9s/3kwC+Pv5gXEam5e32vHW6 RLBEAe4jtzdzkOFlxfuYteJKaUKFx9CI0mK6Ml8akTeGMn8N4jfVdMUt3kOAOccXhkq8 ZDNYIrP6CAMN8Z7Dd8k2f3Z7oWA1YxvbaW/UlDlhMZZ/MOttbHETOMY4e18Hg4hmt8aN Ka/g94XafB6BnRJsMrOHIaWEMz/Uv+9JHFxCJoIMmaBJ841cG/uQyguir6pPlzZ1VfQe FpjM/vhpzicQmcN/2NPlEZj4yZ95k3JVhOZh0+vG0xU7fhI3A88zMmMIq7QN9eGacVKg s3HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Tge0WSYAniqWcuAqFQnVZg2cTSD1QDk4FhLRTYjLR/s=; b=MrYO5ORYLb9RRcxOH4n7voKRZWCWNc//8nMEmOGuM3mbBs5WWrFMGGvc1xxRnBV1da e2M9EA0IF/hBB27GMp3GbWIlo0Cr+XCePquONls/HGvCyES90Rpak1UACx3iQ5bDt7p4 ZqS4ORKlXuvtozQ/xr+mNxMdEElacItXK0rC0ADsTYAoQxdugxe8NuO8HrXBix3+YhA7 ty2zkyWpJ8Ah8lMV+E7/BvQffPzYanNXpkrWoz0Wp7XJiyVhDsAnVGldNoWyc8uJCDAT LekBpH2pestNKL8iprwmw7jWxMz0T2RzuPdi0Hb/436BMgIfiSVXy2WgZK7CR+xqQgmk Ab7g== X-Gm-Message-State: AOAM532+3mMB2us+BSr3Yb0B3+qoTxbMkn4Nllol6E3PN2/loMAEf1Yh t7eoB5M6x9ROBJOr3uJGUbdbVkpH4PE= X-Google-Smtp-Source: ABdhPJzah+Qs57CJ90w5Xcthn9uI2Ga35mInii4uiYXL7Lh/wrq5xV+wEAkXzh1Uo+K4kvxPo1y74g== X-Received: by 2002:adf:ef49:: with SMTP id c9mr13294309wrp.172.1611505335449; Sun, 24 Jan 2021 08:22:15 -0800 (PST) Received: from [192.168.1.143] ([170.253.51.130]) by smtp.gmail.com with UTF8SMTPSA id s24sm18380903wmh.22.2021.01.24.08.22.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Jan 2021 08:22:12 -0800 (PST) Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: Teran McKinney Cc: Bernhard Voelker , Alex Henrie , Christian Groessler , P??draig Brady , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> From: "Alejandro Colomar (man-pages)" Message-ID: Date: Sun, 24 Jan 2021 17:22:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DNyvD6nlvz3lgs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 09:39:11 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 16:22:17 -0000 On 1/24/21 5:11 PM, Teran McKinney wrote: > On 2021-01-24 13-18-46 , Alejandro Colomar wrote: >> This is useful for using tee to just write to a file, >> at the end of a pipeline, >> without having to redirect to /dev/null >> >> Example: >> >> echo 'foo' | sudo tee -q /etc/foo; >> >> is equivalent to the old (and ugly) >> >> echo 'foo' | sudo tee /etc/foo >/dev/null; >> >> Signed-off-by: Alejandro Colomar >> --- [...] > > Hi, > > Why is this a thing? > > The point of tee is to write a file *and* to stdout. If you don't want use that, use: > > `> file` > > To overwrite. > > Or > > `>> file` > > To append. > > I guess the only reason this would be used is if you wanted to write > multiple files at the same time, which tee supports. > > -Teran > Hi Teran, The rationale is that protected files can't be modified with '>', unless you give superuser rights to the whole shell. If you want fine-grained control over the rights of the tools in the pipeline, you'll come to times where you want the write step to be the only one to have those, and you can't [sudo >] nor [sudo >>], which by the way I would consider an even better solution, but which would require much more work, and designing a completely new idiom for it, which would face much more objection too. Regards, Alex -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/ From owner-freebsd-hackers@freebsd.org Sun Jan 24 17:52:02 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60F3F4D4211 for ; Sun, 24 Jan 2021 17:52:02 +0000 (UTC) (envelope-from otto@drijf.net) Received: from clue.drijf.net (clue.drijf.net [94.142.244.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP0tn1190z3sCs; Sun, 24 Jan 2021 17:52:00 +0000 (UTC) (envelope-from otto@drijf.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=drijf.net; s=default; t=1611510710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6R9cxIIPJyVqbiYIwH3/tA/8c+6DhQciQFD9pBBqCaw=; b=dbWXWjPLe6u3ZvDorGvYtUhIlXOFmBV019x+6pShnH8uaVO1hK0XStDOnaXRQGDfMYb//m 7l4NV5JrDuD04Ih/HKSxhVZ+EAlMmse+MCtI+AQ2L6Kuq0tAuVB8GZfipy82zQzWPFJN5G h56U6zHDVb0LCPd4JbJn+wIQaKHo9y4= Received: from clue.drijf.net (clue.drijf.net [94.142.244.34]) by mx1.drijf.net (OpenSMTPD) with ESMTPSA id 30a2f150 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sun, 24 Jan 2021 18:51:50 +0100 (CET) Date: Sun, 24 Jan 2021 18:51:48 +0100 From: Otto Moerbeek To: Alejandro Colomar Cc: Bernhard Voelker , Alex Henrie , Christian Groessler , =?iso-8859-1?Q?P=E1draig?= Brady , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout Message-ID: References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210124121845.38293-1-alx.manpages@gmail.com> X-Rspamd-Queue-Id: 4DP0tn1190z3sCs X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=fail (body hash did not verify) header.d=drijf.net header.s=default header.b=dbWXWjPL; dmarc=pass (policy=none) header.from=drijf.net; spf=pass (mx1.freebsd.org: domain of otto@drijf.net designates 94.142.244.34 as permitted sender) smtp.mailfrom=otto@drijf.net X-Spamd-Result: default: False [-0.90 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_DKIM_REJECT(0.00)[drijf.net:s=default]; R_SPF_ALLOW(-0.20)[+mx]; DKIM_TRACE(0.00)[drijf.net:-]; DMARC_POLICY_ALLOW(0.00)[drijf.net,none]; DMARC_POLICY_ALLOW_WITH_FAILURES(-0.50)[]; RCVD_COUNT_ONE(0.00)[1]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[94.142.244.34:from]; ASN(0.00)[asn:8283, ipnet:94.142.240.0/21, country:NL]; ONCE_RECEIVED(0.10)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.30)[0.304]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[94.142.244.34:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[18]; FREEMAIL_CC(0.00)[bernhard-voelker.de,gmail.com,groessler.org,draigbrady.com,gnu.org,25thandclement.com,unix-ag.uni-kl.de,mykolab.com,openbsd.org,freebsd.org,vger.kernel.org,clockworksquid.com,nuxi.nl]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-Mailman-Approved-At: Mon, 25 Jan 2021 09:39:27 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 17:52:02 -0000 On Sun, Jan 24, 2021 at 01:18:46PM +0100, Alejandro Colomar wrote: > This is useful for using tee to just write to a file, > at the end of a pipeline, > without having to redirect to /dev/null > > Example: > > echo 'foo' | sudo tee -q /etc/foo; > > is equivalent to the old (and ugly) You keep repeating "ugly" as the reason you are wanting this. I consider adding special options to command to solve an imagined issue that can be solved with a general concept like redirection ugly. Please stop pushing your diff to this list. So far nobody showed any interest. -Otto > > echo 'foo' | sudo tee /etc/foo >/dev/null; > > Signed-off-by: Alejandro Colomar > --- > > Resend as v3. I forgot to change the subject line. > Everything else is the same as in > <20210123145356.53962-1-alx.manpages@gmail.com>. > > src/tee.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/src/tee.c b/src/tee.c > index c81faea91..1dfa92cf2 100644 > --- a/src/tee.c > +++ b/src/tee.c > @@ -45,6 +45,9 @@ static bool append; > /* If true, ignore interrupts. */ > static bool ignore_interrupts; > > +/* Don't write to stdout */ > +static bool quiet; > + > enum output_error > { > output_error_sigpipe, /* traditional behavior, sigpipe enabled. */ > @@ -61,6 +64,8 @@ static struct option const long_options[] = > {"append", no_argument, NULL, 'a'}, > {"ignore-interrupts", no_argument, NULL, 'i'}, > {"output-error", optional_argument, NULL, 'p'}, > + {"quiet", no_argument, NULL, 'q'}, > + {"silent", no_argument, NULL, 'q'}, > {GETOPT_HELP_OPTION_DECL}, > {GETOPT_VERSION_OPTION_DECL}, > {NULL, 0, NULL, 0} > @@ -93,6 +98,7 @@ Copy standard input to each FILE, and also to standard output.\n\ > "), stdout); > fputs (_("\ > -p diagnose errors writing to non pipes\n\ > + -q, --quiet, --silent don't write to standard output\n\ > --output-error[=MODE] set behavior on write error. See MODE below\n\ > "), stdout); > fputs (HELP_OPTION_DESCRIPTION, stdout); > @@ -130,8 +136,9 @@ main (int argc, char **argv) > > append = false; > ignore_interrupts = false; > + quiet = false; > > - while ((optc = getopt_long (argc, argv, "aip", long_options, NULL)) != -1) > + while ((optc = getopt_long (argc, argv, "aipq", long_options, NULL)) != -1) > { > switch (optc) > { > @@ -151,6 +158,10 @@ main (int argc, char **argv) > output_error = output_error_warn_nopipe; > break; > > + case 'q': > + quiet = true; > + break; > + > case_GETOPT_HELP_CHAR; > > case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); > @@ -235,8 +246,9 @@ tee_files (int nfiles, char **files) > break; > > /* Write to all NFILES + 1 descriptors. > - Standard output is the first one. */ > - for (i = 0; i <= nfiles; i++) > + Standard output is the first one. > + If 'quiet' is true, write to descriptors 1 and above (omit stdout) */ > + for (i = quiet; i <= nfiles; i++) > if (descriptors[i] > && fwrite (buffer, bytes_read, 1, descriptors[i]) != 1) > { > -- > 2.30.0 > From owner-freebsd-hackers@freebsd.org Sun Jan 24 17:58:31 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 105954D448B for ; Sun, 24 Jan 2021 17:58:31 +0000 (UTC) (envelope-from deraadt@openbsd.org) Received: from cvs.openbsd.org (cvs.openbsd.org [199.185.137.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "cvs.openbsd.org", Issuer "cvs.openbsd.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP12G5PBXz3sQS; Sun, 24 Jan 2021 17:58:30 +0000 (UTC) (envelope-from deraadt@openbsd.org) Received: from cvs.openbsd.org (localhost [127.0.0.1]) by cvs.openbsd.org (OpenSMTPD) with ESMTP id e1ff6703; Sun, 24 Jan 2021 10:58:28 -0700 (MST) From: "Theo de Raadt" To: Otto Moerbeek cc: Alejandro Colomar , Bernhard Voelker , Alex Henrie , Christian Groessler , =?iso-8859-1?Q?P=E1draig?= Brady , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout In-reply-to: References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> Comments: In-reply-to Otto Moerbeek message dated "Sun, 24 Jan 2021 18:51:48 +0100." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <61963.1611511108.1@cvs.openbsd.org> Date: Sun, 24 Jan 2021 10:58:28 -0700 Message-ID: <80701.1611511108@cvs.openbsd.org> X-Rspamd-Queue-Id: 4DP12G5PBXz3sQS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 09:40:23 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 17:58:31 -0000 Otto Moerbeek wrote: > On Sun, Jan 24, 2021 at 01:18:46PM +0100, Alejandro Colomar wrote: > > > This is useful for using tee to just write to a file, > > at the end of a pipeline, > > without having to redirect to /dev/null > > > > Example: > > > > echo 'foo' | sudo tee -q /etc/foo; > > > > is equivalent to the old (and ugly) > > You keep repeating "ugly" as the reason you are wanting this. > > I consider adding special options to command to solve an imagined > issue that can be solved with a general concept like redirection ugly. > Please stop pushing your diff to this list. So far nobody showed any > interest. I also see ZERO reason for this change. This change will encourage the creation of non-portable scripts, which harms backwards compatibility and portability, while increasing the cognitive cost of building software in a simple and useable command ecosystem. From owner-freebsd-hackers@freebsd.org Sun Jan 24 20:01:58 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8F044D8A13 for ; Sun, 24 Jan 2021 20:01:58 +0000 (UTC) (envelope-from alexhenrie24@gmail.com) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP3mk55R3z4WhL; Sun, 24 Jan 2021 20:01:58 +0000 (UTC) (envelope-from alexhenrie24@gmail.com) Received: by mail-lj1-x232.google.com with SMTP id b10so12763073ljp.6; Sun, 24 Jan 2021 12:01:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FMRNPU76m9SCxoil+gI3XXtJmPRmnQ29SdbiUNuTwYA=; b=lTkge773O0w5SrCSjVHmj9thNU1felBxLTJlpRQnnjV+wBdicdpp6fxWFjbGozHYF5 15mA+jKpeh0xkQvRCgakEBDfFJLBjzYzDkAYkZX9ykbdn5d/EdUi7bUoCcgWD+pM+LZW BLclJeeT+JtRHP7l3uCcNOGIB8X3nvfs0CEf8xOgkWYr3opm1J4qNg2x+NRiuDIpNzup QGNavPMcHGFENkKtCB1mDOKZLlufkfLOk40cwP1cp23Z71XY16jOaVJmdjd7wj9VqaGy LLD42Z22/+lHjVwxrHDxFsi0VhqczpgB2AMYeeOyhwHiO8ZsJ7bow3lxhWFqQD1I5Q1m qGTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FMRNPU76m9SCxoil+gI3XXtJmPRmnQ29SdbiUNuTwYA=; b=KBOmhRRJzG3uQwgCtvV+1XSkRhr9NFgnh/P09d5KacPMd1NLYpx2vHNymX/WwNXEpG gMs0GhyqKZ3kVG6D74sCvR1zFuegxzs8NZXSaa/RPkl3CN2UG+h/j/rEPK79kWI8QGre 219LNJ3FdTX6Rw1Br1sx2s1FWVR1XGnVQRbaPzFwpHmFTt3Z+orNmj8m2W514SyD2J5F 4h8Qdu92A+2gaIfNVL61zq4UmncONSilUNuowIKtK/LuKfmGyiljhtiNghK5DA5HEjB9 j3UPOMLWWvrHjulfhSe8QHjIqCaOJTvh1zTOo0WAeddHLd7doGX8y8UGhZmvsR10a3hk 47gA== X-Gm-Message-State: AOAM531VOEjzFuJ2ZYY96O/bTWp05wSysMD4mR8qdBpuLPIK8LOCCDTG S2orDY1Fe9n82NOVv0KsB4g22zMPsKbrzQyTrrcIYrwZBvqP6A== X-Google-Smtp-Source: ABdhPJy4zsV5waxaWI4RLQcOBucztiJuT2X2exTGDl09P5UhI8V7jjaVzFTzkX2/zQjxsCAbG3pacg9cZwwUzHsuEEc= X-Received: by 2002:a2e:8044:: with SMTP id p4mr76238ljg.464.1611518516604; Sun, 24 Jan 2021 12:01:56 -0800 (PST) MIME-Version: 1.0 References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> In-Reply-To: From: Alex Henrie Date: Sun, 24 Jan 2021 13:01:45 -0700 Message-ID: Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: Otto Moerbeek Cc: Alejandro Colomar , Bernhard Voelker , Christian Groessler , =?UTF-8?Q?P=C3=A1draig_Brady?= , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org, Roman Czyborra , Jim Meyering Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DP3mk55R3z4WhL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 09:50:15 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 20:01:58 -0000 On Sun, Jan 24, 2021 at 10:51 AM Otto Moerbeek wrote: > > Please stop pushing your diff to this list. So far nobody showed any > interest. I am definitely interested. Bernhard Voelker seemed to express interest as well, conditional on -q being added to POSIX first.[1] Also, a --quiet flag was proposed back in 2001 by Roman Czyborra [2] and Jim Meyering expressed support for the idea.[3] -Alex [1] https://lists.gnu.org/archive/html/coreutils/2021-01/msg00043.html [2] https://lists.gnu.org/archive/html/bug-sh-utils/2001-05/msg00024.html [3] https://lists.gnu.org/archive/html/bug-sh-utils/2001-05/msg00039.html From owner-freebsd-hackers@freebsd.org Sun Jan 24 20:22:29 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7D394D901E for ; Sun, 24 Jan 2021 20:22:29 +0000 (UTC) (envelope-from otto@drijf.net) Received: from clue.drijf.net (clue.drijf.net [94.142.244.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP4DP31zNz4XSg; Sun, 24 Jan 2021 20:22:28 +0000 (UTC) (envelope-from otto@drijf.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=drijf.net; s=default; t=1611519746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Vwjv4R2NO6n+x65BqIJbFbF4BI06IGFsIYzBvIg/kPA=; b=jqbF4zpM0lbpgwmzloee5Om2LKlK1cJ5NClcD8oxGLz9uOkEN8kpmW7Kbh7RXmBcjZwpgh eOh38RhbVSk7D6Qg9B2kunkYtwbdUhOgdFynS4gIfGx8rdmpX0ghnEzM++JYw9wDe++5bt Cm6Euhi8fygMXfkGDGkiyt3dbgCClKg= Received: from clue.drijf.net (clue.drijf.net [94.142.244.34]) by mx1.drijf.net (OpenSMTPD) with ESMTPSA id 3399abc6 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sun, 24 Jan 2021 21:22:26 +0100 (CET) Date: Sun, 24 Jan 2021 21:22:24 +0100 From: Otto Moerbeek To: Alex Henrie Cc: Alejandro Colomar , Bernhard Voelker , Christian Groessler , =?iso-8859-1?Q?P=E1draig?= Brady , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org, Roman Czyborra , Jim Meyering Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout Message-ID: References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4DP4DP31zNz4XSg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 09:50:28 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 20:22:29 -0000 On Sun, Jan 24, 2021 at 01:01:45PM -0700, Alex Henrie wrote: > On Sun, Jan 24, 2021 at 10:51 AM Otto Moerbeek wrote: > > > > Please stop pushing your diff to this list. So far nobody showed any > > interest. > > I am definitely interested. Bernhard Voelker seemed to express > interest as well, conditional on -q being added to POSIX first.[1] > Also, a --quiet flag was proposed back in 2001 by Roman Czyborra [2] > and Jim Meyering expressed support for the idea.[3] > > -Alex > > [1] https://lists.gnu.org/archive/html/coreutils/2021-01/msg00043.html > [2] https://lists.gnu.org/archive/html/bug-sh-utils/2001-05/msg00024.html > [3] https://lists.gnu.org/archive/html/bug-sh-utils/2001-05/msg00039.html "This list" is the OpenBSD tech list, sorry I did leave out this context info. -Otto From owner-freebsd-hackers@freebsd.org Mon Jan 25 04:04:41 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A459E4E76ED for ; Mon, 25 Jan 2021 04:04:41 +0000 (UTC) (envelope-from mail@bernhard-voelker.de) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DPGTj1zWGz51nM; Mon, 25 Jan 2021 04:04:40 +0000 (UTC) (envelope-from mail@bernhard-voelker.de) Received: from [192.168.101.10] ([91.1.218.73]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MLyzP-1lLgyE3im9-00HyJy; Mon, 25 Jan 2021 05:03:52 +0100 Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: Alex Henrie , Otto Moerbeek , Coreutils Cc: Alejandro Colomar , Fabrice BAUZAC , juli@clockworksquid.com, Jeffrey Walton , freebsd-hackers@freebsd.org, William Ahern , Roman Czyborra , oshogbo@freebsd.org, tech@openbsd.org, Christian Groessler , linux-api@vger.kernel.org, Michael Kerrisk , ed@nuxi.nl, Eric Pruitt References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> From: Bernhard Voelker Message-ID: Date: Mon, 25 Jan 2021 05:03:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------74CEB4541933A37E03B2ADF5" Content-Language: en-US X-Provags-ID: V03:K1:P2S9pVtutlLQ03qT1MPiR6EDFeTNKQRyohtlGPETSIAMv57JQGZ 2QGkYpON2mkWjqMEN5QVC733wdyuuffPHU+GKsifLXn/E/NQG4PCcv5WDjXPkkAtmPvhhd/ L0kLqDn3FSk/KKkvehVQ2ji/wjsrKljjgKECFlKNYBGApb7w5jkvP7irwSR1bw0zY6K86eM xf8X6rAkSmIaJMy0KgQBg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:0lam23VJN2o=:VopTXESue8fsvN1GXUGFuw y3ZGdxwZ2fWud6Cl6G9WqIk8dPSTbdqNrB8EROAV5zI0rFIRkrVLzoLG92l0seISxduOv2KfI xUkV+6WlFvIDlADfH6QzKEb41xEPJ9kxU1id/G50TTzs8BKclQEx4x/NUox3F8wreOdFxoaiY UW23rCG4jUxjoZQqtBvYMNOU/vPmWTYjCiakBUaueOhajFgNGrZrQ5+Z96oZ7/2wf0l20Pu9h XTHiL3sMbDr8gfEF0P991DV/rTpjBSelSP4+3h8PlQYILNZkR7t6jZpVWvNtQOvFIh6t7ZRAT T3O170S7kv8/KyuIz7yxm1tExP/Iw7adNz9GCqJxsSGzTH4geu0AIQ563k5SfJpooUZU0gh5V kZlhe4gLyN0hW6ro16vRS0cvzKpi0G2va0e75QQKcP0aDUPLu7+leczEExzYORfPSJ1W9Ulqc 4wzPhFnpag== X-Rspamd-Queue-Id: 4DPGTj1zWGz51nM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 11:02:33 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 04:04:41 -0000 This is a multi-part message in MIME format. --------------74CEB4541933A37E03B2ADF5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 1/24/21 9:01 PM, Alex Henrie wrote: > I am definitely interested. Bernhard Voelker seemed to express > interest as well, conditional on -q being added to POSIX first.[1] Just to clarify: I'm not as enthusiastic to add that option as it may have sounded. Let me put it like this: if -q once gets standardized by POSIX, then we'd take it over in the GNU tee implementation. Let me summarize so far: The suggestion is to solve the problem to save some data coming from a pipe as a different user. There are at least those known solutions: - use > or >> redirection. - use dd(1) I have the impression that a home for this feature was searched in any tool, and as tee(1) already knew how to write to a file, had the "append" feature, and is often used in pipes, it was tempting to add it there. But looking deeper, --quiet doesn't seem to fit well into 'tee'. It even contradicts to the title line in the man page: "read from standard input and write to standard output and files" An off-tech argument: ask a local plumber if he'd would ever use a tee piece instead of a pipe end piece. I guess he would only if he wouldn't have anything else at hand. A word to the proposed patch: what should happen, if the user does not give a file? A | B | tee -q The patch just silently ignored that situation which feels wrong. Therefore, adding a feature which does not really fit is wrong, and contradicts the one-tool-for-one-purpose UNIX philosophy. OTOH I understand that there's a little gap in the tool landscape. Astonishingly, there doesn't seem to exist a trivial tool to redirect from standard input (or any other input file descriptor) to a file. I wrote such a little tool in the attached: $ src/sink --help Usage: src/sink [OPTION]... FILE Copy input stream to FILE. Mandatory arguments to long options are mandatory for short options too. -a, --append append to the given FILE, do not overwrite -c, --create ensure to create FILE, error if exists -i, --input-stream=FD read from stream FD instead of standard input The default input stream number FD is 0, representing the standard input. This allows not only to copy data from standard input, but from any file descriptor open for reading. It also allows control over how the output file will be opened (e.g. with O_CREAT|E_EXCL). The OPs case would look like: echo 'foo' | sudo sink /etc/foo or echo 'foo' | sudo sink -a /etc/foo # append. or echo 'foo' | sudo sink -c /etc/foo # ensure creation of the file. I'm not sure if this will ever be considered for inclusion - I just did it "for fun". ;-) Have a nice day, Berny --------------74CEB4541933A37E03B2ADF5 Content-Type: text/x-patch; charset=UTF-8; name="0001-sink-add-new-program.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-sink-add-new-program.patch" >From 68473fb37ccfd65473ac186db4bd3bcc29560a40 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Mon, 25 Jan 2021 04:05:44 +0100 Subject: [PATCH] sink: add new program * man/sink.x: Add file. * src/sink.c: Likewise. * AUTHORS (sink): Add entry. * NEWS (New programs): Likewise. * man/.gitignore (sink.1): Likewise. * man/local.mk (man/sink.1): Likewise. * po/POTFILES.in (src/sink.c): Likewise. * src/.gitignore (sink): Likewise. * README: Add the new tool to the list of programs. * build-aux/gen-lists-of-programs.sh (normal_progs): Likewise. * scripts/git-hooks/commit-msg (valid): Likewise. * doc/coreutils.texi (sink invocation): Document the tool. * tests/misc/sink.sh: Add a test. * tests/local.mk (all_tests): Reference it. * tests/misc/help-version.sh (sink_setup): Add test setup snippet. --- AUTHORS | 1 + NEWS | 4 + README | 6 +- build-aux/gen-lists-of-programs.sh | 1 + doc/coreutils.texi | 87 +++++++++++- man/.gitignore | 1 + man/local.mk | 1 + man/sink.x | 6 + po/POTFILES.in | 1 + scripts/git-hooks/commit-msg | 2 +- src/.gitignore | 1 + src/sink.c | 205 +++++++++++++++++++++++++++++ tests/local.mk | 1 + tests/misc/help-version.sh | 1 + tests/misc/sink.sh | 146 ++++++++++++++++++++ 15 files changed, 456 insertions(+), 8 deletions(-) create mode 100644 man/sink.x create mode 100644 src/sink.c create mode 100755 tests/misc/sink.sh diff --git a/AUTHORS b/AUTHORS index 46948d5fd..5790616b4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -79,6 +79,7 @@ sha384sum: Ulrich Drepper, Scott Miller, David Madore sha512sum: Ulrich Drepper, Scott Miller, David Madore shred: Colin Plumb shuf: Paul Eggert +sink: Bernhard Voelker sleep: Jim Meyering, Paul Eggert sort: Mike Haertel, Paul Eggert split: Torbjorn Granlund, Richard M. Stallman diff --git a/NEWS b/NEWS index a6ba96450..3323b3300 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ GNU coreutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New programs + + sink: copy data from an input stream to a file. + ** Bug fixes cp -a --attributes-only now never removes destination files, diff --git a/README b/README index 6cb7c2226..da98eb86f 100644 --- a/README +++ b/README @@ -13,9 +13,9 @@ The programs that can be built with this package are: id install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum - sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty sum sync - tac tail tee test timeout touch tr true truncate tsort tty uname unexpand - uniq unlink uptime users vdir wc who whoami yes + sha384sum sha512sum shred shuf sink sleep sort split stat stdbuf stty sum + sync tac tail tee test timeout touch tr true truncate tsort tty uname + unexpand uniq unlink uptime users vdir wc who whoami yes See the file NEWS for a list of major changes in the current release. diff --git a/build-aux/gen-lists-of-programs.sh b/build-aux/gen-lists-of-programs.sh index 3ec9a6dd1..e9921e912 100755 --- a/build-aux/gen-lists-of-programs.sh +++ b/build-aux/gen-lists-of-programs.sh @@ -112,6 +112,7 @@ normal_progs=' sha512sum shred shuf + sink sleep sort split diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 94c9fbfa5..743276bac 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -109,6 +109,7 @@ * sha2: (coreutils)sha2 utilities. Print or check SHA-2 digests. * shred: (coreutils)shred invocation. Remove files more securely. * shuf: (coreutils)shuf invocation. Shuffling text files. +* sink: (coreutils)sink invocation. Redirect a stream to a file. * sleep: (coreutils)sleep invocation. Delay for a specified time. * sort: (coreutils)sort invocation. Sort text files. * split: (coreutils)split invocation. Split into pieces. @@ -199,7 +200,7 @@ Free Documentation License''. * Disk usage:: df du stat sync truncate * Printing text:: echo printf yes * Conditions:: false true test expr -* Redirection:: tee +* Redirection:: sink tee * File name manipulation:: dirname basename pathchk mktemp realpath * Working context:: pwd stty printenv tty * User information:: id logname whoami groups users who @@ -384,6 +385,7 @@ Conditions Redirection +* sink invocation:: Redirect a stream to a file * tee invocation:: Redirect output to multiple files or processes File name manipulation @@ -13744,14 +13746,91 @@ expr index + index a @cindex commands for redirection Unix shells commonly provide several forms of @dfn{redirection}---ways -to change the input source or output destination of a command. But one -useful redirection is performed by a separate command, not by the shell; -it's described here. +to change the input source or output destination of a command. But two +useful redirections are performed by the separate commands, not by the shell; +they're described here. @menu +* sink invocation:: Redirect a stream to a file. * tee invocation:: Redirect output to multiple files or processes. @end menu +@node sink invocation +@section @command{sink}: Redirect a stream to a file + +@pindex sink +@cindex pipe fitting +@cindex source, file descriptor input +@cindex read from a stream and write to a file + +The @command{sink} command copies the data of an input stream to a file given +as argument. The input stream defaults to the standard input, and can be +changed to any other file descriptor open for reading. +Synopsis: + +@example +sink [@var{option}]@dots{} @var{file} +@end example + +The program accepts the following options. Also see @ref{Common options}. + +@table @samp +@item -a +@itemx --append +@opindex -a +@opindex --append +Append the input data to the given file rather than overwriting it. + +@item -c +@itemx --create +@opindex -c +@opindex --create +Ensure that the program creates the given output file; +fail if it already exists. + +@item -i @var{fd} +@itemx --input-stream=@var{fd} +@opindex -i +@opindex --input-stream +Read the input data from the stream associated to the numeric +file descriptor @var{fd}. +Without this option, the input file descriptor defaults to standard input. +@end table + +The @command{sink} command may be useful to write the data at the end of a pipe +to a file without using a shell redirection operator. +@example +cat file1 \ + | grep pattern \ + | tee file2 file3 \ + | tr '[a-z]' '[A-Z]' \ + | sink file4 +@end example + +Another example is to use it at the end of a pipe to write something via +@command{sudo} into a file owned by the superuser. + +@example +echo '127.0.0.2 localalias' | sudo sink -a /etc/hosts +@end example + +Here is a more complex example to redirect the input from file descriptor +@samp{6} which is associated to a pipe (instead of the default, standard input). + +@example +$ mkfifo pipe \ + && src/sink -i6 -c file 6pipe; \ + for n in 1 2 3; do \ + echo step$n; \ + sleep 1; \ + done >pipe; \ + rm -f pipe ) +$ cat file +step1 +step2 +step3 +@end example @node tee invocation @section @command{tee}: Redirect output to multiple files or processes diff --git a/man/.gitignore b/man/.gitignore index 4eecb7833..d4551d74f 100644 --- a/man/.gitignore +++ b/man/.gitignore @@ -74,6 +74,7 @@ sha384sum.1 sha512sum.1 shred.1 shuf.1 +sink.1 sleep.1 sort.1 split.1 diff --git a/man/local.mk b/man/local.mk index d23699bae..3f407f4ee 100644 --- a/man/local.mk +++ b/man/local.mk @@ -141,6 +141,7 @@ man/sha384sum.1: src/sha384sum$(EXEEXT) man/sha512sum.1: src/sha512sum$(EXEEXT) man/shred.1: src/shred$(EXEEXT) man/shuf.1: src/shuf$(EXEEXT) +man/sink.1: src/sink$(EXEEXT) man/sleep.1: src/sleep$(EXEEXT) man/sort.1: src/sort$(EXEEXT) man/split.1: src/split$(EXEEXT) diff --git a/man/sink.x b/man/sink.x new file mode 100644 index 000000000..a4a0b5725 --- /dev/null +++ b/man/sink.x @@ -0,0 +1,6 @@ +[NAME] +sink \- copy data from an input stream to a file +[DESCRIPTION] +.\" Add any additional description here +[SEE ALSO] +cat(1), tee(1) diff --git a/po/POTFILES.in b/po/POTFILES.in index 5f9c8fc50..7cf439069 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -113,6 +113,7 @@ src/seq.c src/set-fields.c src/shred.c src/shuf.c +src/sink.c src/sleep.c src/sort.c src/split.c diff --git a/scripts/git-hooks/commit-msg b/scripts/git-hooks/commit-msg index 8a4b894ef..8ade59b8e 100755 --- a/scripts/git-hooks/commit-msg +++ b/scripts/git-hooks/commit-msg @@ -20,7 +20,7 @@ my @valid = qw( install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum - sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty + sha384sum sha512sum shred shuf sink sleep sort split stat stdbuf stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes diff --git a/src/.gitignore b/src/.gitignore index 86d82ad4b..eedb4d856 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -86,6 +86,7 @@ sha384sum sha512sum shred shuf +sink sleep sort split diff --git a/src/sink.c b/src/sink.c new file mode 100644 index 000000000..c7571fdf4 --- /dev/null +++ b/src/sink.c @@ -0,0 +1,205 @@ +/* sink - read from standard input and write a file. + Copyright (C) 2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Bernhard Voelker */ + +#include +#include +#include + +#include "system.h" +#include "die.h" +#include "error.h" +#include "fadvise.h" +#include "xbinary-io.h" +#include "xdectoint.h" + +/* The official name of this program (e.g., no 'g' prefix). */ +#define PROGRAM_NAME "sink" + +#define AUTHORS \ + proper_name ("Bernhard Voelker") + +/* Upper bound on getdtablesize(). See gnulib/lib/fcntl.c. */ +#define OPEN_MAX_MAX 0x10000 + +/* If true, append to output file rather than truncating it. */ +static bool flag_append; + +/* If true, ensure to create the output FILE: mode O_CREAT | O_EXCL. */ +static bool flag_creat; + +/* Input file descriptor, default to stdin. */ +static int input_stream = STDIN_FILENO; + +static struct option const long_options[] = +{ + {"append", no_argument, NULL, 'a'}, + {"create", no_argument, NULL, 'c'}, + {"input-stream", required_argument, NULL, 'i'}, + {GETOPT_HELP_OPTION_DECL}, + {GETOPT_VERSION_OPTION_DECL}, + {NULL, 0, NULL, 0} +}; + +void +usage (int status) +{ + if (status != EXIT_SUCCESS) + emit_try_help (); + else + { + printf (_("Usage: %s [OPTION]... FILE\n"), program_name); + fputs (_("\ +Copy input stream to FILE.\n\ +"), stdout); + + emit_mandatory_arg_note (); + + fputs (_("\n\ + -a, --append append to the given FILE, do not overwrite\n\ +"), stdout); + fputs (_("\ + -c, --create ensure to create FILE, error if exists\n\ +"), stdout); + fputs (_("\ + -i, --input-stream=FD read from stream FD instead of standard input\n\ +"), stdout); + fputs (_("\n\ +The default input stream number FD is 0, representing the standard input.\n\ +"), stdout); + emit_ancillary_info (PROGRAM_NAME); + } + exit (status); +} + +/* Copy data from file descriptor INFD to file FILENAME. + Return true if successful. */ + +static bool +sink (int src_fd, char *filename) +{ + char buffer[BUFSIZ]; + ssize_t bytes_read = 0; + bool ok = true; + + xset_binary_mode (src_fd, O_BINARY); + fadvise (fdopen (src_fd, "r"), FADVISE_SEQUENTIAL); + + char const *mode_string = + (O_BINARY + ? (flag_append ? "ab" : "wb") + : (flag_append ? "a" : "w")); + + /* Both --append and --create may create the file. */ + int open_flags = O_WRONLY | O_BINARY | O_NOCTTY | O_CREAT; + if (flag_creat) + open_flags |= O_EXCL; + + open_flags |= flag_append ? O_APPEND : O_TRUNC; + + int dest_fd = open (filename, open_flags, MODE_RW_UGO); + if (dest_fd < 0) + die (EXIT_FAILURE, errno, "%s: %s", _("open failed"), quoteaf (filename)); + + FILE *dest_fp = fdopen (dest_fd, mode_string); + if (dest_fp == NULL) + die (EXIT_FAILURE, errno, "%s", quoteaf (filename)); + + setvbuf (dest_fp, NULL, _IONBF, 0); + + while (true) + { + bytes_read = read (src_fd, buffer, sizeof buffer); + if (bytes_read < 0 && errno == EINTR) + continue; + if (bytes_read <= 0) + break; + + if (fwrite (buffer, bytes_read, 1, dest_fp) != 1) + die (EXIT_FAILURE, errno, "%s: %s", _("write failed"), + quoteaf (filename)); + } + + if (bytes_read == -1) + die (EXIT_FAILURE, errno, _("file descriptor %d: read failed"), src_fd); + + if (close (src_fd) != 0) + die (EXIT_FAILURE, errno, _("file descriptor %d: close failed"), src_fd); + + if (fclose (dest_fp) != 0) + die (EXIT_FAILURE, errno, "%s: %s", _("close failed"), quoteaf (filename)); + + return ok; +} + +int +main (int argc, char **argv) +{ + int optc; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + + atexit (close_stdout); + + flag_append = false; + + while ((optc = getopt_long (argc, argv, "aci:", long_options, NULL)) != -1) + { + switch (optc) + { + case 'a': + flag_append = true; + break; + + case 'c': + flag_creat = true; + break; + + case 'i': + input_stream = xdectoimax (optarg , 0, OPEN_MAX_MAX, "", + _("invalid input stream number"), 0); + break; + + case_GETOPT_HELP_CHAR; + + case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); + + default: + usage (EXIT_FAILURE); + } + } + + if (argc <= optind) + { + error (0, 0, _("missing operand")); + usage (EXIT_FAILURE); + } + + if (1 < argc - optind) + { + error (0, 0, _("extra operand: %s"), quoteaf (argv[optind + 1])); + usage (EXIT_FAILURE); + } + + bool ok = sink (input_stream, argv[optind]); + + return ok ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/tests/local.mk b/tests/local.mk index d3cfbcd02..c724c9630 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -359,6 +359,7 @@ all_tests = \ tests/misc/shred-size.sh \ tests/misc/shuf.sh \ tests/misc/shuf-reservoir.sh \ + tests/misc/sink.sh \ tests/misc/sleep.sh \ tests/misc/sort.pl \ tests/misc/sort-benchmark-random.sh \ diff --git a/tests/misc/help-version.sh b/tests/misc/help-version.sh index 17d4c7032..04ca3432f 100755 --- a/tests/misc/help-version.sh +++ b/tests/misc/help-version.sh @@ -195,6 +195,7 @@ logname_setup () { args=--version; } nohup_setup () { args=--version; } printf_setup () { args=foo; } seq_setup () { args=10; } +sink_setup () { args=$tmp_out; } sleep_setup () { args=0; } stdbuf_setup () { args="-oL true"; } timeout_setup () { args=--version; } diff --git a/tests/misc/sink.sh b/tests/misc/sink.sh new file mode 100755 index 000000000..395cbbc29 --- /dev/null +++ b/tests/misc/sink.sh @@ -0,0 +1,146 @@ +#!/bin/sh +# test for basic sink functionality. + +# Copyright (C) 2021 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ sink + +echo line >sample || framework_failure_ + +# Simple run. +sink file out 2>err || fail=1 +compare sample file || fail=1 +compare /dev/null out || fail=1 +compare /dev/null err || fail=1 + +# No FILE given. +returns_ 1 sink out 2>err || fail=1 +compare /dev/null out || fail=1 +grep 'missing operand' err || { cat err; fail=1; } + +# Extra operand. +returns_ 1 sink file extra out 2>err || fail=1 +compare /dev/null out || fail=1 +grep 'extra operand' err || { cat err; fail=1; } + +# Test -a, --append. +for o in -a --append; do + rm -f file out err || framework_failure_ + + # New file: -a does nothing special. + sink $o file out 2>err || fail=1 + compare sample file || fail=1 + compare /dev/null out || fail=1 + compare /dev/null err || fail=1 + + # remove out+err. + rm -f out err || framework_failure_ + # prepare file to append. + echo survived > file || framework_failure_ + { echo survived; echo line; } > exp || framework_failure_ + + # Test the EEXIST case. + sink $o file out 2>err || fail=1 + compare exp file || fail=1 + compare /dev/null out || fail=1 + compare /dev/null err || fail=1 +done +rm -f file exp out err || framework_failure_ + +# Test -c, --create. +for o in -c --create; do + rm -f file out err || framework_failure_ + + sink $o file out 2>err || fail=1 + compare sample file || fail=1 + compare /dev/null out || fail=1 + compare /dev/null err || fail=1 + + # keep file, remove out+err. + rm -f out err || framework_failure_ + + # Test the EEXIST case. + returns_ 1 sink $o file out 2>err || fail=1 + compare /dev/null out || fail=1 + grep exist err || fail=1 + + # remove file, out+err. + rm -f file our err || framework_failure_ + + # Test --create with --append: append is a noop. + sink $o -a file out 2>err || fail=1 + compare sample file || fail=1 + compare /dev/null out || fail=1 + compare /dev/null err || fail=1 +done +rm -f in file out err || framework_failure_ + +# Test -i, --input-stream. +for o in -i --input-stream; do + # Exercise FD=0 (=stdin). + sink $o 0 file out 2>err || fail=1 + compare sample file || fail=1 + compare /dev/null out || fail=1 + compare /dev/null err || fail=1 + rm -f file out err || framework_failure_ + + # Exercise wit FD=18. + echo other >in || framework_failure_ + sink $o 18 file out 2>err || fail=1 + compare sample file || fail=1 + compare /dev/null out || fail=1 + compare /dev/null err || fail=1 + rm -f in file out err || framework_failure_ +done + +# Exercise -i with invalid values: negative or non-numeric. +returns_ 1 sink -i-1 file out 2>err || fail=1 +grep 'invalid input stream number' err || { cat err; fail=1; } + +returns_ 1 sink --input-stream=A file out 2>err || fail=1 +grep 'invalid input stream number' err || { cat err; fail=1; } + +# Exercise -i with EBADF. +# FD is closed. +returns_ 1 sink -i18 file 18<&- >out 2>err || fail=1 +compare /dev/null file || fail=1 +compare /dev/null out || fail=1 +grep 'read failed' err || { cat err; fail=1; } +rm -f file out err || framework_failure_ + +# FD is open for writing only. +returns_ 1 sink -i18 file 18>f >out 2>err || fail=1 +compare /dev/null file || fail=1 +compare /dev/null out || fail=1 +grep 'read failed' err || { cat err; fail=1; } +rm -f file out err || framework_failure_ + +# Exercise open's EISDIR. +returns_ 1 sink . out 2>err || fail=1 +compare /dev/null out || fail=1 +grep 'open failed' err || { cat err; fail=1; } +rm -f out err || framework_failure_ + +# Exercise ENOSPC. +if test -w /dev/full && test -c /dev/full; then + yes | returns_ 1 timeout 10 sink /dev/full >err 2>err || fail=1 + compare /dev/null out || fail=1 + grep 'write failed' err || { cat err; fail=1; } + rm -f err || framework_failure_ +fi + +Exit $fail -- 2.30.0 --------------74CEB4541933A37E03B2ADF5-- From owner-freebsd-hackers@freebsd.org Mon Jan 25 08:55:48 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB8AD4EF482 for ; Mon, 25 Jan 2021 08:55:48 +0000 (UTC) (envelope-from grarpamp@gmail.com) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DPNxc0M1Vz3KyT for ; Mon, 25 Jan 2021 08:55:47 +0000 (UTC) (envelope-from grarpamp@gmail.com) Received: by mail-ej1-x62c.google.com with SMTP id hs11so16886501ejc.1 for ; Mon, 25 Jan 2021 00:55:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=gFpu3xmh0aomukUBLcsOk8Tguh3iYXH/v1c7C4hnAYo=; b=rfAgcnBPdjOLLXwzRQH0bQHy9iPZIgLuN42zV+wYYIzm7+R//cV+ZfDG+GWwC9RbWE S1JXVcE6CqR8tamINaMcL0NeHS8BRjI0NHJqwDHvzwqGXuZ+NUt6s8AexRPb3t/oKdMZ WKhgiUFM0M5wvV0X1x5X8kXqUglp/Yh7vnLS51B4hDpu6n8WqsI/txBstSxZoGo3uxNq WPpcRmIsGbGvyJ36S5U4DHF5e9rvVpRKvWenLIoiVSpLOSRmfqcgKfuw8lIQ/vXcm3ZM ieGjW0vc8OIbc2e7QI27ZviUYyxpX8QFIFSqOLz10cQepTh63+Kcmu7n+BwJCQ/BM74w s/1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=gFpu3xmh0aomukUBLcsOk8Tguh3iYXH/v1c7C4hnAYo=; b=ipgbsHlxX4npezijqtBS0yLuUaPOPXx7/kJHmFX5mj/Baka8HoPAqmYlPu4Xbjs23p SNMd1JDMmScaDoME37LDmilWxBRPhNpE9+mMiJ4XjJzYiwTnfVwIvCWUt0ZElCjeDRbS LMMajMjg4fMjGfifisChB1gG2zi8S1OdakkCwuVrK96krbKQtvjElNLYyDMP0f8SN+fT zz8eYruY7bw6NQygF9wFtJPQwnZD6N3CH5hn+6uzFgtWy9rk9jtohVE8uK3iq3wXJiEn E8A+AMDDlft5t0ykudtT+Xg2/qCnPIsanewkf62XHKDJDA/CaSqeoKn+u0iWm0pmmxsH mw/Q== X-Gm-Message-State: AOAM532Dc6/EtN9L4EkBUqogR3K17uZ6VAfEwYaezOI6aD8Voyx/S86B 4u+N4qHntGzObHNVwqTlaY4AHbrmtE7ECJ8IMVIBQgMge/0etA== X-Google-Smtp-Source: ABdhPJyNHyBX12nflzV6cEv+0lygv+X+c028eT+WZ/XByxepbPdiwC9suSnGHqtZm131Xoi6Oalct7sWauIA9r9JNuo= X-Received: by 2002:a17:906:9401:: with SMTP id q1mr69909ejx.516.1611564946586; Mon, 25 Jan 2021 00:55:46 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a54:3d8d:0:0:0:0:0 with HTTP; Mon, 25 Jan 2021 00:55:45 -0800 (PST) In-Reply-To: References: From: grarpamp Date: Mon, 25 Jan 2021 03:55:45 -0500 Message-ID: Subject: Re: AMD's memory encryption (aka SME) To: freebsd-security@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DPNxc0M1Vz3KyT X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=rfAgcnBP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of grarpamp@gmail.com designates 2a00:1450:4864:20::62c as permitted sender) smtp.mailfrom=grarpamp@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::62c:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::62c:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_SPAM_SHORT(1.00)[1.000]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::62c:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-hackers]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-Mailman-Approved-At: Mon, 25 Jan 2021 11:03:03 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 08:55:48 -0000 > does anyone have an opinion on AMD's "Secure Memory Encryption"? This > transparently encrypts all/most RAM pages. > Looking at some tech docs, this seems fairly easy to implement. > I was wondering if someone has attempted that already, or knows of > reasons why not to. Consider applications to rowhammer, cold boot attacks, shared hosting, VM, poison, etc... there are papers on some use cases. AMD SME has some different levels with EPYC being full featured, TR and PRO differently, than even consumer cpu last. FreeBSD should also implement sysctl that writes random to all memory (even over kernel) just before halt / reboot call. Similar for unallocated upon sleep, upon alloc release, and as background scrub. User can already choose random upon alloc with malloc.conf but that is different than above. Also: memtest86[+] integration. From owner-freebsd-hackers@freebsd.org Mon Jan 25 17:58:05 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DAAC4EAB39 for ; Mon, 25 Jan 2021 17:58:05 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DPczJ36Lxz4mFD for ; Mon, 25 Jan 2021 17:58:04 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x82a.google.com with SMTP id c1so10345482qtc.1 for ; Mon, 25 Jan 2021 09:58:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-disposition; bh=k8PfbMA/cgIQUcjErbvN5AXbE9gLcuAV8IqYVrM03jk=; b=YnpmgAoJ4KsSzj209TRNi8LhPp0X/vCt4qU5F5VdJRUnvuGMcP48SFYkV7lBLCaphS 0xiSpwfgyQtMLA6zuGdmMtSsPKTfHOO0iMxjsMGdVmGHEnINYZNIS3gnFmDqgUJlcI2w tL2cA6GIQBOLpRoCBUHJ2spySJCZFeFI5eD5FzRevwWJajASxLNXIZ6kIHUBpeBzCbgR uAPPOi4sArIYphkivCtI/MszayZgnohp2zagNXd7IfjHFRyh2SXaMiWH5HHI4Bhm49TM cWuG2sdkLRl+56vRl4Kh0qASgO0i81IAjK7hkUyW5CA8r7e4f22fMOUYC5Ga83WqQyO5 t5PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-disposition; bh=k8PfbMA/cgIQUcjErbvN5AXbE9gLcuAV8IqYVrM03jk=; b=VIKZ40us6PGyyc5j4vMwp3+WEnUjtlK8bV6qpZiPGYu3gUWu+bbGRPVRQmjdv9ecxX eO2ESFT5YOHd3PmCDiu5QcNi2hCRE+Vit8fWsDd+KFl95fghw+hfXB/tw3jCDLKF+LM6 1Zqn7WcH2KM+czXhVa8QfxUXS0+g7NPd2g8ege5Rj8GX9jypEZ1SRD1DPvzaKYontS0g Fx0nz5qirXVfT2Lt7FElBFiLfBxNYql8es63AZuUc2QeXiAsBeOOtBHskrVf1mPkyNzJ 4dT0Xcctcw+DI6rGoPjwKEB/PWyep4gnkqaBpFkQppvjjWsdqk2AhfJWi/ZHqkXGTlG/ qjkg== X-Gm-Message-State: AOAM531bUnK1AdgwwNXxBVXoqp5de+7Gwm7OSD1shJxa068IutT3sJ9f u+nQmeuuDjhz32/MtrBYA52+Pw/qf6Xuig== X-Google-Smtp-Source: ABdhPJyqtBLk/w7GLEHNpQO0sYNF3+EYcKyVzeywUfwctpKVPfS2gmLgbLQrydRsfNOaRavuolKUEA== X-Received: by 2002:ac8:7259:: with SMTP id l25mr1614307qtp.1.1611597483224; Mon, 25 Jan 2021 09:58:03 -0800 (PST) Received: from raichu ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id o45sm9300463qto.91.2021.01.25.09.58.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 09:58:02 -0800 (PST) Sender: Mark Johnston Date: Mon, 25 Jan 2021 12:58:00 -0500 From: Mark Johnston To: freebsd-hackers@freebsd.org Subject: arc wrapper for tracking phabricator reviews Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 4DPczJ36Lxz4mFD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=YnpmgAoJ; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::82a as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::82a:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; TO_DOM_EQ_FROM_DOM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::82a:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::82a:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 17:58:05 -0000 Hi, For the past while I've been using a script, git arc, to automate some of my interactions with Phabricator. A few other developers have found it useful so it seems time to make it more accessible by committing it to the src tree. The script is here: https://reviews.freebsd.org/D28334 The basic idea is to make it simple to create and update Phabricator reviews from git commits, without adding any metadata to your git repository so as to stay as flexible as possible. In particular, I tend to rebase sets of commits regularly so things like notes and branch pointers end up being invalidated. git arc lets you - Create reviews from a series of commits. It automatically creates parent/child pointers between consecutive Differential revisions. - Update reviews after amending commits based on reviewer feedback. - Stage commits in preparation for pushing to the upstream repository. This automatically adds "Reviewed by:" and "Differential Revision:" tags. See the rather verbose usage message for more details. To map git commits to phabricator revisions it uses commit summaries. This is kind of gross but I don't see a better way to do it that doesn't involve adding metadata to my git tree, and it seems to work fine in practice. In general git arc wraps the functionality of arc, though in some cases it uses jq and arc's "call-conduit" functionality to call into the lower-level Phabricator APIs. There exists a script with similar goals, arcgit, in the tools/ dir. I used it for a while but found that with its workflow I still had to do a fair bit of manual work to keep phabricator in sync with my commits. I'm not sure how best to reconcile the two scripts. It would be better for new developers to not have to choose between them. The main advantage of arcgit is that it helps maintain large patch stacks by making it easier to edit intermediate commits in response to review feedback. In particular, it adds a branch for each review posted to phabricator, so it's a bit easier to go back and edit a particular commit, but I believe this assumes that you aren't rebasing your branch. I'd appreciate any feedback/suggestions/complaints regarding the new script, especially if you use arcgit today. Thanks to jhb for submitting a number of improvements and suggesting a few others that I implemented recently. From owner-freebsd-hackers@freebsd.org Mon Jan 25 11:33:38 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFABA4DE38E for ; Mon, 25 Jan 2021 11:33:38 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DPSRk4Nnhz3pW4; Mon, 25 Jan 2021 11:33:38 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: by mail-wr1-x432.google.com with SMTP id g10so12005506wrx.1; Mon, 25 Jan 2021 03:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UndO6GMVVZmcMmeat9dl3kmBPjIg2CugQuFU3Qe+syA=; b=BWY1cdaIaXtNsoBI1CL94KUSaVZc4YPaLvwxnaI5Ua5JhJbzrpRNdhCerYVtrU/vqv naqE+1sI0m3ANvWz3eikFQG3a6drkyzg9oRE0aC0hSR88Y8nbIpRuRNozVSXwPhWM7Jr xCnkxyoXIIhvyCYVX0SEHW5+c4Faq76r0QXtfVPSChhuQ9SOmhQfDSEX8CLwmyc8AcRK U6q7izAK66I/7zFCIG6aoyTjyn7N2sT5CCl2bm2QSSVyITAGO4v+D5i9iMCDiq4dbEO8 rqjA6OXfDhxeEU3KVflD77eud8imVjklpG496tjbKafd/y7/3cauqM8wggxiYx9jxF6b 6e5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UndO6GMVVZmcMmeat9dl3kmBPjIg2CugQuFU3Qe+syA=; b=tQrd2F/sWxR2fCAvtIvTfYjApL0hO9S3VbderAOs8ZNe0Z6W420pcxrcJ99pWJuHeX 1UnBtdDx84Y4mX8sGtQOxPGbnafjbrSS4iPueFAoqI1gQGCMLFyeewsPOONtM+Q4iXeY f7bsdKTd99qvcFvO/MsJinXbcGuCX3CyVBfGBO6xjf1l/xH7wLN8S05qHowUArPfmkl/ /Rsx5aTndI6Rn9BtQlKn6S2JxLWUTf6S/xTvuOQCW5iIsu6lp/G/bXQUMRJMU8NESYyh mzGgIdLbrH00lW9dghUUiyiHcuE1hpnTWIQmYgr82U84aLVQXJFeucJcETdHtiHqV0zE bkWg== X-Gm-Message-State: AOAM532nvGN9FrOnaZbkMgy/8nEGx5o3fFCmC3sYvFsm1IaudBedtKb3 vANSLBatqvxfE9xE2zaS1Os= X-Google-Smtp-Source: ABdhPJxQajBxHs+X8bVvEq65CY8ZT27zqXuQFKWROK50rmJw6Ks4jGRr/doMBaLndHNsyL+8QrsRNQ== X-Received: by 2002:adf:e348:: with SMTP id n8mr468706wrj.148.1611574416444; Mon, 25 Jan 2021 03:33:36 -0800 (PST) Received: from [10.8.0.134] ([195.53.121.100]) by smtp.gmail.com with ESMTPSA id n6sm20254332wmi.23.2021.01.25.03.33.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Jan 2021 03:33:35 -0800 (PST) Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: Bernhard Voelker , Alex Henrie , Otto Moerbeek , Coreutils Cc: Fabrice BAUZAC , juli@clockworksquid.com, Jeffrey Walton , freebsd-hackers@freebsd.org, William Ahern , Roman Czyborra , oshogbo@freebsd.org, tech@openbsd.org, Christian Groessler , linux-api@vger.kernel.org, Michael Kerrisk , ed@nuxi.nl, Eric Pruitt References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> From: "Alejandro Colomar (man-pages)" Message-ID: Date: Mon, 25 Jan 2021 12:33:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DPSRk4Nnhz3pW4 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 19:42:25 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 11:33:38 -0000 On 1/25/21 5:03 AM, Bernhard Voelker wrote: > On 1/24/21 9:01 PM, Alex Henrie wrote: >> I am definitely interested. Bernhard Voelker seemed to express >> interest as well, conditional on -q being added to POSIX first.[1] > > Just to clarify: I'm not as enthusiastic to add that option as it > may have sounded. > > Let me put it like this: if -q once gets standardized by POSIX, > then we'd take it over in the GNU tee implementation. > > Let me summarize so far: > The suggestion is to solve the problem to save some data coming from > a pipe as a different user. > There are at least those known solutions: > - use > or >> redirection. > - use dd(1) > > I have the impression that a home for this feature was searched > in any tool, and as tee(1) already knew how to write to a file, > had the "append" feature, and is often used in pipes, it was > tempting to add it there. > > But looking deeper, --quiet doesn't seem to fit well into 'tee'. > It even contradicts to the title line in the man page: > "read from standard input and write to standard output and files" > > An off-tech argument: ask a local plumber if he'd would ever use > a tee piece instead of a pipe end piece. I guess he would only > if he wouldn't have anything else at hand. I never knew what 'tee' meant. That makes sense now. > > A word to the proposed patch: what should happen, if the user does > not give a file? > A | B | tee -q > The patch just silently ignored that situation which feels wrong. > > Therefore, adding a feature which does not really fit is wrong, and > contradicts the one-tool-for-one-purpose UNIX philosophy. > Agreed. > OTOH I understand that there's a little gap in the tool landscape. > Astonishingly, there doesn't seem to exist a trivial tool to redirect > from standard input (or any other input file descriptor) to a file. > I wrote such a little tool in the attached: > > $ src/sink --help > Usage: src/sink [OPTION]... FILE > Copy input stream to FILE. > > Mandatory arguments to long options are mandatory for short options too. > > -a, --append append to the given FILE, do not overwrite > -c, --create ensure to create FILE, error if exists > -i, --input-stream=FD read from stream FD instead of standard input > > The default input stream number FD is 0, representing the standard input. > > This allows not only to copy data from standard input, but from any > file descriptor open for reading. It also allows control over > how the output file will be opened (e.g. with O_CREAT|E_EXCL). > > The OPs case would look like: > > echo 'foo' | sudo sink /etc/foo > or > echo 'foo' | sudo sink -a /etc/foo # append. > or > echo 'foo' | sudo sink -c /etc/foo # ensure creation of the file. > > I'm not sure if this will ever be considered for inclusion - > I just did it "for fun". ;-) Tested-by: Alejandro Colomar Reviewed-by: Alejandro Colomar Much better than my patch. :-) > > Have a nice day, > Berny > Have a nice day! Alex -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/ From owner-freebsd-hackers@freebsd.org Mon Jan 25 16:06:39 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC91F4E7B22 for ; Mon, 25 Jan 2021 16:06:39 +0000 (UTC) (envelope-from pj@smo.de) Received: from mail.adebahr.de (mail.adebahr.de [185.66.179.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.adebahr.de", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DPZVg3ty3z4dQn; Mon, 25 Jan 2021 16:06:35 +0000 (UTC) (envelope-from pj@smo.de) Received: from localhost (localhost [127.0.0.1]) by mail.adebahr.de (Postfix) with ESMTP id 3829B601EBB17; Mon, 25 Jan 2021 17:06:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=smo.de; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:subject:subject; s=mail; t=1611590787; x=1613405188; bh=0Hu2jGMxMxqNRTowysPP+4NjmcjZaJxZPVp9ZQ8qz9o=; b=JTARFS9nruyr /0klbiOGwFbVfQQM/Yb4NXQ7P6YhKhZ3a+kPHjeKkGLZ+k0asqYi9JzlNtc4X02I +dKJw6fgfOzunta/ad47ZNPkj3uLFGO+FVXLxQRYt7Bz2Sq3tiSC2CcwJoYD4RFU hy3wTq6XOdwCkTWiUFgW0mOk59QAIko= Received: from mail.adebahr.de ([127.0.0.1]) by localhost (mail.adebahr.de [127.0.0.1]) (amavisd-new, port 10026) with LMTP id ntZw7qQmOo-3; Mon, 25 Jan 2021 17:06:27 +0100 (CET) Received: from [192.168.153.201] (pd95154e8.dip0.t-ipconnect.de [217.81.84.232]) by mail.adebahr.de (Postfix) with ESMTPSA id A5CF760084C5C; Mon, 25 Jan 2021 17:06:24 +0100 (CET) Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: Alejandro Colomar , Bernhard Voelker , Alex Henrie , Christian Groessler , =?UTF-8?Q?P=c3=a1draig_Brady?= , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton Cc: Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> From: Philipp-Joachim Ost Message-ID: Date: Mon, 25 Jan 2021 17:06:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4 MIME-Version: 1.0 In-Reply-To: <20210124121845.38293-1-alx.manpages@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DPZVg3ty3z4dQn X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=smo.de header.s=mail header.b=JTARFS9n; dmarc=none; spf=pass (mx1.freebsd.org: domain of pj@smo.de designates 185.66.179.123 as permitted sender) smtp.mailfrom=pj@smo.de X-Spamd-Result: default: False [-2.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:185.66.179.112/28]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[smo.de:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com,bernhard-voelker.de,groessler.org,draigbrady.com,gnu.org,25thandclement.com,unix-ag.uni-kl.de]; RECEIVED_SPAMHAUS_PBL(0.00)[217.81.84.232:received]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[185.66.179.123:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:198930, ipnet:185.66.176.0/22, country:DE]; RSPAMD_URIBL_FAIL(0.00)[smo.de:server fail]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[smo.de:s=mail]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[smo.de]; SPAMHAUS_ZRD(0.00)[185.66.179.123:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[18]; FREEMAIL_CC(0.00)[gmail.com,mykolab.com,openbsd.org,freebsd.org,vger.kernel.org,clockworksquid.com,nuxi.nl]; MAILMAN_DEST(0.00)[freebsd-hackers]; SUSPICIOUS_RECIPS(1.50)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 19:42:51 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 16:06:39 -0000 Am 24.01.2021 um 13:18 schrieb Alejandro Colomar: > This is useful for using tee to just write to a file, > at the end of a pipeline, > without having to redirect to /dev/null > > Example: > > echo 'foo' | sudo tee -q /etc/foo; > > is equivalent to the old (and ugly) > > echo 'foo' | sudo tee /etc/foo >/dev/null; Why don't you just do echo foo > /etc/foo or sudo sh -c 'echo foo > /etc/foo' ? I don't normally use sudo, so there might be some better way of using it. Kind regards, Philipp From owner-freebsd-hackers@freebsd.org Tue Jan 26 09:08:32 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BBC14E6311 for ; Tue, 26 Jan 2021 09:08:32 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DQ19q2LLhz3FG1; Tue, 26 Jan 2021 09:08:31 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: by mail-wr1-x42e.google.com with SMTP id 6so15603259wri.3; Tue, 26 Jan 2021 01:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qQxlWty85dvfGFlbA5g1keGbJcIY/a/+CTU5RPzQHpY=; b=YlGolM/fDumf4LdRNZGoOlfchWA4g12BQ6lVsA0KoxqibrBvbt7gh9Ir46FcPS1Lbm zJm2PWRg42z0/XaqfzZtYmJ91c2XO37QZHMgAln9uf/1LAzkqQMPaHJS1836UDooRxl3 AmVmeTnoVX0Nc2nwGQ8A3E2P3zAf9AzMNL22Y91XOL0SXi6u6L+RG2i2o6W5TJmt1HZr vlYYmiEGlnnMYy+A0u5S+QS/1FBf4BILqK0Uv3Bh+rNZgKPgN7rR1wptPETLdm7rFSm/ k9JApQonQ6m0lwSL+uLt0V5vcInxMutwpJz/uj6ZaHgialbqFiaXlZ/5ily8MmoiHh0K JQ0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qQxlWty85dvfGFlbA5g1keGbJcIY/a/+CTU5RPzQHpY=; b=RXJsOGnAHWuqMAAi0FFRCgfHOA/X0Xjt3/W3pSl+Nwn8uEm4ZgugBhVxBnGMHehnvw 3od773fuPrgnseMVXP6eFEiDiVBVqDFnV4Df15A7cItMl0WO3mUSyjrbutQGM2QpQWHD 4QKBj1QxXTgGsQQ3ESjCP7sZ0cFYDkD1Puhw8doW/SYMMmVlxtHNcwcBQNwwTJoV9zfW 8+SQSZwn/DakfVOFIajf2hCggtcVSw2l2byCRZid9Ptw8CesaxiFvhxtiMLI9M0Vp3rX on7eyw6jNTci8EuPzH/3NCS6fPGzPjyIoLYacvo9R+IV/Gi+utJrTQ0NqtubN+tX9WJk fV1A== X-Gm-Message-State: AOAM532bSTcY1iVw1GM6QzOvPx/i8stvbKqTI/AntGoY8oXeiTrWNeyZ cri5KD+Wh1Ed1Gey0Yl77Yk= X-Google-Smtp-Source: ABdhPJzlehwChFhg6kzuG7riJ8kiJZF8hNS9m8rUH/O+l+37pvC8oDm6hOIF/vAjkuDamc9wZKRvgQ== X-Received: by 2002:a5d:6509:: with SMTP id x9mr4984029wru.229.1611652108362; Tue, 26 Jan 2021 01:08:28 -0800 (PST) Received: from [10.8.0.134] ([195.53.121.100]) by smtp.gmail.com with ESMTPSA id a62sm2472818wmf.7.2021.01.26.01.08.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Jan 2021 01:08:27 -0800 (PST) Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout From: "Alejandro Colomar (man-pages)" To: Bernhard Voelker , Coreutils Cc: Fabrice BAUZAC , Otto Moerbeek , Alex Henrie , juli@clockworksquid.com, Jeffrey Walton , freebsd-hackers@freebsd.org, William Ahern , Roman Czyborra , oshogbo@freebsd.org, tech@openbsd.org, Christian Groessler , linux-api@vger.kernel.org, Michael Kerrisk , ed@nuxi.nl, Eric Pruitt References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> Message-ID: <834af55b-0935-ec2f-784c-3874cd05ba75@gmail.com> Date: Tue, 26 Jan 2021 10:08:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4DQ19q2LLhz3FG1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=YlGolM/f; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of alxmanpages@gmail.com designates 2a00:1450:4864:20::42e as permitted sender) smtp.mailfrom=alxmanpages@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::42e:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::42e:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[17]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::42e:from]; FREEMAIL_CC(0.00)[mykolab.com,drijf.net,gmail.com,clockworksquid.com,freebsd.org,25thandclement.com,czyborra.com,openbsd.org,groessler.org,vger.kernel.org,nuxi.nl]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-Mailman-Approved-At: Tue, 26 Jan 2021 11:44:40 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2021 09:08:32 -0000 Hi Berny, On 1/25/21 12:33 PM, Alejandro Colomar (man-pages) wrote: > On 1/25/21 5:03 AM, Bernhard Voelker wrote: >> On 1/24/21 9:01 PM, Alex Henrie wrote: >>> I am definitely interested. Bernhard Voelker seemed to express >>> interest as well, conditional on -q being added to POSIX first.[1] >> >> Just to clarify: I'm not as enthusiastic to add that option as it >> may have sounded. >> >> Let me put it like this: if -q once gets standardized by POSIX, >> then we'd take it over in the GNU tee implementation. >> >> Let me summarize so far: >> The suggestion is to solve the problem to save some data coming from >> a pipe as a different user. >> There are at least those known solutions: >>    - use > or >> redirection. >>    - use dd(1) >> >> I have the impression that a home for this feature was searched >> in any tool, and as tee(1) already knew how to write to a file, >> had the "append" feature, and is often used in pipes, it was >> tempting to add it there. >> >> But looking deeper, --quiet doesn't seem to fit well into 'tee'. >> It even contradicts to the title line in the man page: >>    "read from standard input and write to standard output and files" >> >> An off-tech argument: ask a local plumber if he'd would ever use >> a tee piece instead of a pipe end piece.  I guess he would only >> if he wouldn't have anything else at hand. > > I never knew what 'tee' meant.  That makes sense now. > >> >> A word to the proposed patch: what should happen, if the user does >> not give a file? >>    A | B | tee -q >> The patch just silently ignored that situation which feels wrong. >> >> Therefore, adding a feature which does not really fit is wrong, and >> contradicts the one-tool-for-one-purpose UNIX philosophy. >> > > Agreed. > >> OTOH I understand that there's a little gap in the tool landscape. >> Astonishingly, there doesn't seem to exist a trivial tool to redirect >> from standard input (or any other input file descriptor) to a file. >> I wrote such a little tool in the attached: >> >>    $ src/sink --help >>    Usage: src/sink [OPTION]... FILE >>    Copy input stream to FILE. >> >>    Mandatory arguments to long options are mandatory for short options >> too. >> >>      -a, --append              append to the given FILE, do not overwrite >>      -c, --create              ensure to create FILE, error if exists >>      -i, --input-stream=FD     read from stream FD instead of standard >> input On second thought, this program does two things: read any FD, and write to file. I think it should be limited to writing to a file from stdin. If you think there's a need for reading FDs other than 0, you might as well want to pipe that information you're reading from them to filter it with another tool, and this program doesn't allow you to do that, as it's a sink. So, I would remove '-i, --input-stream'. (And if you think it's missing, maybe write a program to read from any FD and write to stdout.) Regards, Alex >> >>    The default input stream number FD is 0, representing the standard >> input. >> >> This allows not only to copy data from standard input, but from any >> file descriptor open for reading.  It also allows control over >> how the output file will be opened (e.g. with O_CREAT|E_EXCL). >> >> The OPs case would look like: >> >>    echo 'foo' | sudo sink /etc/foo >> or >>    echo 'foo' | sudo sink -a /etc/foo  # append. >> or >>    echo 'foo' | sudo sink -c /etc/foo  # ensure creation of the file. >> >> I'm not sure if this will ever be considered for inclusion - >> I just did it "for fun". ;-) > > Tested-by: Alejandro Colomar > Reviewed-by: Alejandro Colomar > > Much better than my patch.  :-) > >> >> Have a nice day, >> Berny >> > > Have a nice day! > Alex > > > -- > Alejandro Colomar > Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ > http://www.alejandro-colomar.es/ -- -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/ From owner-freebsd-hackers@freebsd.org Tue Jan 26 13:59:15 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBC524EF11B for ; Tue, 26 Jan 2021 13:59:15 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DQ7dH2Rlvz3svl; Tue, 26 Jan 2021 13:59:15 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 10QDvssr095194; Tue, 26 Jan 2021 05:57:54 -0800 (PST) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 10QDvrJL095193; Tue, 26 Jan 2021 05:57:53 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <202101261357.10QDvrJL095193@gndrsh.dnsmgr.net> Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout In-Reply-To: <834af55b-0935-ec2f-784c-3874cd05ba75@gmail.com> To: "Alejandro Colomar (man-pages)" Date: Tue, 26 Jan 2021 05:57:53 -0800 (PST) CC: Bernhard Voelker , Coreutils , Fabrice BAUZAC , Otto Moerbeek , Alex Henrie , juli@clockworksquid.com, Jeffrey Walton , freebsd-hackers@freebsd.org, William Ahern , Roman Czyborra , oshogbo@freebsd.org, tech@openbsd.org, Christian Groessler , linux-api@vger.kernel.org, Michael Kerrisk , ed@nuxi.nl, Eric Pruitt X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4DQ7dH2Rlvz3svl X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Tue, 26 Jan 2021 18:11:26 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2021 13:59:15 -0000 > Hi Berny, > > On 1/25/21 12:33 PM, Alejandro Colomar (man-pages) wrote: > > On 1/25/21 5:03 AM, Bernhard Voelker wrote: > >> On 1/24/21 9:01 PM, Alex Henrie wrote: > >>> I am definitely interested. Bernhard Voelker seemed to express > >>> interest as well, conditional on -q being added to POSIX first.[1] > >> > >> Just to clarify: I'm not as enthusiastic to add that option as it > >> may have sounded. > >> > >> Let me put it like this: if -q once gets standardized by POSIX, > >> then we'd take it over in the GNU tee implementation. > >> > >> Let me summarize so far: > >> The suggestion is to solve the problem to save some data coming from > >> a pipe as a different user. > >> There are at least those known solutions: > >> ?? - use > or >> redirection. > >> ?? - use dd(1) > >> > >> I have the impression that a home for this feature was searched > >> in any tool, and as tee(1) already knew how to write to a file, > >> had the "append" feature, and is often used in pipes, it was > >> tempting to add it there. > >> > >> But looking deeper, --quiet doesn't seem to fit well into 'tee'. > >> It even contradicts to the title line in the man page: > >> ?? "read from standard input and write to standard output and files" > >> > >> An off-tech argument: ask a local plumber if he'd would ever use > >> a tee piece instead of a pipe end piece.? I guess he would only > >> if he wouldn't have anything else at hand. > > > > I never knew what 'tee' meant.? That makes sense now. > > > >> > >> A word to the proposed patch: what should happen, if the user does > >> not give a file? > >> ?? A | B | tee -q > >> The patch just silently ignored that situation which feels wrong. > >> > >> Therefore, adding a feature which does not really fit is wrong, and > >> contradicts the one-tool-for-one-purpose UNIX philosophy. > >> > > > > Agreed. > > > >> OTOH I understand that there's a little gap in the tool landscape. > >> Astonishingly, there doesn't seem to exist a trivial tool to redirect > >> from standard input (or any other input file descriptor) to a file. > >> I wrote such a little tool in the attached: > >> > >> ?? $ src/sink --help > >> ?? Usage: src/sink [OPTION]... FILE > >> ?? Copy input stream to FILE. > >> > >> ?? Mandatory arguments to long options are mandatory for short options > >> too. > >> > >> ???? -a, --append????????????? append to the given FILE, do not overwrite > >> ???? -c, --create????????????? ensure to create FILE, error if exists > >> ???? -i, --input-stream=FD???? read from stream FD instead of standard > >> input > > > On second thought, this program does two things: read any FD, and write > to file. I think it should be limited to writing to a file from stdin. > > If you think there's a need for reading FDs other than 0, you might as > well want to pipe that information you're reading from them to filter it > with another tool, and this program doesn't allow you to do that, as > it's a sink. > > So, I would remove '-i, --input-stream'. (And if you think it's > missing, maybe write a program to read from any FD and write to stdout.) Its name is cat(1) cat /dev/fd/# >outputfile > > Alex > > > >> > >> ?? The default input stream number FD is 0, representing the standard > >> input. > >> > >> This allows not only to copy data from standard input, but from any > >> file descriptor open for reading.? It also allows control over > >> how the output file will be opened (e.g. with O_CREAT|E_EXCL). > >> > >> The OPs case would look like: > >> > >> ?? echo 'foo' | sudo sink /etc/foo > >> or > >> ?? echo 'foo' | sudo sink -a /etc/foo? # append. > >> or > >> ?? echo 'foo' | sudo sink -c /etc/foo? # ensure creation of the file. > >> > >> I'm not sure if this will ever be considered for inclusion - > >> I just did it "for fun". ;-) > > > > Tested-by: Alejandro Colomar > > Reviewed-by: Alejandro Colomar > > > > Much better than my patch.? :-) > > > >> > >> Have a nice day, > >> Berny > >> > > > > Have a nice day! > > Alex > > > > > > -- > > Alejandro Colomar > > Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ > > http://www.alejandro-colomar.es/ > > > -- > -- > Alejandro Colomar > Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ > http://www.alejandro-colomar.es/ > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > -- Rod Grimes rgrimes@freebsd.org From owner-freebsd-hackers@freebsd.org Wed Jan 27 01:40:59 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DDBD4E98C4 for ; Wed, 27 Jan 2021 01:40:59 +0000 (UTC) (envelope-from alexhenrie24@gmail.com) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DQRBy4Vgwz4n2f; Wed, 27 Jan 2021 01:40:58 +0000 (UTC) (envelope-from alexhenrie24@gmail.com) Received: by mail-ej1-x636.google.com with SMTP id ox12so425971ejb.2; Tue, 26 Jan 2021 17:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kmG6RY7BcaGv1lUjf2k1d39NdU3p9zWFX78N7nxH8OY=; b=kxgKmFLoRAg8u7ZqzFVVRXWa+eYvi7tyiJnRbD+V3vbf7C11Ixv7YaG27sw70Rmm9Z eiqxUpYPYrKFaxhiD/P9m+mNcl6qNhfNB1NZBryr3pVnPp+XXPDdVpzm04J9evyZKCnT SmgxrBmVFGDM0wUkGtxwtq2IGGg7rUijXbrQtotudZLfM3xBFY3tT8fM7kb8v+3MMbaP qjA9wCTvI2+8/dl/gozUdOmwA3zkYwLf0al/LKr6TCuQqYg0zsrhGejEZIuk9HqUy6MJ kxNIUHnIASv9wObEtBOUIQgQCO4BaSQBarlWcWGu6JIrkw7c6M7cNyRuQdTiMwyCoNPs frPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kmG6RY7BcaGv1lUjf2k1d39NdU3p9zWFX78N7nxH8OY=; b=WN3/x2qfEWZjJI9vzmnRVL5XYBfl2rx4drNrW6RPDG3B2yVcZzIg1PYcuTvjA++JQw zQBG9lvx0bvkkCIsci71N/0yBqsUxjp8hO/a7c+AhZvAsHd8Nr/LeKq3aIpqZuXjcWPT aAfe9W9s1pJ0pt5hy/+q51/1rMy2sQZjnDid0hWMsQfJE+7uBUTIfG/lgYEsiEMOCXHq 91yXjB+8XafSK5FGbw7s6zHpWNdam3DAFqdRvTsbefDou62EzEAt5ACrpGIN1UKMtDH/ UNyRtHDqwGtR82mHwaGY2W0z+kHTQlz4Qs2T7trFAY1J8PLCCQgm3K6y5WPSZmQpbxOZ 6IHA== X-Gm-Message-State: AOAM532j/iHNzCyt7PqJmlfOZqMLm+Hci6+nCTntdkKRiDQOaDY0edqf e0NZph+xDjkYHUT8D4EZfS3GLhUjaJHdQX7PBxo= X-Google-Smtp-Source: ABdhPJwQp8zDSp8NHgkR/bu+tt/PuRRt99Gok7ZNnvDmSqlKILvGi5L0SmBS3QDtMLL532yqO8qbN6pPFigzw15lCf8= X-Received: by 2002:a17:906:1719:: with SMTP id c25mr5362886eje.251.1611711657094; Tue, 26 Jan 2021 17:40:57 -0800 (PST) MIME-Version: 1.0 References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> In-Reply-To: From: Alex Henrie Date: Tue, 26 Jan 2021 18:40:45 -0700 Message-ID: Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: Bernhard Voelker Cc: Otto Moerbeek , Coreutils , Alejandro Colomar , Fabrice BAUZAC , Juli Mallett , Jeffrey Walton , freebsd-hackers@freebsd.org, William Ahern , Roman Czyborra , oshogbo@freebsd.org, tech@openbsd.org, Christian Groessler , linux-api@vger.kernel.org, Michael Kerrisk , Ed Schouten , Eric Pruitt Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DQRBy4Vgwz4n2f X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=kxgKmFLo; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of alexhenrie24@gmail.com designates 2a00:1450:4864:20::636 as permitted sender) smtp.mailfrom=alexhenrie24@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; MAILMAN_DEST(0.00)[freebsd-hackers]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::636:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::636:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[17]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::636:from]; FREEMAIL_CC(0.00)[drijf.net,gnu.org,gmail.com,mykolab.com,clockworksquid.com,freebsd.org,25thandclement.com,czyborra.com,openbsd.org,groessler.org,vger.kernel.org,nuxi.nl]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; RCVD_COUNT_TWO(0.00)[2] X-Mailman-Approved-At: Wed, 27 Jan 2021 09:25:03 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jan 2021 01:40:59 -0000 On Sun, Jan 24, 2021 at 9:04 PM Bernhard Voelker wrote: > > An off-tech argument: ask a local plumber if he'd would ever use > a tee piece instead of a pipe end piece. I guess he would only > if he wouldn't have anything else at hand. According to POSIX, tee writes to "zero or more files."[1] So the "local plumber" analogy already doesn't hold, because a plumber would never put in a tee and then immediately cap it off so that the flow can only go to one place, but commands like `echo foo | tee | tee | tee` are already explicitly allowed. > A word to the proposed patch: what should happen, if the user does > not give a file? > A | B | tee -q > The patch just silently ignored that situation which feels wrong. Personally, I like the idea of only having to type `echo foo | tee -q` instead of `echo foo > /dev/null`, so I think the patch indeed does the right thing in that case. -Alex [1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tee.html From owner-freebsd-hackers@freebsd.org Wed Jan 27 12:45:01 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D32E14F8376 for ; Wed, 27 Jan 2021 12:45:01 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DQjx93HXxz4SHC; Wed, 27 Jan 2021 12:45:01 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 10RChr7T099269; Wed, 27 Jan 2021 04:43:53 -0800 (PST) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 10RChrM2099268; Wed, 27 Jan 2021 04:43:53 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <202101271243.10RChrM2099268@gndrsh.dnsmgr.net> Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout In-Reply-To: To: Alex Henrie Date: Wed, 27 Jan 2021 04:43:53 -0800 (PST) CC: Bernhard Voelker , Otto Moerbeek , Coreutils , Alejandro Colomar , Fabrice BAUZAC , Juli Mallett , Jeffrey Walton , freebsd-hackers@freebsd.org, William Ahern , Roman Czyborra , oshogbo@freebsd.org, tech@openbsd.org, Christian Groessler , linux-api@vger.kernel.org, Michael Kerrisk , Ed Schouten , Eric Pruitt X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4DQjx93HXxz4SHC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Thu, 28 Jan 2021 06:38:17 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jan 2021 12:45:01 -0000 > On Sun, Jan 24, 2021 at 9:04 PM Bernhard Voelker > wrote: > > > > An off-tech argument: ask a local plumber if he'd would ever use > > a tee piece instead of a pipe end piece. I guess he would only > > if he wouldn't have anything else at hand. > > According to POSIX, tee writes to "zero or more files."[1] So the > "local plumber" analogy already doesn't hold, because a plumber would > never put in a tee and then immediately cap it off so that the flow Actually plumbers do this all the time, its a stub out for future additions/alterations. There is also a special case of it done when plumbing air/gas lines called a trap. > can only go to one place, but commands like `echo foo | tee | tee | > tee` are already explicitly allowed. > > > A word to the proposed patch: what should happen, if the user does > > not give a file? > > A | B | tee -q > > The patch just silently ignored that situation which feels wrong. > > Personally, I like the idea of only having to type `echo foo | tee -q` > instead of `echo foo > /dev/null`, so I think the patch indeed does > the right thing in that case. > > -Alex > > [1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tee.html > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > -- Rod Grimes rgrimes@freebsd.org From owner-freebsd-hackers@freebsd.org Thu Jan 28 19:33:32 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 484B04E86E0; Thu, 28 Jan 2021 19:33:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRVy41bmsz4Z9x; Thu, 28 Jan 2021 19:33:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (c-98-35-218-221.hsd1.ca.comcast.net [98.35.218.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id D83E93F8C; Thu, 28 Jan 2021 19:33:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: announce@FreeBSD.org, freebsd-hackers@FreeBSD.org From: John Baldwin Reply-To: freebsd-hackers@FreeBSD.org Subject: FreeBSD/i386 demoted to Tier 2 for FreeBSD 13.x Message-ID: <5498cb6b-e00d-6899-6955-d551b37b9013@FreeBSD.org> Date: Thu, 28 Jan 2021 11:33:30 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2021 19:33:32 -0000 FreeBSD is designating i386 as a Tier 2 architecture starting with FreeBSD 13.0. The Project will continue to provide release images, binary updates, and pre-built packages for the 13.x branch. However, i386-specific issues (including SAs) may not be addressed in 13.x. The i386 platform will remain Tier 1 on FreeBSD 11.x and 12.x. More background: The i386 (32-bit x86) architecture has been a substantial part of the FreeBSD Project’s history and success. FreeBSD began with i386 as the only supported architecture, and the ease of availability of i386 computers was key to FreeBSD’s growth and adoption. However, the computer industry and the x86 architecture have evolved over time. For at least the past decade, 64-bit x86 has been the dominant FreeBSD architecture both in terms of users and active development. The FreeBSD/i386 user base has steadily declined and is now on par with other Tier 2 architectures. As a result, the i386 architecture will be demoted to a Tier 2 architecture starting with FreeBSD 13.0. Due to i386’s history as a Tier 1 architecture and it’s existing install base, the Project will continue to provide a high level of support for i386 in FreeBSD 13.x. This will give existing i386 users extra time to migrate to a fully-supported architecture for future FreeBSD releases. For FreeBSD 13.x, the FreeBSD project commits to providing release images, binary updates, and pre-built packages for i386. The FreeBSD Release Engineering and Security Teams will continue to build, test, and distribute EN and SA artifacts for i386 alongside all other supported platforms. However, EN and SA issues that are specific to i386, or that require unique development for i386, may not be addressed. The userland ABI will continue to be preserved in 13.x similar to other Tier 1 platforms. For branches beyond 13.x (e.g. 14.x), the FreeBSD Project reserves the right to reduce the amount of support provided. We anticipate that i386 will receive reduced support inline with existing Tier 2 platforms for 14.x, and will announce the level of support i386 will receive in 14.x as we are closer to the 14.0 release date. Due to the prevalence of existing i386 binaries, we also anticipate that we will avoid breaking the userland ABI in future branches. Specifically, we expect that time_t will remain 32 bits on i386. Support for i386 on currently-supported FreeBSD branches (11.x and 12.x) will continue at their current Tier 1 level for the duration of their support lifetime. On behalf of the FreeBSD core, port manager, release engineering, and security teams, -- John Baldwin From owner-freebsd-hackers@freebsd.org Thu Jan 28 19:53:49 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69C274EB7B2 for ; Thu, 28 Jan 2021 19:53:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRWPT2cTPz4cf0 for ; Thu, 28 Jan 2021 19:53:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (c-98-35-218-221.hsd1.ca.comcast.net [98.35.218.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0465742DB for ; Thu, 28 Jan 2021 19:53:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: freebsd-hackers@freebsd.org References: From: John Baldwin Subject: Re: arc wrapper for tracking phabricator reviews Message-ID: <3c372d16-3aea-5291-c23a-f49e9e9a8edc@FreeBSD.org> Date: Thu, 28 Jan 2021 11:53:48 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2021 19:53:49 -0000 On 1/25/21 9:58 AM, Mark Johnston wrote: > Hi, > > For the past while I've been using a script, git arc, to automate some > of my interactions with Phabricator. A few other developers have found > it useful so it seems time to make it more accessible by committing it > to the src tree. > > The script is here: https://reviews.freebsd.org/D28334 > > The basic idea is to make it simple to create and update Phabricator > reviews from git commits, without adding any metadata to your git > repository so as to stay as flexible as possible. In particular, I tend > to rebase sets of commits regularly so things like notes and branch > pointers end up being invalidated. > > git arc lets you > - Create reviews from a series of commits. It automatically creates > parent/child pointers between consecutive Differential revisions. > - Update reviews after amending commits based on reviewer feedback. > - Stage commits in preparation for pushing to the upstream repository. > This automatically adds "Reviewed by:" and "Differential Revision:" > tags. > See the rather verbose usage message for more details. > > To map git commits to phabricator revisions it uses commit summaries. > This is kind of gross but I don't see a better way to do it that doesn't > involve adding metadata to my git tree, and it seems to work fine in > practice. In general git arc wraps the functionality of arc, though in > some cases it uses jq and arc's "call-conduit" functionality to call > into the lower-level Phabricator APIs. > > There exists a script with similar goals, arcgit, in the tools/ dir. I > used it for a while but found that with its workflow I still had to do a > fair bit of manual work to keep phabricator in sync with my commits. > I'm not sure how best to reconcile the two scripts. It would be better > for new developers to not have to choose between them. The main > advantage of arcgit is that it helps maintain large patch stacks by > making it easier to edit intermediate commits in response to review > feedback. In particular, it adds a branch for each review posted to > phabricator, so it's a bit easier to go back and edit a particular > commit, but I believe this assumes that you aren't rebasing your branch. > > I'd appreciate any feedback/suggestions/complaints regarding the new > script, especially if you use arcgit today. > > Thanks to jhb for submitting a number of improvements and suggesting a > few others that I implemented recently. Some quick recipes from my experience. Note that you need to run these in a git checkout (or a worktree): If you have a single commit you want to eventually commit, the workflow would be something like this: 1) git arc create 2) When you get feedback, amend the original commit, then do git arc update 3) Once the change is ready: git arc stage This will checkout 'main' and cherry-pick the commit on to 'main'. It will also amend the commit log to include the 'Reviewed by:' line from phab along with the Phab URL and open your editor with the updated commit log so you can clean it up if needed. You will be left checked out on your main and can now do git push freebsd To push the change. If you are working with a branch, you can use git arc to upload the entire branch as a patch series of related reviews (which show up as a "Stack" in phabricator). For this the workflow is somewhat similar: 1) git arc create main.. When you get review feedback, you can do fixup commits (e.g. git commit --fixup ) and then do a 'rebase -i --autosquash' to squash them back down. You can then do 'git arc update ' listing the hashes of the commits you've changed. You might even be able to do 'git arc update main..' but I haven't tried that. 3) Once the series is ready: git arc stage main.. This will let you edit each commit log appending the phab metadata. You can then 'git push freebsd'. A few other notes: create -l) If you have a branch with several commits, you might not want to review all the diffs of each change when creating the reviews, but just the list of commits. The '-l' flag to 'git arc create' will do that, i.e. 'git arc create -l main..' list) You can determine the status of commits via 'git arc list'. This can be handy to figure out the state of commits in a branch, e.g.: > git arc list main..chacha20_poly1035_aead f0de84910927 Accepted D27836: Add an OCF algorithm for ChaCha20-Poly1035 AEAD. 9b55e0d60438 Needs Review D27837: Add an implementation of CHACHA20_POLY1035 to cryptosoft. 09035ad3b7d2 Needs Review D27838: Add Chacha20-Poly1305 AEAD coverage. 011529f781c7 Accepted D27839: Add Chacha20-Poly1305 as a KTLS cipher suite. 5f513f0e8e66 Needs Review D27841: Add Chacha20-Poly1305 support in the OCF backend for KTLS. d8cb9e648fbe No Review : cryptosoft: Support per-op keys for AES-GCM and AES-CCM. Here you can see that this branch has 2 accepted commits, 3 still waiting for review, and 1 commit I've added since the initial upload that I haven't yet uploaded for review. adding/removing patches) If you add a new patch to a series, you will need to 'git arc create ' to upload the new patch and then use the web UI to hook it into the stack. If you remove a patch from a series, you will need to abandon the associated review via the web UI. subject lines) git arc finds the matching review first by checking for a Phab URL in the commit log. If it doesn't find one, it compares each commit's subject line to the commits listed by 'arc list' to find a match. If you reword a commit's subject line, you will either need to add the phab URL to the commit log by hand or update the commit log in phab. staging branches) If you already have 'main' checked out somewhere else, you will want to either run 'git arc stage' in that work tree, or ask 'git arc stage' to create a new branch off of main to stage the commits to. You can do this via '-b', e.g. 'git arc stage -b staging main..' will create a new 'staging' branch and stage all of the commits from 'branch' into it. You can then push that via 'git push freebsd HEAD:main'. stable branches) Currently 'git arc stage' hardcodes main. It probably should take a new option (-B?) to set the "base" branch to work with patches that are direct commits to stable and releng branches. -- John Baldwin From owner-freebsd-hackers@freebsd.org Thu Jan 28 23:57:54 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C79874F174F; Thu, 28 Jan 2021 23:57:54 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRcq65HwHz4skx; Thu, 28 Jan 2021 23:57:54 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.not-for.work (onlyone.not-for.work [148.251.9.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: lev/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 8EFC0618A; Thu, 28 Jan 2021 23:57:54 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from [IPv6:2001:470:923f:1:40b6:c8cd:a69f:2276] (unknown [IPv6:2001:470:923f:1:40b6:c8cd:a69f:2276]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.not-for.work (Postfix) with ESMTPSA id 8736EA41A; Fri, 29 Jan 2021 02:57:51 +0300 (MSK) To: freebsd-stable@freebsd.org, FreeBSD Hackers Reply-To: lev@FreeBSD.org From: Lev Serebryakov Subject: `clang -pg` generates binary which coredumps on start Organization: FreeBSD Message-ID: <61cebbd1-4e8d-d9d7-dda2-388e81e61599@FreeBSD.org> Date: Fri, 29 Jan 2021 02:57:50 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2021 23:57:54 -0000 I'm trying to profile my user-level program on FreeBSD 12-STABLE (amd64). When I build it with `cc -g -pg -O3` it coredumps on start. What do I do wrong? (lldb) bt * thread #1, name = 'mergenets', stop reason = signal SIGSEGV * frame #0: 0x0000000000000000 frame #1: 0x000000000028ebbf mergenets`__vdso_gettc(th=0x00007ffffffff270, tc=0x00007fffffffddbc) at __vdso_gettc.c:0 frame #2: 0x000000000028e8c3 mergenets`binuptime [inlined] tc_delta(th=) at __vdso_gettimeofday.c:46:10 frame #3: 0x000000000028e8ba mergenets`binuptime(bt=0x00007fffffffde08, tk=0x00007ffffffff1b0, abs=0) at __vdso_gettimeofday.c:78 frame #4: 0x000000000028ea73 mergenets`__vdso_clock_gettime(clock_id=4, ts=0x00007fffffffde68) at __vdso_gettimeofday.c:165:10 frame #5: 0x0000000000281efb mergenets`__clock_gettime(clock_id=4, ts=0x00007fffffffde68) at clock_gettime.c:48:11 frame #6: 0x000000000024339f mergenets`nstime_update_impl [inlined] nstime_get(time=0x0000000800403a88) at jemalloc_nstime.c:128:2 frame #7: 0x0000000000243395 mergenets`nstime_update_impl(time=0x0000000800403a88) at jemalloc_nstime.c:160 frame #8: 0x0000000000234b6d mergenets`__je_arena_new [inlined] arena_decay_reinit(decay=0x0000000800403a20, decay_ms=) at jemalloc_arena.c:572:2 frame #9: 0x0000000000234b21 mergenets`__je_arena_new [inlined] arena_decay_init(decay=0x0000000800403a20, decay_ms=, stats=0x00000008004009a0) at jemalloc_arena.c:593 frame #10: 0x0000000000234b1a mergenets`__je_arena_new(tsdn=0x0000000000000000, ind=0, extent_hooks=) at jemalloc_arena.c:1858 frame #11: 0x00000000002239c0 mergenets`__je_arena_init [inlined] arena_init_locked(tsdn=0x0000000000000000, ind=0, extent_hooks=0x0000000000205778) at jemalloc_jemalloc.c:338:10 frame #12: 0x00000000002239b2 mergenets`__je_arena_init(tsdn=0x0000000000000000, ind=0, extent_hooks=0x0000000000205778) at jemalloc_jemalloc.c:366 frame #13: 0x000000000022f946 mergenets`malloc_init_hard_a0_locked at jemalloc_jemalloc.c:1328:6 frame #14: 0x0000000000222cf5 mergenets`a0ialloc [inlined] malloc_init_hard_a0 at jemalloc_jemalloc.c:1343:8 frame #15: 0x0000000000222caa mergenets`a0ialloc [inlined] malloc_init_a0 at jemalloc_jemalloc.c:214 frame #16: 0x0000000000222caa mergenets`a0ialloc(size=6223, zero=false, is_internal=false) at jemalloc_jemalloc.c:234 frame #17: 0x00000000002225fc mergenets`__libc_allocate_tls [inlined] malloc_aligned(size=6200, align=16) at tls.c:135:8 frame #18: 0x00000000002225e2 mergenets`__libc_allocate_tls(oldtls=0x0000000000000000, tcbsize=, tcbalign=) at tls.c:359 frame #19: 0x00000000002227d0 mergenets`_init_tls at tls.c:469:8 frame #20: 0x000000000021f234 mergenets`_start(ap=, cleanup=) at crt1.c:66:3 -- // Lev Serebryakov From owner-freebsd-hackers@freebsd.org Fri Jan 29 07:47:56 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6642D4E09C9; Fri, 29 Jan 2021 07:47:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRqFS2N09z4TsX; Fri, 29 Jan 2021 07:47:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 285E19A52; Fri, 29 Jan 2021 07:47:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::a911:60a6:1ec1:f9c] (unknown [IPv6:2001:470:7a58:0:a911:60a6:1ec1:f9c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id EF24358E9F; Fri, 29 Jan 2021 08:47:54 +0100 (CET) From: Dimitry Andric Message-Id: <4A2DB8CA-F152-47F4-A546-50162D206DC0@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_E0B32DCF-D040-4AF1-B968-0C2F20B75892"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: `clang -pg` generates binary which coredumps on start Date: Fri, 29 Jan 2021 08:47:44 +0100 In-Reply-To: <61cebbd1-4e8d-d9d7-dda2-388e81e61599@FreeBSD.org> Cc: FreeBSD-STABLE Mailing List , FreeBSD Hackers To: "lev@freebsd.org" References: <61cebbd1-4e8d-d9d7-dda2-388e81e61599@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.17) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2021 07:47:56 -0000 --Apple-Mail=_E0B32DCF-D040-4AF1-B968-0C2F20B75892 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 29 Jan 2021, at 00:57, Lev Serebryakov wrote: >=20 > I'm trying to profile my user-level program on FreeBSD 12-STABLE = (amd64). When I build it with `cc -g -pg -O3` it coredumps on start. = What do I do wrong? >=20 > (lldb) bt > * thread #1, name =3D 'mergenets', stop reason =3D signal SIGSEGV > * frame #0: 0x0000000000000000 > frame #1: 0x000000000028ebbf = mergenets`__vdso_gettc(th=3D0x00007ffffffff270, tc=3D0x00007fffffffddbc) = at __vdso_gettc.c:0 > frame #2: 0x000000000028e8c3 mergenets`binuptime [inlined] = tc_delta(th=3D) at __vdso_gettimeofday.c:46:10 > frame #3: 0x000000000028e8ba = mergenets`binuptime(bt=3D0x00007fffffffde08, tk=3D0x00007ffffffff1b0, = abs=3D0) at __vdso_gettimeofday.c:78 > frame #4: 0x000000000028ea73 = mergenets`__vdso_clock_gettime(clock_id=3D4, ts=3D0x00007fffffffde68) at = __vdso_gettimeofday.c:165:10 > frame #5: 0x0000000000281efb mergenets`__clock_gettime(clock_id=3D4, = ts=3D0x00007fffffffde68) at clock_gettime.c:48:11 > frame #6: 0x000000000024339f mergenets`nstime_update_impl [inlined] = nstime_get(time=3D0x0000000800403a88) at jemalloc_nstime.c:128:2 > frame #7: 0x0000000000243395 = mergenets`nstime_update_impl(time=3D0x0000000800403a88) at = jemalloc_nstime.c:160 > frame #8: 0x0000000000234b6d mergenets`__je_arena_new [inlined] = arena_decay_reinit(decay=3D0x0000000800403a20, decay_ms=3D) = at jemalloc_arena.c:572:2 > frame #9: 0x0000000000234b21 mergenets`__je_arena_new [inlined] = arena_decay_init(decay=3D0x0000000800403a20, decay_ms=3D, = stats=3D0x00000008004009a0) at jemalloc_arena.c:593 > frame #10: 0x0000000000234b1a = mergenets`__je_arena_new(tsdn=3D0x0000000000000000, ind=3D0, = extent_hooks=3D) at jemalloc_arena.c:1858 > frame #11: 0x00000000002239c0 mergenets`__je_arena_init [inlined] = arena_init_locked(tsdn=3D0x0000000000000000, ind=3D0, = extent_hooks=3D0x0000000000205778) at jemalloc_jemalloc.c:338:10 > frame #12: 0x00000000002239b2 = mergenets`__je_arena_init(tsdn=3D0x0000000000000000, ind=3D0, = extent_hooks=3D0x0000000000205778) at jemalloc_jemalloc.c:366 > frame #13: 0x000000000022f946 mergenets`malloc_init_hard_a0_locked = at jemalloc_jemalloc.c:1328:6 > frame #14: 0x0000000000222cf5 mergenets`a0ialloc [inlined] = malloc_init_hard_a0 at jemalloc_jemalloc.c:1343:8 > frame #15: 0x0000000000222caa mergenets`a0ialloc [inlined] = malloc_init_a0 at jemalloc_jemalloc.c:214 > frame #16: 0x0000000000222caa mergenets`a0ialloc(size=3D6223, = zero=3Dfalse, is_internal=3Dfalse) at jemalloc_jemalloc.c:234 > frame #17: 0x00000000002225fc mergenets`__libc_allocate_tls = [inlined] malloc_aligned(size=3D6200, align=3D16) at tls.c:135:8 > frame #18: 0x00000000002225e2 = mergenets`__libc_allocate_tls(oldtls=3D0x0000000000000000, = tcbsize=3D, tcbalign=3D) at tls.c:359 > frame #19: 0x00000000002227d0 mergenets`_init_tls at tls.c:469:8 > frame #20: 0x000000000021f234 mergenets`_start(ap=3D, = cleanup=3D) at crt1.c:66:3 Likely https://bugs.freebsd.org/249121 (and maybe = https://bugs.llvm.org/show_bug.cgi?id=3D48165). -Dimitry --Apple-Mail=_E0B32DCF-D040-4AF1-B968-0C2F20B75892 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYBO9oAAKCRCwXqMKLiCW o6TKAJ9SqcJppfE1Qrz0gLc1DtZWB8bDVgCcDcRyV8JDDjYsgak751Vd8u4kBR4= =uWXR -----END PGP SIGNATURE----- --Apple-Mail=_E0B32DCF-D040-4AF1-B968-0C2F20B75892-- From owner-freebsd-hackers@freebsd.org Fri Jan 29 09:56:53 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B96D24E4CB6; Fri, 29 Jan 2021 09:56:53 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRt6F4xzhz4d2V; Fri, 29 Jan 2021 09:56:53 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.not-for.work (onlyone.not-for.work [IPv6:2a01:4f8:201:6350::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: lev/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 825B8AB58; Fri, 29 Jan 2021 09:56:53 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from [192.168.134.16] (unknown [94.19.224.8]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.not-for.work (Postfix) with ESMTPSA id 67BEBA4B9; Fri, 29 Jan 2021 12:56:50 +0300 (MSK) Reply-To: lev@FreeBSD.org Subject: Re: `clang -pg` generates binary which coredumps on start To: Dimitry Andric Cc: FreeBSD-STABLE Mailing List , FreeBSD Hackers References: <61cebbd1-4e8d-d9d7-dda2-388e81e61599@FreeBSD.org> <4A2DB8CA-F152-47F4-A546-50162D206DC0@FreeBSD.org> From: Lev Serebryakov Organization: FreeBSD Message-ID: Date: Fri, 29 Jan 2021 12:56:49 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <4A2DB8CA-F152-47F4-A546-50162D206DC0@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2021 09:56:53 -0000 On 29.01.2021 10:47, Dimitry Andric wrote: >> I'm trying to profile my user-level program on FreeBSD 12-STABLE (amd64). When I build it with `cc -g -pg -O3` it coredumps on start. What do I do wrong? >> >> (lldb) bt >> * thread #1, name = 'mergenets', stop reason = signal SIGSEGV >> * frame #0: 0x0000000000000000 >> frame #1: 0x000000000028ebbf mergenets`__vdso_gettc(th=0x00007ffffffff270, tc=0x00007fffffffddbc) at __vdso_gettc.c:0 >> frame #2: 0x000000000028e8c3 mergenets`binuptime [inlined] tc_delta(th=) at __vdso_gettimeofday.c:46:10 >> frame #3: 0x000000000028e8ba mergenets`binuptime(bt=0x00007fffffffde08, tk=0x00007ffffffff1b0, abs=0) at __vdso_gettimeofday.c:78 >> frame #4: 0x000000000028ea73 mergenets`__vdso_clock_gettime(clock_id=4, ts=0x00007fffffffde68) at __vdso_gettimeofday.c:165:10 >> frame #5: 0x0000000000281efb mergenets`__clock_gettime(clock_id=4, ts=0x00007fffffffde68) at clock_gettime.c:48:11 >> frame #6: 0x000000000024339f mergenets`nstime_update_impl [inlined] nstime_get(time=0x0000000800403a88) at jemalloc_nstime.c:128:2 >> frame #7: 0x0000000000243395 mergenets`nstime_update_impl(time=0x0000000800403a88) at jemalloc_nstime.c:160 >> frame #8: 0x0000000000234b6d mergenets`__je_arena_new [inlined] arena_decay_reinit(decay=0x0000000800403a20, decay_ms=) at jemalloc_arena.c:572:2 >> frame #9: 0x0000000000234b21 mergenets`__je_arena_new [inlined] arena_decay_init(decay=0x0000000800403a20, decay_ms=, stats=0x00000008004009a0) at jemalloc_arena.c:593 >> frame #10: 0x0000000000234b1a mergenets`__je_arena_new(tsdn=0x0000000000000000, ind=0, extent_hooks=) at jemalloc_arena.c:1858 >> frame #11: 0x00000000002239c0 mergenets`__je_arena_init [inlined] arena_init_locked(tsdn=0x0000000000000000, ind=0, extent_hooks=0x0000000000205778) at jemalloc_jemalloc.c:338:10 >> frame #12: 0x00000000002239b2 mergenets`__je_arena_init(tsdn=0x0000000000000000, ind=0, extent_hooks=0x0000000000205778) at jemalloc_jemalloc.c:366 >> frame #13: 0x000000000022f946 mergenets`malloc_init_hard_a0_locked at jemalloc_jemalloc.c:1328:6 >> frame #14: 0x0000000000222cf5 mergenets`a0ialloc [inlined] malloc_init_hard_a0 at jemalloc_jemalloc.c:1343:8 >> frame #15: 0x0000000000222caa mergenets`a0ialloc [inlined] malloc_init_a0 at jemalloc_jemalloc.c:214 >> frame #16: 0x0000000000222caa mergenets`a0ialloc(size=6223, zero=false, is_internal=false) at jemalloc_jemalloc.c:234 >> frame #17: 0x00000000002225fc mergenets`__libc_allocate_tls [inlined] malloc_aligned(size=6200, align=16) at tls.c:135:8 >> frame #18: 0x00000000002225e2 mergenets`__libc_allocate_tls(oldtls=0x0000000000000000, tcbsize=, tcbalign=) at tls.c:359 >> frame #19: 0x00000000002227d0 mergenets`_init_tls at tls.c:469:8 >> frame #20: 0x000000000021f234 mergenets`_start(ap=, cleanup=) at crt1.c:66:3 > > Likely https://bugs.freebsd.org/249121 (and maybe https://bugs.llvm.org/show_bug.cgi?id=48165). I have r367937, and 249121 was fixed in r365654... -- // Lev Serebryakov From owner-freebsd-hackers@freebsd.org Fri Jan 29 10:35:37 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCF934E5FE8 for ; Fri, 29 Jan 2021 10:35:37 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRtyx5TF5z4h5P for ; Fri, 29 Jan 2021 10:35:37 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.not-for.work (onlyone.not-for.work [IPv6:2a01:4f8:201:6350::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: lev/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 952D7A947 for ; Fri, 29 Jan 2021 10:35:37 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from [192.168.134.16] (unknown [94.19.224.8]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.not-for.work (Postfix) with ESMTPSA id 3CC02A4CA for ; Fri, 29 Jan 2021 13:35:36 +0300 (MSK) To: freebsd-hackers@freebsd.org Reply-To: lev@FreeBSD.org From: Lev Serebryakov Subject: Is here good documentation/tutorial about user-level profiling with `pmcstat' Organization: FreeBSD Message-ID: <602f671d-683d-d291-c8d2-f01526eca34b@FreeBSD.org> Date: Fri, 29 Jan 2021 13:35:35 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2021 10:35:37 -0000 I'm trying to use `pmcstat' to profile my userland (single threaded) program. And I can not find good instructions about how to use it. What event should I use for simple CPU profile? Is it cpu_clk_unhalted.thread or inst_retired.any or anything else? How to provide symbols from `/usr/lib/debug' to `pmcstat'? I've tried `pmcstat -R' but it doesn't see any function names outside my program: # pmcstat -R out-3.pmcstat -z100 -G out-3.stacks CONVERSION STATISTICS: #exec/elf 1 #samples/total 248539181 #samples/unknown-function 43228216 #callchain/dubious-frames 132121 # How could I filter-our kernel stacks? I don't need them (now) and they take a lot of space on flame graph. How could I drill-down to source-line-level (from per-function level) for some functions which take most of time? I've tried to Google but could not find any good documentation and `man pmcstat' is very terse. Thank you. -- // Lev Serebryakov From owner-freebsd-hackers@freebsd.org Fri Jan 29 12:48:24 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 410A44EB2AE for ; Fri, 29 Jan 2021 12:48:24 +0000 (UTC) (envelope-from marc@bumblingdork.com) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRxw73bxLz4rQD for ; Fri, 29 Jan 2021 12:48:23 +0000 (UTC) (envelope-from marc@bumblingdork.com) Received: by mail-ej1-x630.google.com with SMTP id rv9so12766709ejb.13 for ; Fri, 29 Jan 2021 04:48:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bumblingdork.com; s=google; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=AApOgk3F+QrMQa1NgASnSZZIa97GMqaOnogCGrFUOCc=; b=PVgLe0G0WDNjJ3uyON58vaiZlHYCFAxLbpJTH89ez1iEnKSATY65lCJMZJHGI2h5dT B8DRxP+L/D/6ElLOmyLgKO7x/Sve0OZ9VsHnThQISsF4oQvqUOyx6XBDCmIfMwXMSBXS Pb/AAIOmtLUzKxulyNAhcXoV3qUAzZ1gr9x3ofC+pa6HeMDS4tg3xkk5178sPwKLiAq/ ZTNG/dFq2dkgMYmuamS+K565dhHs0mS3j0dgvoOgSs2PWbqj3hxJjy/+ZKInBdxnoCOu QVHHbIzcBoGIGzxG+dGI3BbyD2HZwdbJKSF19aEIeI8Uyh/Pe2fiy3p82+RIW08Y3Fjd EZuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=AApOgk3F+QrMQa1NgASnSZZIa97GMqaOnogCGrFUOCc=; b=g4A7j3wlvURM//FtV2rDVDA19DECGi9/MY0qiG5CPIZbo7UVTqYrOW4/oSCh8TzaNh fvSmdZc0HndYOGegOv/Kqr/5GyqN21HooVdo0bCz0PBjcrXfOeiO8RWpjV3b6Ge4nY0N fcKB5nfSm4jMUbpMSAZ/nI4pQ26ttFnMLyzJSVbTKMsCm5GYSJKHEH9nU4a5dOXFNKQZ +m1wDgqV5AYQp9oEx//aSvmc0C6o96APCPtXkKwB2gEEeERWKyzz9MFGjex91asVI0bG Aady1jVo3LjsmT3ZGqNMRb6vzNM4rvcfBzauGlY65GLksyGWLDZPHvdOl4808zhYJ4BC zlIw== X-Gm-Message-State: AOAM532pCeSM8gayCke2+PN7TB8Wh9uybKtmGh9erjU31AYOdfam5bEi B8RFmZljnV2T4xSi5Ax4NGKIeCJh/5+xliyF X-Google-Smtp-Source: ABdhPJxqVfxws46ez+F7UePAwUyYLSU7QKC+vvDbjF9niDJFLEtAUBfUALODCx/q1aI9T9oz01HOTg== X-Received: by 2002:a17:906:eb1b:: with SMTP id mb27mr4561782ejb.332.1611924502046; Fri, 29 Jan 2021 04:48:22 -0800 (PST) Received: from ?IPv6:2001:981:3350:1:853f:7ccc:c213:c14e? ([2001:981:3350:1:853f:7ccc:c213:c14e]) by smtp.gmail.com with ESMTPSA id w4sm4544764eds.40.2021.01.29.04.48.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jan 2021 04:48:21 -0800 (PST) From: Marc Veldman Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Best way to submit patches for -current Message-Id: Date: Fri, 29 Jan 2021 13:48:21 +0100 To: freebsd-hackers@freebsd.org X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Rspamd-Queue-Id: 4DRxw73bxLz4rQD X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bumblingdork.com header.s=google header.b=PVgLe0G0; dmarc=pass (policy=none) header.from=bumblingdork.com; spf=pass (mx1.freebsd.org: domain of marc@bumblingdork.com designates 2a00:1450:4864:20::630 as permitted sender) smtp.mailfrom=marc@bumblingdork.com X-Spamd-Result: default: False [0.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[bumblingdork.com:+]; DMARC_POLICY_ALLOW(-0.50)[bumblingdork.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::630:from]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bumblingdork.com:s=google]; FREEFALL_USER(0.00)[marc]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::630:from:127.0.2.255]; NEURAL_SPAM_SHORT(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::630:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2021 12:48:24 -0000 Hello, now that FreeBSD has moved to Git, what is the recommended way to = provide patches? A GitHub or GitLab Merge Request against the FreeBSD main branch? Or a (set of) patches generated with git format-patch, the output of = gitt diff Or any other way? Best regards, Marc= From owner-freebsd-hackers@freebsd.org Sat Jan 30 19:04:46 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E71E4F6138 for ; Sat, 30 Jan 2021 19:04:46 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (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 4DSkCx3N4Wz3Bsr for ; Sat, 30 Jan 2021 19:04:45 +0000 (UTC) (envelope-from gonzo@bluezbox.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bluezbox.com; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=N1Yair7MDOokR/71qdoiVLRKtUdCMrZFpQx7vi1Xgpo=; b=bir7KV+jtQ+jXrX+14dii4/M0u lMjkeZXi8z1xCL2Fva0Gr5bjl0mInWXas+fB8EtjN+SasCgilOKa/vIoBmcN7j6wVqOswTLtysnC2 YSRI+FZErZ+CZ7KOzdkLSxf+b4OiHxwb1Pv4sdlcXqO3t3/5A0306Wsrw2N39F+lWUAk=; Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1l5vXx-0002Uw-Bp; Sat, 30 Jan 2021 11:04:37 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id 10UJ4aFq009605; Sat, 30 Jan 2021 11:04:36 -0800 (PST) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Sat, 30 Jan 2021 11:04:36 -0800 From: Oleksandr Tymoshenko To: Marc Veldman Cc: freebsd-hackers@freebsd.org Subject: Re: Best way to submit patches for -current Message-ID: <20210130190436.GA9142@bluezbox.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD/11.2-RELEASE-p10 (amd64) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Marc Veldman (marc@bumblingdork.com) wrote: > Hello, > > now that FreeBSD has moved to Git, what is the recommended way to provide patches? > A GitHub or GitLab Merge Request against the FreeBSD main [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Rspamd-Queue-Id: 4DSkCx3N4Wz3Bsr X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bluezbox.com header.s=mail header.b=bir7KV+j; dmarc=none; spf=pass (mx1.freebsd.org: domain of gonzo@bluezbox.com designates 45.55.20.155 as permitted sender) smtp.mailfrom=gonzo@bluezbox.com X-Spamd-Result: default: False [-3.49 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bluezbox.com:s=mail]; FREEFALL_USER(0.00)[gonzo]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; DMARC_NA(0.00)[bluezbox.com]; SPAMHAUS_ZRD(0.00)[45.55.20.155:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bluezbox.com:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.99)[-0.993]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[45.55.20.155:from]; ASN(0.00)[asn:14061, ipnet:45.55.0.0/19, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jan 2021 19:04:46 -0000 Marc Veldman (marc@bumblingdork.com) wrote: > Hello, > > now that FreeBSD has moved to Git, what is the recommended way to provide patches? > A GitHub or GitLab Merge Request against the FreeBSD main branch? > Or a (set of) patches generated with git format-patch, the output of gitt diff > Or any other way? Hi Marc, The preferred way to do this is to submit patches to Phabricator[1] I use Arcanist CLI (as described here[2]) to submit/update patches and Web UI to discuss review feedback. Don't forget to add developers to reviewers/Cc list since, unlike bugzilla, there is no general mailing list for new reviewes. If you're not sure who to add, create a review and send URL to a relevant mailing list. [1] https://reviews.freebsd.org/ [2] https://wiki.freebsd.org/Phabricator -- gonzo