* Re: [bug] Crazy I/O.
@ 1999-03-08 12:25 Michael V. Nikolaev
1999-03-31 19:45 ` Michael V. Nikolaev
0 siblings, 1 reply; 10+ messages in thread
From: Michael V. Nikolaev @ 1999-03-08 12:25 UTC (permalink / raw)
To: earnie_boyd, cygwin users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1765 bytes --]
I don't sure that it shouldn't be needed. IMHO, it depends on implementation.
BTW, it works well on my installation: NT SP4, cygwin-20.1, coolview dll, no binary mounts, CYGWIN=binmode ... . Here is the respective chunk of source:
...
dup2(fh1, 0);
fseek( stdin, 0L, SEEK_SET );
gets( fh1_IN );
...
This really works.
Wishes,
Michael
-----Original Message-----
From: Earnie Boyd <earnie_boyd@yahoo.com>
To: Michael V. Nikolaev <mvn@gu.kiev.ua>; cygwin users <cygwin@sourceware.cygnus.com>
Date: 8 áåðåçÃÿ 1999 ð. 21:45
Subject: Re: [bug] Crazy I/O.
>---"Michael V. Nikolaev" <mvn@gu.kiev.ua> wrote:
>>
>>
>> -----Original Message-----
>> From: Earnie Boyd <earnie_boyd@yahoo.com>
>> To: cygwin users <cygwin@sourceware.cygnus.com>
>> Date: 8 áåðåçÃÿ 1999 ð. 18:46
>> Subject: [bug] Crazy I/O.
>>
>>
>> Hi!
>>
>> You use stdin as a _stream_ when calling gets(). So, try to call
>fseek(stdin, 0L, SEEK_SET) after the second dup2(). It should work.
>>
>
>Didn't help. Besides, it shouldn't be needed.
>==
>- \\||//
>-------------------o0O0--Earnie--0O0o-------------------
>-- earnie_boyd@yahoo.com --
>-- http://www.freeyellow.com/members5/gw32/index.html --
>----------------------ooo0O--O0ooo----------------------
>
>PS: Newbie's, you should visit my page.
>_________________________________________________________
>DO YOU YAHOO!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
\x02ÃÃÃÂ¥v\x16çB\aFò\aVç7V'67&Â&R\x06g&öÃ\aFÂÂ2\x06ÃÂ7CðÃÂ¥6VæB\x06\x12\x06ÃW76\x16vR\aFò\x067ÂwvÂâÃVç7V'67&Â&T\a6÷W&6Wv\x17&Ræ7ÂvçW2æ6öÃÃ
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug] Crazy I/O.
1999-03-08 12:25 [bug] Crazy I/O Michael V. Nikolaev
@ 1999-03-31 19:45 ` Michael V. Nikolaev
0 siblings, 0 replies; 10+ messages in thread
From: Michael V. Nikolaev @ 1999-03-31 19:45 UTC (permalink / raw)
To: earnie_boyd, cygwin users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1765 bytes --]
I don't sure that it shouldn't be needed. IMHO, it depends on implementation.
BTW, it works well on my installation: NT SP4, cygwin-20.1, coolview dll, no binary mounts, CYGWIN=binmode ... . Here is the respective chunk of source:
...
dup2(fh1, 0);
fseek( stdin, 0L, SEEK_SET );
gets( fh1_IN );
...
This really works.
Wishes,
Michael
-----Original Message-----
From: Earnie Boyd <earnie_boyd@yahoo.com>
To: Michael V. Nikolaev <mvn@gu.kiev.ua>; cygwin users <cygwin@sourceware.cygnus.com>
Date: 8 áåðåçÃÿ 1999 ð. 21:45
Subject: Re: [bug] Crazy I/O.
>---"Michael V. Nikolaev" <mvn@gu.kiev.ua> wrote:
>>
>>
>> -----Original Message-----
>> From: Earnie Boyd <earnie_boyd@yahoo.com>
>> To: cygwin users <cygwin@sourceware.cygnus.com>
>> Date: 8 áåðåçÃÿ 1999 ð. 18:46
>> Subject: [bug] Crazy I/O.
>>
>>
>> Hi!
>>
>> You use stdin as a _stream_ when calling gets(). So, try to call
>fseek(stdin, 0L, SEEK_SET) after the second dup2(). It should work.
>>
>
>Didn't help. Besides, it shouldn't be needed.
>==
>- \\||//
>-------------------o0O0--Earnie--0O0o-------------------
>-- earnie_boyd@yahoo.com --
>-- http://www.freeyellow.com/members5/gw32/index.html --
>----------------------ooo0O--O0ooo----------------------
>
>PS: Newbie's, you should visit my page.
>_________________________________________________________
>DO YOU YAHOO!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
\x02ÃÃÃÂ¥v\x16çB\aFò\aVç7V'67&Â&R\x06g&öÃ\aFÂÂ2\x06ÃÂ7CðÃÂ¥6VæB\x06\x12\x06ÃW76\x16vR\aFò\x067ÂwvÂâÃVç7V'67&Â&T\a6÷W&6Wv\x17&Ræ7ÂvçW2æ6öÃÃ
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug] Crazy I/O
1999-03-09 6:24 Earnie Boyd
@ 1999-03-31 19:45 ` Earnie Boyd
0 siblings, 0 replies; 10+ messages in thread
From: Earnie Boyd @ 1999-03-31 19:45 UTC (permalink / raw)
To: cygwin users
[-- Attachment #1: Type: text/plain, Size: 626 bytes --]
I've modified the text.tst.c test program based on suggestions from the list as noted in the program. Note this demonstrates a bug where the values for the file descriptor are not reset if the same file descriptor is used.
I can also state that the 19990115 snapshot eliminates the WARNING listed in the Users Guide under "the default Cygwin behavior" concerning the processing mode always being binary even if O_TEXT was specified if the default is binary.
Earnie.
P.S. BCC: developers
---
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
[-- Attachment #2: text.tst.c --]
[-- Type: text/x-c, Size: 1633 bytes --]
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <io.h>
/*
text.tst.c
Version 2
*/
int
main (void)
{
int fh1, fh2;
unsigned int nbytes = 60000, bytesread;
char fh1_IN[60000];
fh1 = open( "text.tst.c", O_RDONLY | O_TEXT );
dup2(fh1, 0);
close( fh1 );
gets( fh1_IN );
bytesread = strlen(fh1_IN);
printf( "read %u bytes from file\n", bytesread );
{
unsigned int i;
for (i=0; i< bytesread; i++) {
printf( "char value: %i\t\t%c\n", fh1_IN[i], fh1_IN[i] );
}
}
fh1 = open( "text.tst.c", O_RDONLY | O_BINARY );
dup2(fh1, 0);
close( fh1 );
/*
** I first tried: lseek( 0, 0, SEEK_SET ) but that didn't help.
** Michael V. Nikolaev <mvn@gu.kiev.ua> suggested using fseek which does
** reset the file descriptor and stream. Note, without this the change
** from O_TEXT to O_BINARY doesn't take effect either. If you remove the
** fseek then the file descriptor doesn't get reset to the beginning of the
** file as it should and the processing mode remains in O_TEXT.
**
** The fseek shouldn't be needed but works around a bug.
**
** I tried adding the close( 0 ) and fclose( stdin ) but that caused the
** fseek function not to work obviously because the stream was closed.
**
*/
fseek( stdin, 0L, SEEK_SET );
gets( fh1_IN );
bytesread = strlen(fh1_IN);
printf( "read %u bytes from file\n", bytesread );
{
unsigned int i;
for (i=0; i< bytesread; i++) {
printf( "char value: %i\t\t%c\n", fh1_IN[i], fh1_IN[i] );
}
}
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug] Crazy I/O.
1999-03-08 8:44 Earnie Boyd
@ 1999-03-31 19:45 ` Earnie Boyd
0 siblings, 0 replies; 10+ messages in thread
From: Earnie Boyd @ 1999-03-31 19:45 UTC (permalink / raw)
To: cygwin users
[-- Attachment #1: Type: text/plain, Size: 938 bytes --]
This bug has to do with getting back to the beginning of a file. I was trying to test what happens with O_TEXT and O_BINARY based upon the CYGWIN variable and the [no]binmode value. I'm using the 1998-12-3 release of the cygwin1.dll on NT4SP3. I haven't tested with a recent snapshot but the list needs to know about this for the distributed version.
I've included a test case. You must save the file as text.tst.c, gcc -o text text.tst.c, and have your working directory set to the source code.
==
- \\||//
-------------------o0O0--Earnie--0O0o-------------------
-- earnie_boyd@yahoo.com --
-- http://www.freeyellow.com/members5/gw32/index.html --
----------------------ooo0O--O0ooo----------------------
PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
[-- Attachment #2: text.tst.c --]
[-- Type: text/x-c, Size: 1055 bytes --]
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <io.h>
int
main (void)
{
int fh1, fh2;
unsigned int nbytes = 60000, bytesread;
char fh1_IN[60000];
fh1 = open( "text.tst.c", O_RDONLY | O_TEXT );
dup2(fh1, 0);
gets( fh1_IN );
bytesread = strlen(fh1_IN);
printf( "read %u bytes from file\n", bytesread );
{
unsigned int i;
for (i=0; i< bytesread; i++) {
printf( "char value: %i\t\t%c\n", fh1_IN[i], fh1_IN[i] );
}
}
close( fh1 );
fh1 = open( "text.tst.c", O_RDONLY | O_BINARY );
lseek( fh1, 0, SEEK_SET ); /* added to try to get the pointer back to the
the beginning of the file. Which doesn't help.
*/
dup2(fh1, 0);
gets( fh1_IN );
bytesread = strlen(fh1_IN);
printf( "read %u bytes from file\n", bytesread );
{
unsigned int i;
for (i=0; i< bytesread; i++) {
printf( "char value: %i\t\t%c\n", fh1_IN[i], fh1_IN[i] );
}
}
close( fh1 );
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug] Crazy I/O.
1999-03-08 11:45 Earnie Boyd
@ 1999-03-31 19:45 ` Earnie Boyd
0 siblings, 0 replies; 10+ messages in thread
From: Earnie Boyd @ 1999-03-31 19:45 UTC (permalink / raw)
To: Michael V. Nikolaev, cygwin users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 998 bytes --]
---"Michael V. Nikolaev" <mvn@gu.kiev.ua> wrote:
>
>
> -----Original Message-----
> From: Earnie Boyd <earnie_boyd@yahoo.com>
> To: cygwin users <cygwin@sourceware.cygnus.com>
> Date: 8 áåðåçÃÿ 1999 ð. 18:46
> Subject: [bug] Crazy I/O.
>
>
> Hi!
>
> You use stdin as a _stream_ when calling gets(). So, try to call
fseek(stdin, 0L, SEEK_SET) after the second dup2(). It should work.
>
Didn't help. Besides, it shouldn't be needed.
==
- \\||//
-------------------o0O0--Earnie--0O0o-------------------
-- earnie_boyd@yahoo.com --
-- http://www.freeyellow.com/members5/gw32/index.html --
----------------------ooo0O--O0ooo----------------------
PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug] Crazy I/O.
1999-03-08 11:32 Michael V. Nikolaev
@ 1999-03-31 19:45 ` Michael V. Nikolaev
0 siblings, 0 replies; 10+ messages in thread
From: Michael V. Nikolaev @ 1999-03-31 19:45 UTC (permalink / raw)
To: earnie_boyd, cygwin users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]
-----Original Message-----
From: Earnie Boyd <earnie_boyd@yahoo.com>
To: cygwin users <cygwin@sourceware.cygnus.com>
Date: 8 áåðåçÃÿ 1999 ð. 18:46
Subject: [bug] Crazy I/O.
Hi!
You use stdin as a _stream_ when calling gets(). So, try to call fseek(stdin, 0L, SEEK_SET) after the second dup2(). It should work.
Regards,
Michael
>This bug has to do with getting back to the beginning of a file. I was trying to test what happens with O_TEXT and O_BINARY based upon the CYGWIN variable and the [no]binmode value. I'm using the 1998-12-3 release of the cygwin1.dll on NT4SP3. I haven't tested with a recent snapshot but the list needs to know about this for the distributed version.
>
>I've included a test case. You must save the file as text.tst.c, gcc -o text text.tst.c, and have your working directory set to the source code.
>
>
>==
>- \\||//
>-------------------o0O0--Earnie--0O0o-------------------
>-- earnie_boyd@yahoo.com --
>-- http://www.freeyellow.com/members5/gw32/index.html --
>----------------------ooo0O--O0ooo----------------------
>
>PS: Newbie's, you should visit my page.
>_________________________________________________________
>DO YOU YAHOO!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
\vKCBÂÃ[Â\b\x1d^[Ã\x1d[ÂÃXÂÃÃÂXÂH\x19ÂÂÃH\x1d\x1a\x1a\Ã^[\x1a\Ã\x0fÃBÂÃ[Â\b\x18H^[Y\ÃÃYÃH\x1d^[Ã\x18ÃYÃÃ[Â][ÂÃXÂÃÃÂXÂP\x1cÃÃ\ÂÃ]Ã\ÂKÂÃYÃÂ\ÃÂÃÃCB
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug] Crazy I/O
@ 1999-03-09 6:24 Earnie Boyd
1999-03-31 19:45 ` Earnie Boyd
0 siblings, 1 reply; 10+ messages in thread
From: Earnie Boyd @ 1999-03-09 6:24 UTC (permalink / raw)
To: cygwin users
I've modified the text.tst.c test program based on suggestions from the list as noted in the program. Note this demonstrates a bug where the values for the file descriptor are not reset if the same file descriptor is used.
I can also state that the 19990115 snapshot eliminates the WARNING listed in the Users Guide under "the default Cygwin behavior" concerning the processing mode always being binary even if O_TEXT was specified if the default is binary.
Earnie.
P.S. BCC: developers
---
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug] Crazy I/O.
@ 1999-03-08 11:45 Earnie Boyd
1999-03-31 19:45 ` Earnie Boyd
0 siblings, 1 reply; 10+ messages in thread
From: Earnie Boyd @ 1999-03-08 11:45 UTC (permalink / raw)
To: Michael V. Nikolaev, cygwin users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
---"Michael V. Nikolaev" <mvn@gu.kiev.ua> wrote:
>
>
> -----Original Message-----
> From: Earnie Boyd <earnie_boyd@yahoo.com>
> To: cygwin users <cygwin@sourceware.cygnus.com>
> Date: 8 áåðåçÃÿ 1999 ð. 18:46
> Subject: [bug] Crazy I/O.
>
>
> Hi!
>
> You use stdin as a _stream_ when calling gets(). So, try to call
fseek(stdin, 0L, SEEK_SET) after the second dup2(). It should work.
>
Didn't help. Besides, it shouldn't be needed.
==
- \\||//
-------------------o0O0--Earnie--0O0o-------------------
-- earnie_boyd@yahoo.com --
-- http://www.freeyellow.com/members5/gw32/index.html --
----------------------ooo0O--O0ooo----------------------
PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [bug] Crazy I/O.
@ 1999-03-08 11:32 Michael V. Nikolaev
1999-03-31 19:45 ` Michael V. Nikolaev
0 siblings, 1 reply; 10+ messages in thread
From: Michael V. Nikolaev @ 1999-03-08 11:32 UTC (permalink / raw)
To: earnie_boyd, cygwin users
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1598 bytes --]
-----Original Message-----
From: Earnie Boyd <earnie_boyd@yahoo.com>
To: cygwin users <cygwin@sourceware.cygnus.com>
Date: 8 áåðåçÃÿ 1999 ð. 18:46
Subject: [bug] Crazy I/O.
Hi!
You use stdin as a _stream_ when calling gets(). So, try to call fseek(stdin, 0L, SEEK_SET) after the second dup2(). It should work.
Regards,
Michael
>This bug has to do with getting back to the beginning of a file. I was trying to test what happens with O_TEXT and O_BINARY based upon the CYGWIN variable and the [no]binmode value. I'm using the 1998-12-3 release of the cygwin1.dll on NT4SP3. I haven't tested with a recent snapshot but the list needs to know about this for the distributed version.
>
>I've included a test case. You must save the file as text.tst.c, gcc -o text text.tst.c, and have your working directory set to the source code.
>
>
>==
>- \\||//
>-------------------o0O0--Earnie--0O0o-------------------
>-- earnie_boyd@yahoo.com --
>-- http://www.freeyellow.com/members5/gw32/index.html --
>----------------------ooo0O--O0ooo----------------------
>
>PS: Newbie's, you should visit my page.
>_________________________________________________________
>DO YOU YAHOO!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
\vKCBÂÃ[Â\b\x1d^[Ã\x1d[ÂÃXÂÃÃÂXÂH\x19ÂÂÃH\x1d\x1a\x1a\Ã^[\x1a\Ã\x0fÃBÂÃ[Â\b\x18H^[Y\ÃÃYÃH\x1d^[Ã\x18ÃYÃÃ[Â][ÂÃXÂÃÃÂXÂP\x1cÃÃ\ÂÃ]Ã\ÂKÂÃYÃÂ\ÃÂÃÃCB
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug] Crazy I/O.
@ 1999-03-08 8:44 Earnie Boyd
1999-03-31 19:45 ` Earnie Boyd
0 siblings, 1 reply; 10+ messages in thread
From: Earnie Boyd @ 1999-03-08 8:44 UTC (permalink / raw)
To: cygwin users
This bug has to do with getting back to the beginning of a file. I was trying to test what happens with O_TEXT and O_BINARY based upon the CYGWIN variable and the [no]binmode value. I'm using the 1998-12-3 release of the cygwin1.dll on NT4SP3. I haven't tested with a recent snapshot but the list needs to know about this for the distributed version.
I've included a test case. You must save the file as text.tst.c, gcc -o text text.tst.c, and have your working directory set to the source code.
==
- \\||//
-------------------o0O0--Earnie--0O0o-------------------
-- earnie_boyd@yahoo.com --
-- http://www.freeyellow.com/members5/gw32/index.html --
----------------------ooo0O--O0ooo----------------------
PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~1999-03-31 19:45 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-08 12:25 [bug] Crazy I/O Michael V. Nikolaev
1999-03-31 19:45 ` Michael V. Nikolaev
-- strict thread matches above, loose matches on Subject: below --
1999-03-09 6:24 Earnie Boyd
1999-03-31 19:45 ` Earnie Boyd
1999-03-08 11:45 Earnie Boyd
1999-03-31 19:45 ` Earnie Boyd
1999-03-08 11:32 Michael V. Nikolaev
1999-03-31 19:45 ` Michael V. Nikolaev
1999-03-08 8:44 Earnie Boyd
1999-03-31 19:45 ` Earnie Boyd
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).