Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wg0uX-0003z4-Lq for pgsql-hackers@arkaria.postgresql.org; Fri, 02 May 2014 00:01:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wg0uX-00009Z-6B for pgsql-hackers@arkaria.postgresql.org; Fri, 02 May 2014 00:01:05 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wg0uW-00009Q-BL for pgsql-hackers@postgresql.org; Fri, 02 May 2014 00:01:04 +0000 Received: from mail-yh0-f46.google.com ([209.85.213.46]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wg0uP-0007wC-5M for pgsql-hackers@postgresql.org; Fri, 02 May 2014 00:01:03 +0000 Received: by mail-yh0-f46.google.com with SMTP id 29so1163924yhl.19 for ; Thu, 01 May 2014 17:00:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=2y+MXJCY6biCZGU0uLr1UU5IkhvMVaMkBAsYv4/7/9s=; b=IDTajt6h2nRjxfE1W/hqe6mHAT+NsgJey6EVKo4GDaDxoALjZcdbgKWp2utXVYtzEE yy0UirWGQ8ZSuW4XXdVuITfVS04a+71Zn9XuPRIKR7YQPJ1+TZ5XApfetrPAefob7GFP 3gIe7u0wnVtUsxQh4suK2Nu4NQfUZraFwdqclvm/WMNZ5t6l6kOrZcFrei0C8qPQwCO2 b/WkfjddbPiL2yxLj8gDxSdXJ4KrbI7mh3vh0bDl/9YZVlWlDaxVNohwqD8jyYPwJVA+ T7Xe8s6V4xiGLSmTXNzggKNxI/K8l5X4GoewtWcxycjVYRow301HneiRLdkdIbvEt9GG Hfnw== X-Gm-Message-State: ALoCoQlW7jNBWgUcuuT468L9C2HM5q4sUnEG2CEQTrozc1F9KIRESoaV+uB/GsIZcGow9L28Aqso X-Received: by 10.236.199.212 with SMTP id x60mr18822261yhn.90.1398988855883; Thu, 01 May 2014 17:00:55 -0700 (PDT) Received: from tornado.leadboat.com (c-107-4-219-91.hsd1.va.comcast.net. [107.4.219.91]) by mx.google.com with ESMTPSA id v60sm51573056yhc.40.2014.05.01.17.00.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 01 May 2014 17:00:55 -0700 (PDT) Date: Thu, 1 May 2014 20:00:53 -0400 From: Noah Misch To: Tom Lane Cc: pgsql-hackers@postgreSQL.org Subject: Re: Obsolete coding in fork_process.c Message-ID: <20140502000053.GA1191730@tornado.leadboat.com> References: <30040.1398960808@sss.pgh.pa.us> <20140501183231.GA1190179@tornado.leadboat.com> <4013.1398971788@sss.pgh.pa.us> <28165.1398981548@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28165.1398981548@sss.pgh.pa.us> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Thu, May 01, 2014 at 05:59:08PM -0400, Tom Lane wrote: > I wrote: > > Noah Misch writes: > >> Modern systems have other fflush(NULL) problems: > > >> http://www.nntp.perl.org/group/perl.perl5.porters/2013/09/msg207692.html > >> http://perl5.git.perl.org/metaconfig.git/blob/master:/U/perl/fflushall.U > > > Fun. I doubt that the postmaster's stdin would ever be a pipe, but > > maybe we'd better leave well enough alone. Should update the comment > > though. > > However ... after looking around I notice that fflush(NULL) is already > being used in parallel pg_dump and pg_upgrade; and at least in the latter > case I'm afraid to change that because it looks like there are probably > other stdio output files open in the process. Do those programs, operating in those modes, read from stdin or some other long-lived, pipe-backed FILE*? > BTW, while working on this I noticed that there are a boatload of places > where we use system() or popen() without a prior fflush. I suspect most > of them are safe, or we'd have heard more complaints --- but shouldn't > we clamp down on that? You need the fflush() when forking and then using stdio in the child before any exec(). Have you caught wind of any system() or popen() implementation having that property? -- Noah Misch EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers