public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna.vinschen@cityweb.de>
To: Christopher Faylor <cgf@cygnus.com>
Cc: earnie_boyd@yahoo.com, Peter Kabal <kabal@ece.mcgill.ca>,
	cygwin users <cygwin@sourceware.cygnus.com>
Subject: Re: Cygwin B20 - fseek under gcc fails to reposition on text files
Date: Wed, 17 Feb 1999 02:01:00 -0000	[thread overview]
Message-ID: <36CA92B5.844635AA@cityweb.de> (raw)
In-Reply-To: <19990216205243.L16511@cygnus.com>

Christopher Faylor wrote:
> 
> On Tue, Feb 16, 1999 at 07:41:34AM -0800, Earnie Boyd wrote:
> >
> >Here is the "Microsoft VC++ Run-Time Library Reference" quote:
> >
> >For streams opened in text mode, fseek has limited use, because
> >carriage return-linefeed translations can cause fseek to produce
> >unexpected results.  The only fseek operations guaranteed to work on
> >streams opened in text mode are:
> >
> >* Seeking with an offset of 0 relative to any of the origin values.
> >
> >* Seeking from the beginning of the file with an offset value returned
> >from a call to ftell.
> >
> >Also in text mode, CTRL+Z is interpreted as an end-of-file character
> >[...]

This is the _documentation_ of M$. In fact their code doesn't do the right
thing! As the ftell of newlib, it works without special calls of the
underlying OS, only calls to `_lseek()' are performed.  The only difference
between M$ and newlib is, that M$ performs additional counting of \n in
case of text file processing. It's done in the already translated buffer,
so the result is crap, as in newlib. Only their hit count is better.

> >Based on the documentation then I'll have to agree that your programs
> >isn't behaving as the documentation states that it should.  But, which
> >is wrong, fseek or ftell?
> 
> This does sound like a bug.  We'll try to look into this, time permitting.
> 
> If anyone else wants to take a stab at this (Corinna?) I'd be very grateful.

We have three possible choices:

1st: We are not performing the same errors as M$. We do our own, so we let
     it as it is.

2nd: M$-compatible errors, so we let ftell count \n, too. This would result
     in more often correct telling.

3rd: The full stdio code in newlib has to be changed. The buffer is used
     anyway in binary mode, every call has to use new counting and
     translation methods than the current one.
     Because this has to be done _very_ cautious, it's a long time change.

For the near future, I would prefer the second choice. Other opinions?

Regards,
Corinna


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

WARNING: multiple messages have this Message-ID
From: Corinna Vinschen <corinna.vinschen@cityweb.de>
To: Christopher Faylor <cgf@cygnus.com>
Cc: earnie_boyd@yahoo.com, Peter Kabal <kabal@ece.mcgill.ca>,
	cygwin users <cygwin@sourceware.cygnus.com>
Subject: Re: Cygwin B20 - fseek under gcc fails to reposition on text files
Date: Sun, 28 Feb 1999 23:02:00 -0000	[thread overview]
Message-ID: <36CA92B5.844635AA@cityweb.de> (raw)
Message-ID: <19990228230200.YCPEmn2GcmndfuZf7ycB9YH9mvdNE7XUeBvRzJVyLas@z> (raw)
In-Reply-To: <19990216205243.L16511@cygnus.com>

Christopher Faylor wrote:
> 
> On Tue, Feb 16, 1999 at 07:41:34AM -0800, Earnie Boyd wrote:
> >
> >Here is the "Microsoft VC++ Run-Time Library Reference" quote:
> >
> >For streams opened in text mode, fseek has limited use, because
> >carriage return-linefeed translations can cause fseek to produce
> >unexpected results.  The only fseek operations guaranteed to work on
> >streams opened in text mode are:
> >
> >* Seeking with an offset of 0 relative to any of the origin values.
> >
> >* Seeking from the beginning of the file with an offset value returned
> >from a call to ftell.
> >
> >Also in text mode, CTRL+Z is interpreted as an end-of-file character
> >[...]

This is the _documentation_ of M$. In fact their code doesn't do the right
thing! As the ftell of newlib, it works without special calls of the
underlying OS, only calls to `_lseek()' are performed.  The only difference
between M$ and newlib is, that M$ performs additional counting of \n in
case of text file processing. It's done in the already translated buffer,
so the result is crap, as in newlib. Only their hit count is better.

> >Based on the documentation then I'll have to agree that your programs
> >isn't behaving as the documentation states that it should.  But, which
> >is wrong, fseek or ftell?
> 
> This does sound like a bug.  We'll try to look into this, time permitting.
> 
> If anyone else wants to take a stab at this (Corinna?) I'd be very grateful.

We have three possible choices:

1st: We are not performing the same errors as M$. We do our own, so we let
     it as it is.

2nd: M$-compatible errors, so we let ftell count \n, too. This would result
     in more often correct telling.

3rd: The full stdio code in newlib has to be changed. The buffer is used
     anyway in binary mode, every call has to use new counting and
     translation methods than the current one.
     Because this has to be done _very_ cautious, it's a long time change.

For the near future, I would prefer the second choice. Other opinions?

Regards,
Corinna


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


  parent reply	other threads:[~1999-02-17  2:01 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-16  7:41 Earnie Boyd
     [not found] ` < 19990216154134.3413.rocketmail@send104.yahoomail.com >
1999-02-16 17:52   ` Christopher Faylor
     [not found]     ` < 19990216205243.L16511@cygnus.com >
1999-02-16 18:18       ` DJ Delorie
1999-02-28 23:02         ` DJ Delorie
1999-02-17  2:01     ` Corinna Vinschen [this message]
1999-02-17  9:36       ` Re[2]: " Paul Sokolovsky
     [not found]         ` < 17817.990217@is.lg.ua >
1999-02-17 10:07           ` DJ Delorie
     [not found]             ` < 199902171807.NAA16764@envy.delorie.com >
1999-02-17 19:16               ` Larry Hall
     [not found]                 ` < 3.0.5.32.19990217221306.0162b070@pop.ma.ultranet.com >
1999-02-17 19:19                   ` DJ Delorie
     [not found]                     ` < 199902180318.WAA20394@envy.delorie.com >
1999-02-17 20:13                       ` Larry Hall
1999-02-28 23:02                         ` Larry Hall
1999-02-28 23:02                     ` DJ Delorie
1999-02-28 23:02                 ` Larry Hall
1999-02-28 23:02             ` DJ Delorie
1999-02-17 13:37         ` Corinna Vinschen
1999-02-19  2:30           ` Re[2]: " Paul Sokolovsky
     [not found]             ` < 17776.990218@is.lg.ua >
1999-02-19  6:36               ` Christopher Faylor
1999-02-22  3:26                 ` Re[2]: " Paul Sokolovsky
     [not found]                   ` < 13561.990222@is.lg.ua >
1999-02-22  8:55                     ` Cygwin participation threshold DJ Delorie
     [not found]                       ` < 199902221654.LAA07362@envy.delorie.com >
1999-02-22 10:33                         ` Carl Zmola
     [not found]                           ` < 19990222183222023.AAA254@carl_zmola >
1999-02-22 11:21                             ` Fergus Henderson
1999-02-28 23:02                               ` Fergus Henderson
1999-02-22 12:32                             ` DJ Delorie
1999-02-28 23:02                               ` DJ Delorie
1999-02-24  0:08                             ` Christopher Faylor
     [not found]                               ` < 19990223214848.A23525@cygnus.com >
1999-02-24  5:51                                 ` Fergus Henderson
     [not found]                                   ` < 19990225005148.53402@mundook.cs.mu.OZ.AU >
1999-02-24  9:18                                     ` Christopher Faylor
1999-02-24 19:23                                       ` Weiqi Gao
     [not found]                                         ` < 36D4C298.32C1C355@a.crl.com >
1999-02-25  0:23                                           ` Fergus Henderson
1999-02-25  6:01                                             ` Weiqi Gao
1999-02-25 13:48                                               ` Re[2]: " Paul Sokolovsky
1999-02-28 23:02                                                 ` Paul Sokolovsky
1999-02-28 23:02                                               ` Weiqi Gao
1999-02-28 23:02                                             ` Fergus Henderson
1999-02-28 23:02                                         ` Weiqi Gao
     [not found]                                       ` < 19990224121846.A25762@cygnus.com >
1999-02-25  0:14                                         ` Fergus Henderson
     [not found]                                           ` < 19990225191420.16813@mundook.cs.mu.OZ.AU >
1999-02-25  1:00                                             ` Lam Pui Yuen
     [not found]                                               ` < Pine.BSI.3.95.990225170005.16688A-100000@topaz.hknet.com >
1999-02-25  1:09                                                 ` Lam Pui Yuen
1999-02-28 23:02                                                   ` Lam Pui Yuen
1999-02-28 23:02                                               ` Lam Pui Yuen
1999-02-28 23:02                                           ` Fergus Henderson
1999-02-28 23:02                                       ` Christopher Faylor
1999-02-28 23:02                                   ` Fergus Henderson
1999-02-24 10:37                                 ` Carl Zmola
     [not found]                                   ` < 19990224183738302.AAA218@carl_zmola >
1999-02-24 10:44                                     ` Christopher Faylor
     [not found]                                       ` < 19990224134450.B26262@cygnus.com >
1999-02-24 10:48                                         ` Carl Zmola
1999-02-28 23:02                                           ` Carl Zmola
1999-02-28 23:02                                       ` Christopher Faylor
1999-02-28 23:02                                   ` Carl Zmola
1999-02-28 23:02                               ` Christopher Faylor
1999-02-28 23:02                           ` Carl Zmola
1999-02-28 23:02                       ` DJ Delorie
1999-02-28 23:02                   ` Re[2]: Cygwin B20 - fseek under gcc fails to reposition on text files Paul Sokolovsky
1999-02-28 23:02                 ` Christopher Faylor
1999-02-28 23:02             ` Re[2]: " Paul Sokolovsky
1999-02-28 23:02           ` Corinna Vinschen
1999-02-28 23:02         ` Re[2]: " Paul Sokolovsky
     [not found]       ` < 36CA92B5.844635AA@cityweb.de >
1999-02-17  8:07         ` DJ Delorie
1999-02-28 23:02           ` DJ Delorie
1999-02-17 13:46         ` J. J. Farrell
1999-02-28 23:02           ` J. J. Farrell
1999-02-28 23:02       ` Corinna Vinschen
1999-02-28 23:02     ` Christopher Faylor
1999-02-28 23:02 ` Earnie Boyd
  -- strict thread matches above, loose matches on Subject: below --
1999-02-22 14:28 Earnie Boyd
1999-02-28 23:02 ` Earnie Boyd
1999-02-19  7:00 setera
     [not found] ` < 8525671D.00525F37.00@D51MTA10.pok.ibm.com >
1999-02-19 17:21   ` Christopher Faylor
1999-02-22 13:40     ` Corinna Vinschen
1999-02-28 23:02       ` Corinna Vinschen
1999-02-28 23:02     ` Christopher Faylor
1999-02-28 23:02 ` setera
1999-02-16  5:27 Earnie Boyd
1999-02-28 23:02 ` Earnie Boyd
1999-02-16  4:24 Peter Kabal
1999-02-28 23:02 ` Peter Kabal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36CA92B5.844635AA@cityweb.de \
    --to=corinna.vinschen@cityweb.de \
    --cc=cgf@cygnus.com \
    --cc=cygwin@sourceware.cygnus.com \
    --cc=earnie_boyd@yahoo.com \
    --cc=kabal@ece.mcgill.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).