delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/11/15:44:29

Message-ID: <000501c07c0e$9c67ab40$d7394bd5@robert>
From: "Robert van der Boon" <rjvdboon AT europe DOT com>
To: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Cc: <djgpp-workers AT delorie DOT com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010109095357 DOT 19017B-100000 AT is>
Subject: Re: patch.exe (fwd)
Date: Thu, 11 Jan 2001 21:37:06 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id PAA26085
Reply-To: djgpp-workers AT delorie DOT com

On Tue, 9 Jan 2001, Eli Zaretskii wrote:
> On Mon, 8 Jan 2001, Robert van der Boon wrote:
> > > > The error message I'm getting (patch 2.5.3, LFN=y, patch < news.diff ) is:
> > > > patch: **** Can't rename file "C:\WINNT\TEMP/poaaaaaa" to "news.txt" : Not
> > > > enough memory (ENOMEM)
> > > 
> > > Thanks for testing, that's what I suspected.
> > > 
> > > If you have some time to spare to dig into this, I could suggest several 
> > > ideas to try.  It would be nice to solve this.
> > 
> > If you can give directions on what to look for, and things to
> > try, I'm willing to check them out.
> 
> First step would be to rebuild Patch from sources with the development
> environment you have, and see that the problem persists.  (The binary
> on SimTel was compiled with GCC 2.7.2.1 and Binutils 2.9.1; I doubt
> that this will change anything, but better be safe than sorry.)

Yep, it persists.
 
> Once you have a debuggable binary that reproduces the problem, please
> run it under a debugger and see what happens where `rename' is called.

Fails (returns with -1, errno = ENOMEM)
 
> Next step after that is to paste the sources of `rename' and `_rename'
> into Patch sources, rebuild Patch, and step with a debugger into these
> functions to see what exactly fails there.  (You might as well use the
> latest CVS sources for these two functions, in case they already solve
> some problems.)

Only change with latest CVS was symlink support, which means
downloading more than just the 2 files. Didn't do that, sorry.

Anyways, back to the debugging...
The following fragment from _rename.c, begin at line 89,
my comments are marked with <<--

  for (i=0; i<2; i++)
  {
    if(use_lfn)            <<-- TRUE
      r.x.ax = 0x7156;
    else if ((_osmajor > 7 && _osmajor < 10) /* OS/2 returns v10 and above */
      || (_osmajor == 7 && _osminor >= 20))
    {
      /* DOS 7.20 (Windows 98) and later supports a new function with
         a maximum path length of 128 characters instead of 67.  This
         is important for deeply-nested directories.  */
      r.x.ax = 0x43ff;
      r.x.bp = 0x5053;
      r.h.cl = 0x56;
    }
    else
      r.h.ah = 0x56;
    _put_path2(new, olen);
    _put_path(old);
    __dpmi_int(0x21, &r);
    if(r.x.flags & 1)          <<-- r.x.flags = 3, so is true
    {
      if (i == 0            <<-- r.x.ax = 183
          && (r.x.ax == 5 || (r.x.ax == 2 && __file_exists(old))))
        remove(new);   /* and try again */
      else
      {
        errno = __doserr_to_errno(r.x.ax);    <<-- r.x.ax = 183 (ENOMEM)

        /* Restore to original name if we renamed it to temporary.  */
        if (use_lfn)          <<-- TRUE
        {
          if (lfn_fd != -1)   <<-- TRUE
          {
            _close (lfn_fd);
            remove (orig);
          }
          _put_path2(orig, olen);
          _put_path(tempfile);
          r.x.ax = 0x7156;
          __dpmi_int(0x21, &r);
        }
        return -1;           <<-- Bye Bye
      }
    }
    else
      break;
  }

  /* Success.  Delete the file possibly created to work
     around the Windows 95 bug.  */
  if (lfn_fd != -1)
    return (_close (lfn_fd) == 0) ? remove (orig) : -1;
  return 0;
}

For completeness I must add that _osmajor = 5, _osminor = 0 on
W2K Professional SP1.

Any further suggestions are welcome, I don't have much experience
with this kind of programming, but with some suggestions, I could have
a try anyway.

Bye now,
 Robert

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019