From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 5 07:00:15 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19A50106566B for ; Thu, 5 Apr 2012 07:00:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CFE0A8FC12 for ; Thu, 5 Apr 2012 07:00:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3570ECx093793 for ; Thu, 5 Apr 2012 07:00:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3570EPF093791; Thu, 5 Apr 2012 07:00:14 GMT (envelope-from gnats) Date: Thu, 5 Apr 2012 07:00:14 GMT Message-Id: <201204050700.q3570EPF093791@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jeremie Le Hen Cc: Subject: Re: kern/154915: [libc] [patch] Force stdio output streams to line-buffered mode X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jeremie Le Hen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2012 07:00:15 -0000 The following reply was made to PR kern/154915; it has been noted by GNATS. From: Jeremie Le Hen To: Oliver Fromme Cc: bug-followup@FreeBSD.org, jeremie@le-hen.org Subject: Re: kern/154915: [libc] [patch] Force stdio output streams to line-buffered mode Date: Thu, 5 Apr 2012 08:55:00 +0200 Hi Oliver, I'm top-posting to let you handle this mail quickly. Can you please close this PR. The content is messy, the subject is misleading and I don't think these points will help the patch to be committed. I will open a new PR with the new patch that doesn't modify libc. Thanks. Regards, On Thu, Feb 16, 2012 at 02:49:50PM +0100, Oliver Fromme wrote: > I think introducing an environment variable for this purpose > is a bad hack. I would advise against this. > > Many tools already have options for unbuffered or line-buffered > output (for example cat -u), and there are also other ways to > circumvent such problems. > > For example, the problem quoted in the PR can be solved like this, > using the -u option of cat: > > $ iostat -x 1 | cat -un | grep ad1 > > or avoiding cat completely (also might be more efficient, > saving one process and one pipe, though I haven't benchmarked > this): > > $ iostat -x 1 | awk '{n+=1} /ad1/{print n, $0}' > > For certain other cases, I have the following alias in my ~/.zshrc > that simulates a TTY environment for a tool so it is forced to > use line-buffered output: > > alias intty='script -qt0 /dev/null' > > So I can write: > > $ intty sometool -args | grep ... > > However, the intty alias only works when it is the first command > in a pipeline (this is a limitation of the "script" command). > In the above example, the cat command is not the first, but a > subshell can be used to work around this: > > $ intty sh -c 'iostat -x 1 | cat -n' | grep ad1 > > (It should work with any shell that supports aliases, not just > zsh, of course.) > > I suggest closing this PR. > > Best regards > Oliver -- Jeremie Le Hen Men are born free and equal. Later on, they're on their own. Jean Yanne