delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/07/13:17:44

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
Message-ID: <413DED2E.7080001@btinternet.com>
Date: Tue, 07 Sep 2004 18:17:34 +0100
From: Andy Rushton <andy_rushton AT btinternet DOT com>
User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)
MIME-Version: 1.0
To: Cygwin mailing list <cygwin AT cygwin DOT com>
Subject: 1.5.10: bug in /usr/sbin/strfile
X-IsSubscribed: yes

I know that problems with strfile have been reported before, but looking 
through the list archive I haven't seen a clear statement of the problem 
nor any responses that deal with the problem.

The symptoms: If I run strfile on a file of quotes to generate a .dat 
file for the fortune program, I get strange behaviour from fortune for 
that quote file. I either get blank fortunes, or sometimes just the same 
quote again and again. I tried this with the latest stable release of 
Cygwin (1.5.10) but its been around for a long time.

I suspect that this is another example of an old problem with Unix 
programs ported to Windows. I mount my disks in text mode so that for 
text files (but not binary files) \n gets translated to DOS line-ends. 
This option tends to show up bugs in Unix programs where binary files 
are opened incorrectly in text mode. This is a common bug because on 
Unix there is no difference between text and binary modes.

So I tried adding a new mount point:

D:\cygwin\usr\share\fortune on /usr/share/fortune type system (binmode)

This makes just the fortune quote files' directory binary mode - i.e. no 
text file conversions.

Sure enough, strfile now creates .dat files that fortune likes.

Okay, having a special mount point is a bodge. It does however show that 
my suspicions are probably correct. I suspect that somewhere in 
strfile's source is an fopen with the mode "w" instead of "wb" when the 
.dat file is created. However, I don't know who's responsible for this 
program - so I thought I'd post my conclusions here. Is there anyone out 
there who knows how to get this fixed?

Andy

-- 
Andy Rushton, Southampton, UK

If all these sweet young things were laid end-to-end, I wouldn't be a
bit surprised.
		-- Dorothy Parker


--
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