This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: BUG: alternatives

Gary R. Van Sickle wrote:
More investigation reveals that it's textmode mounts that alternatives
doesn't like, not necessarily (although almost certainly as well as) \r\n
line endings.

I'm pretty sure the problem is here:

    if (read(fd, buf, sb.st_size) != sb.st_size) {
        fprintf(stderr, _("failed to read %s: %s\n"), path,
        return 1;

Since one effect of 'textmode' conversions is that the bytecount "read" differs from the size reported by the filesystem, textmode files will always fail this test.

(1) I could remove this test -- but then you lose the error checking it's attempting to do: make sure the entire file was read into buf, and nothing was lost.

(2) I could always open the file in binmode, and change the parseLine routine to ignore trailing '\r' on each line. (We'll assume that no alternatives config file will ever contain a vertical-feed character).



-- Unsubscribe info: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]