Permission denied with makeinfo from texinfo-4.0

J. David Bryan
Tue Mar 14 20:35:00 GMT 2000

On 14 Mar 2000, at 20:26, Dr. Volker Zell wrote:

> Making all in doc
> ../makeinfo/makeinfo -I. texinfo.txi
> texinfo.txi: Permission denied

Bug in makeinfo.  I literally just ran into this over the past weekend and 
sent a report to <>.  Here's the description from that 

  This report is filed against Makeinfo 4.0, compiled for the Cygwin B20.1
  package from Cygnus Solutions, running on Windows NT 4.0 SP6 (Intel

  There is a problem in the "find_and_load" routine in "files.c" that
  causes failures on Cygwin (Win32) systems.  The Cygwin package defines
  the symbol "O_BINARY" but does not define the symbol "WIN32" (which is
  intended behavior), so the code at line 172 of files.c will be compiled.
  This line attempts to read from the file repeatedly until EOF is

  Unfortunately, every read specifies a requested number of bytes that
  corresponds to the full file size, even as the read buffer pointer is
  being incremented to account for each previously successful read.  The
  result is that calls to "read" are being made that specify buffer areas
  beyond the end of the actual allocated space. 

  This is an error that wouldn't normally matter, as any remaining bytes in
  the file will fit wholly within the originally allocated buffer. However,
  the Win32 API call "ReadFile" that is ultimately called by the library
  "read" routine checks to ensure that the entire buffer is writable before
  actually retrieving the file data.  This check fails if the buffer
  allocation is near the end of a physical memory page and the next page is
  not readable.  In this case, "read" fails with a "-1" error, and
  find_and_load therefore fails, causing makeinfo to terminate.

  A test case is to attempt to "makeinfo gcc.texi" under Cygwin.  This
  fails with "gcc.texi: Permission denied"; the failure occurs on the
  second iteration of line 172. 

  A correction would be to issue reads only for the number of bytes
  remaining in the buffer.  Therefore, the buffer accessibility check will
  not fail, and makeinfo will work properly. 

  A diff is appended that illustrates a possible fix.

A workaround is to compile makeinfo with "-DWIN32".  This will use 
alternate code within files.c which does not exhibit this problem.

                                      -- Dave Bryan

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list