X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=daUNmyh5pHvD1pUoYm6ph+OW9bz1/v3hpY3glKUn1Ek=; b=gKKyXZD+xnJSSR9WRRcejFN6me68Mc2x88eagVzy2E9GxwYAleER37Js54A4L4EMMx OJRsbGYt9Yw3wbtJ4jRkH9KWqg7eeuQoLaFqTeIkmBvRVVESNnQ+M0NR6xMQCvGz8SvZ VsP1dDW+KRSb4ITqZ3Mt42LjQl4bQIQTzseHM= MIME-Version: 1.0 In-Reply-To: References: <201108310027 DOT 22056 DOT juan DOT guerrero AT gmx DOT de> <201108312117 DOT 54522 DOT juan DOT guerrero AT gmx DOT de> <038ae4ff-44f2-4ad2-b806-a6ed9b6085a2 AT o9g2000vbo DOT googlegroups DOT com> <83zkincty6 DOT fsf AT gnu DOT org> Date: Fri, 2 Sep 2011 17:25:48 +0300 Message-ID: Subject: Re: gcc difficulties on MSDOS 6.22 with LFN driver installed From: Ozkan Sezer To: djgpp AT delorie DOT com Content-Type: multipart/mixed; boundary=bcaec51a75923ec7b504abf623ec Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk --bcaec51a75923ec7b504abf623ec Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Sep 2, 2011 at 1:46 PM, Juan Manuel Guerrero wrote: > On 2 Sep., 08:57, Eli Zaretskii wrote: >> > From: Juan Manuel Guerrero >> > Date: Thu, 1 Sep 2011 15:19:03 -0700 (PDT) >> >> > OFYI, I have djgpp 2.03 installed on the same partition with the same >> > MSDOS 6.22 so I can choose if I want to compile with 2.04 or 2.03. >> > gcc 4.6.1 and djgpp-2.03 work flawlessly. >> >> Wait a minute. =A0Are you saying that the problem is _only_ with GCC >> compiled with DJGPP 2.04, and that 2.03-compiled GCC works? =A0I don't >> think you said that before. >> >> If you compile with v2.03 a simple program that calls 7A46, and then >> run it with DOSLFN, does it also fail? >> >> If so, this is certainly due to the use of 7A46, because in v2.03 >> `filelength' didn't call that function and `lfilelength' didn't exist >> at all. >> >> So I think we need to fix these 2 functions to work around this >> problem. > > Sorry for having been =A0imprecise. =A0I usualy do not use djgpp 2.03 > anymore > so I did not note that the gcc version compiled with 2.03 worked. > Yes, you are right, the problem is only with 2.04's =A0`filelength' and > `lfilelength'. > Both use 71A6 and fail with EOVERFLOW under certain circunstances. > The only thing we need to do is to fix both functions so they work > like > the 2.03 versions if the 71A6 call fails with EOVERFLOW. > > Regards, > Juan M. Guerrero > > Something like the following then? (Very quick+dirty patch, I know.) I also wonder whether fchmod() and/or fstat() are affected by this lfn issue... Index: src/libc/posix/sys/stat/filelen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/filelen.c,v retrieving revision 1.6 diff -u -p -r1.6 filelen.c --- src/libc/posix/sys/stat/filelen.c 25 Sep 2001 01:00:52 -0000 1.6 +++ src/libc/posix/sys/stat/filelen.c 2 Sep 2011 14:21:13 -0000 @@ -50,13 +50,19 @@ filelength(int fhandle) if ((_farpeekl(_dos_ds, __tb + 0x20) !=3D 0) || (retval =3D=3D -1)) { + /* errno =3D EOVERFLOW; return -1L; + */ + /* This failure can happen under certain circumstances, + e.g. for DOS 6.22 with LFN driver installed. Therefore, + fallback to no-lfn way instead of returning error. */ + goto _nofln; } return retval; } } - +_nofln: /* Remember the current file position, so we can return there later. */ regs.x.ax =3D 0x4201; /* set pointer from current position */ Index: src/libc/posix/sys/stat/lfilelen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/lfilelen.c,v retrieving revision 1.3 diff -u -p -r1.3 lfilelen.c --- src/libc/posix/sys/stat/lfilelen.c 4 Feb 2001 19:13:01 -0000 1.3 +++ src/libc/posix/sys/stat/lfilelen.c 2 Sep 2011 14:21:13 -0000 @@ -45,15 +45,21 @@ lfilelength(int fhandle) if (retval_h < 0) { + /* errno =3D EOVERFLOW; return -1; + */ + /* This failure can happen under certain circumstances, + e.g. for DOS 6.22 with LFN driver installed. Therefore, + fallback to no-lfn way instead of returning error. */ + goto _nofln; } retval =3D retval_l + retval_h * (1LL << 32); return retval; } } - +_nofln: /* Remember the current file position, so we can return there later. */ regs.x.ax =3D 0x4201; /* set pointer from current position */ -- O.S. --bcaec51a75923ec7b504abf623ec Content-Type: application/octet-stream; name="71A6.diff" Content-Disposition: attachment; filename="71A6.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gs39a12e0 SW5kZXg6IHNyYy9saWJjL3Bvc2l4L3N5cy9zdGF0L2ZpbGVsZW4uYwo9PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBm aWxlOiAvY3ZzL2RqZ3BwL2RqZ3BwL3NyYy9saWJjL3Bvc2l4L3N5cy9zdGF0L2ZpbGVsZW4uYyx2 CnJldHJpZXZpbmcgcmV2aXNpb24gMS42CmRpZmYgLXUgLXAgLXIx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