From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BULK_RE_SUSP_NTLD,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16523 invoked from network); 25 Oct 2021 12:44:49 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 25 Oct 2021 12:44:49 -0000 Received: (qmail 1848 invoked by uid 550); 25 Oct 2021 12:44:46 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1807 invoked from network); 25 Oct 2021 12:44:45 -0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=fifth.space; h=date:from :to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=20190812; bh=dvyBt6Sj rV6E51LB4Gg3gh8RYmM=; b=SmQOiVBIcPNPsbrzCpazRJjcs4Us3K6TTgcaSLO6 gkDnEVsmSHCBTIu3B5L9J2tnH1xGM0pSGBhSX+nzJh1tRzSdz8NajVkD6ElVTOTZ oaA323kj+hIk7FmDnikZGTYoE4eatVPcU+fXXALOnuMLIQ9n7AfpOyc6p70JRB63 2/6V1T33itqcOP/JMO7pWujJHrHm3Adu/HvJabeOqNgs+978bITusVX0uoiSV8i3 UkWsxuN4mKolCipKllgqYMgM+vMy++5FxqOEEClfmV7iG1bYHEY2zz5FWsSpK0Oz SUoqqA9dfSNne63+KGu5PQdlh2KKnrUTctYrxla8Y/bR0A== DomainKey-Signature: a=rsa-sha1; c=nofws; d=fifth.space; h=date:from:to :subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=20190812; b=v1 MMXQQF0yXenVPUcaEnZ474aBGhiZOtzb4/qnDA30TsuTXz2ABkuMPS8i+0DysQxP nzUkd7EuKSFg7WZDskxRkTo55/1a5YYkWR2xSjH3LPRcp+LHYajuaQ1wTMsLpMIq AxQFzxfDpf4pdpX0W9aCnY8TgdurIOWhREOHr0opxMm8bG1CyMmY9wm7B8y1Iyvg mPPakpytDSbCfjahVDuHvMWHuC0fxt0iQGeih/+5RT4VXD/iONbfSPhOa+y8zP38 KujvlZ/LHvFVKxwS3NpqggUeutegN7ycBu18yCWKcAfZkl4iYO07lTnsO5l/wzl6 95H8zFXO9GojqL17uW6w== Date: Mon, 25 Oct 2021 14:44:31 +0200 From: Quentin Rameau To: musl@lists.openwall.com Message-ID: <20211025144431.00718c87@tpx.quinq.eu.org> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [musl] request: please detect reads from stdin with unflushed writes to stdout > Hello, Hi Lorenzo, > there are a few programs around that do something like > printf("question: "); > fgets(ans, sizeof ans, stdin); > > without fflushing stdout and get away with it because it happens to work > under glibc. > (fyi the ones I stumbled onto are mkfs.xfs and, vipw/vigr from util-linux, > then the developer noticed the same with chfn/chsh) > > Ideally that would be taken care of by either some compiler warning (but > not even clang's -Weverything catches that) or by some static analysis > tool, but I couldn't find any. > > ... with do_something() being either flushing stdout or printing some kind > of warning to stderr (isatty?) or to syslog. > Any suggestion, corrections etc are obviously very welcome. Suggestion: fix those broken programs! If one wants to make sure what you print is flushed at a certain point, ones have to flush the stream.