Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <436CF5E9.30106@cwilson.fastmail.fm> Date: Sat, 05 Nov 2005 13:11:53 -0500 From: Charles Wilson User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) MIME-Version: 1.0 To: Mailing List: CygWin Subject: Re: BUG: alternatives References: <001a01c5e10d$f92ae6d0$020aa8c0 AT DFW5RB41> <000701c5e1ca$a186b310$020aa8c0 AT DFW5RB41> In-Reply-To: <000701c5e1ca$a186b310$020aa8c0@DFW5RB41> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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) { close(fd); fprintf(stderr, _("failed to read %s: %s\n"), path, strerror(errno)); 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). Suggestions? -- Chuck -- 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/