From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.devel Subject: Re: Link failure on systems lacking mkstemp Date: Sat, 16 Aug 2014 17:49:10 +0300 Message-ID: <8361hsebh5.fsf@gnu.org> References: <83ha1cek3l.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1408200588 11064 80.91.229.3 (16 Aug 2014 14:49:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Aug 2014 14:49:48 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Aug 16 16:49:41 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XIfIb-0008Sp-N8 for guile-devel@m.gmane.org; Sat, 16 Aug 2014 16:49:41 +0200 Original-Received: from localhost ([::1]:35691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIfIb-000324-C3 for guile-devel@m.gmane.org; Sat, 16 Aug 2014 10:49:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIfIR-00031i-5U for guile-devel@gnu.org; Sat, 16 Aug 2014 10:49:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIfIK-0005RT-Uv for guile-devel@gnu.org; Sat, 16 Aug 2014 10:49:31 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:38770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIfIK-0005R2-Ly for guile-devel@gnu.org; Sat, 16 Aug 2014 10:49:24 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NAE00O00LM11200@mtaout27.012.net.il> for guile-devel@gnu.org; Sat, 16 Aug 2014 17:44:18 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NAE00NP9M9U9H20@mtaout27.012.net.il> for guile-devel@gnu.org; Sat, 16 Aug 2014 17:44:18 +0300 (IDT) In-reply-to: <83ha1cek3l.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.183 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17352 Archived-At: > Date: Sat, 16 Aug 2014 14:42:54 +0300 > From: Eli Zaretskii > > I think the solution is simply remove mkstemp.c from libguile/, and > all its traces from the configury that causes its dependency to be > added to libguile/Makefile. Not sure how to do the latter, though. Actually, there's one small change that's required for using Gnulib's mkstemp: it opens the temporary file in the (default) text I/O mode, while we need it in binary mode, because we use these temporary files for writing *.go files. Here's the proposed patch: +++ libguile/filesys.c 2014-08-16 17:44:35.578125000 +0300 @@ -1479,6 +1479,14 @@ SCM_DEFINE (scm_mkstemp, "mkstemp!", 1, SCM_SYSCALL (rv = mkstemp (c_tmpl)); if (rv == -1) SCM_SYSERROR; +#ifdef __MINGW32__ + /* Files created by this function are used for *.go files, so make + sure they use binary I/O, or else the produced *.go files will be + corrupted by end-of-line conversion and ^Z "software EOF" + misfeature. Gnulib's 'mkstemp' uses the default text mode to + open the file . */ + _setmode (rv, _O_BINARY); +#endif scm_substring_move_x (scm_from_locale_string (c_tmpl), SCM_INUM0, scm_string_length (tmpl),