From: jmichel AT schur DOT institut DOT math DOT jussieu DOT fr (Jean Michel) Newsgroups: comp.os.msdos.djgpp Subject: Re: Bug in djgpp libc Date: 1 Jan 2001 12:53:30 +0100 Organization: A poorly-installed InterNetNews site Lines: 54 Message-ID: <92pr3q$12a$1@schur.institut.math.jussieu.fr> References: NNTP-Posting-Host: schur.institut.math.jussieu.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: vishnu.jussieu.fr 978349627 1036 134.157.13.71 (1 Jan 2001 11:47:07 GMT) X-Complaints-To: Newsmaster AT jussieu DOT fr. NNTP-Posting-Date: 1 Jan 2001 11:47:07 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article , Eli Zaretskii wrote: > >On 31 Dec 2000, Jean Michel wrote: > >> Hello, there is a bug in the djgpp libc library. > >It's not a bug in DJGPP. > >> { printf("\032\n"); >> fprintf(stderr, "%s\n", strerror(errno)); >> } >> >> produces >> >> No space left on drive (ENOSPC) > >That's because the DOS/Windows console driver returns EOF when you write >the Ctrl-Z character to it in cooked mode. Ctrl-Z is a kind of >``software end-of-file'' marker in DOS. There's nothing DJGPP can do with >that. Perhaps return a more accurate (unique?) error condition? >> [For people who may wonder why one would want to do the above, this is >> the end result of trying to find the smallest example which shows a bug >> occuring in the djgpp port of the ruby interpreter] > >A program which really _needs_ to write a raw Ctrl-Z character to the >screen, should switch the console device into raw mode, where the special >meaning of characters such as Ctrl-Z, Ctrl-P, TAB, etc. is switched off. > >However, since this issue is tricky, I'd suggest to post here an >explanation of why does the ruby interpreter need to write a Ctrl-Z >character to the screen. It's quite possible that switching the console >into raw mode is not the right thing to do in that case, but it's hard to >suggest a good solution without knowing the details. The fact is that the interpreter does not know to which file handle it is writing to at that stage, it is just echoing characters read from a text file which happens to contain the above (probably after having been modified by some strange DOS editor). Actually the above code works fine (the right characters are written to stdout). The only problem is the error return, together with the decision in ruby to raise an exception whenever that condition is reported (a reasonable thing to do if you have a real ENOSPC). Since in C one usually would not check the error return in the above code, it tends to run fine. Again I think the best thing would be to invent some new errno (like errno=39); or realize that things went fine despite the error message... Also I point out that no error message is returned if the ^Z is not followed very soon by a \n. Other characters after the ^Z cause no problem.... Best regards, Jean MICHEL