delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/05/26/17:34:15

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: Cygwin: texi2dvi stumbles over texinfo.tex [attn texinfo maintainer]
Date: Fri, 26 May 2006 21:33:12 +0000 (UTC)
Lines: 47
Message-ID: <loom.20060526T232629-706@post.gmane.org>
References: <041d01c67e6e$a7fff670$a501a8c0 AT CAM DOT ARTIMI DOT COM> <200605242003 DOT k4OK3dj01609 AT f7 DOT net> <20060525063820 DOT GA6327 AT iam DOT uni-bonn DOT de>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

cgf wrote:

> >0022FF88  61005EB3  (00000000, 00000000, 00000000, 00000000) 
> 
> That's apparently a call to mktemp, although I can't tell what's causing 
> the problem. 

Well, looking at the source to the cygwin distribution of texinfo, it is
pretty obvious:


$ diff -u texindex.c.orig texindex.c
--- texindex.c.orig     2004-04-11 11:56:47.001000000 -0600
+++ texindex.c  2005-10-07 08:43:50.001000000 -0600
@@ -99,6 +99,9 @@
 /* Directory to use for temporary files.  On Unix, it ends with a slash.  */
 char *tempdir;
 
+/* Basename for temp files inside of tempdir.  */
+char *tempbase;
+
 /* Number of last temporary file.  */
 int tempcount;
 
@@ -190,6 +193,11 @@
 
   decode_command (argc, argv);
 
+  /* XXX mkstemp not appropriate, as we need to have somewhat predictable
+   * names. But race condition was fixed, see maketempname. 
+   */
+  tempbase = mktemp ("txidxXXXXXX");
+
...

OOPS!!!! The texinfo maintainer, in their modifications to upstream texindex, 
is passing a READ-ONLY string to mktemp, and is deserving of their crash 
(although cygwin could perhaps handle it more gracefully, perhaps by returning 
NULL on a fault so that at least the stack trace is not in the middle of 
cygwin1.dll).  But if you are going to go to the effort of modifications, use 
mkstemp instead (mktemp is insecure, after all).  I would further argue that 
maketempname should use the O_BINARY flag to open(), unless texindex can handle 
text mounts gracefully.  Can we get a new texinfo release soon with this fixed?

-- 
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019