Permission denied with makeinfo from texinfo-4.0

Corinna Vinschen
Mon Apr 3 09:31:00 GMT 2000

Chris Faylor wrote:
> On Sun, Apr 02, 2000 at 09:20:45PM -0400, Chris Faylor wrote:
> >I can't see an easy fix for this behavior other than to detect an
> >ERROR_ACCESS_DENIED in _read and then attempt to see if we're at EOF.
> >In this case, we'd have to figure out how many bytes are actually left
> >in the file and just pass that many to ReadFile.  That could still fail,
> >of course, but in that case, it would be a UNIX-type failure.
> On second thought, this isn't feasible either.  We actually have to figure
> out how many bytes are actually valid (x) in the buffer and how many bytes
> would be read in (y).  If y <= x then the read should succeed.
> Corinna, do you want to take a shot at fixing this?  I think the correct
> place to do this is probably in fhandler_disk_file::read since you can't
> really determine the number of bytes remaining anywhere else, can you?
> Maybe to be safe we need a new fhandler method which can be triggered to
> restart a read in the above scenario.  So it would be something like:
> [...]

Should be no problem to do so, but I still wonder why this should be
needed. I have checked this out on my linux box (2.2.13 kernel,

=== SNIP ===
#include <sys/types.h> etcetera...
main(int argc, char** argv)
  int fd;
  char buf1[64000];
  ssize_t bytes;

  if ((fd = open (argv[1] ? argv[1] : argv[0], O_RDONLY)) < 0)
    return 0;
  lseek (fd, (off_t) 0, SEEK_END);
  bytes = read (fd, buf1 + 64000, 40000);
  printf ("read: %d, err: %d, %s\n", bytes, errno, strerror(errno));
  close (fd);
  return 0;
=== SNAP ===

and the message is

read: -1, err: 14, Bad address       <=== EFAULT!

as it's currently under cygwin, too, and it _is_ an UNIX-style error.
This is documented in the linux read(2) man page as well.

So, if this behaviour is the same in a "reference os", where is
the problem??? Well, uhm, I have no copy of POSIX, obviously...


More information about the Cygwin-developers mailing list