From owner-freebsd-current Sun Mar 24 17:44:17 2002 Delivered-To: freebsd-current@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 53D7637B41C; Sun, 24 Mar 2002 17:44:05 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id g2P1i4i04255; Sun, 24 Mar 2002 18:44:04 -0700 (MST) (envelope-from imp@village.org) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id g2P1i2L43934; Sun, 24 Mar 2002 18:44:03 -0700 (MST) (envelope-from imp@village.org) Date: Sun, 24 Mar 2002 18:43:13 -0700 (MST) Message-Id: <20020324.184313.30925676.imp@village.org> To: kris@obsecurity.org Cc: current@FreeBSD.org, peter@FreeBSD.org Subject: Re: stdout changes break some ports From: "M. Warner Losh" In-Reply-To: <20020324173513.A75429@xor.obsecurity.org> References: <20020324173513.A75429@xor.obsecurity.org> X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <20020324173513.A75429@xor.obsecurity.org> Kris Kennaway writes: : The changes to the definitions of stdout/stdin/stderr from a while : back caused a number of ports to break (somewhere around 84, according : to bento). For example, the cap port fails like this: : : http://bento.freebsd.org/errorlogs/5-latest/cap-6.0.198.log : : cc -DBYTESWAPPED -DPHASE2 -O -I/mnt/ports/net/cap/work/cap60 -DLWSRV_LPR_LOG -DSTAT_CACHE -DREREAD_AFPVOLS -DUSR_FILE_TYPES -DCREATE_AFPVOL=\"mac\" -DPID_FILE=\"/var/run/aufs.pid\" -DUSEVPRINTF -c ablog.c : ablog.c:69: initializer element is not constant : : where the offending line is: : : static FILE *lfp = stderr; : : David O'Brien committed a workaround to the clog port yesterday to : move the initializer to main() instead of trying to do it statically. : : Is this something which is supposed to work? No. This isn't something that is guaranteed to work per the standards, iirc. The proper fix is to put the initializer in main. The pain level of going back to something the old style is too high to even contemplate reverting. The C standard says: secont 7.19 stderr stdin stdout which are expressions of type ``pointer to FILE'' that point to the FILE objects associated, respectively, with the standard error, input, and output streams. 213The primary use of the freopen function is to change the file associated with a standard text stream (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value returned by the fopen function may be assigned. stderr macro, 7.19.1, 7.19.2, 7.19.3 Notice that it doesn't say that stderr is a compile time constant. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message