delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2012/08/03/01:15:17

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: rugxulo AT gmail DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Ispell (binary patching Emacs)
Date: Thu, 2 Aug 2012 22:03:15 -0700 (PDT)
Organization: http://groups.google.com
Lines: 167
Message-ID: <b41365e0-2819-4ee6-bd92-c0399cfa6c35@googlegroups.com>
References: <MPG DOT 2a61256b7098af43989680 AT news60 DOT forteinc DOT com>
<83sjd412pe DOT fsf AT gnu DOT org> <b7563c8c-4248-499f-a8fe-bcffa12eb5e9 AT googlegroups DOT com>
<83obnql106 DOT fsf AT gnu DOT org> <44cbf133-ea8b-47d6-9f01-0c7cef19c13a AT googlegroups DOT com>
<8fd215eb-bc43-4739-b68b-50d0b27fb7b4 AT r33g2000yqd DOT googlegroups DOT com> <dd4a89be-da91-49e7-8c6b-f8b2cbc16bc5 AT googlegroups DOT com>
NNTP-Posting-Host: 65.13.115.246
Mime-Version: 1.0
X-Trace: posting.google.com 1343970274 24957 127.0.0.1 (3 Aug 2012 05:04:34 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Fri, 3 Aug 2012 05:04:34 +0000 (UTC)
In-Reply-To: <dd4a89be-da91-49e7-8c6b-f8b2cbc16bc5@googlegroups.com>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=65.13.115.246;
posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
User-Agent: G2/1.0
Bytes: 7210
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q735F2PS021851
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

Hi,
   I had a longer reply, but it didn't post correctly (blech). Not a huge loss, just saying ....

On Tuesday, July 31, 2012 6:55:06 AM UTC-5, rug DOT  DOT  DOT  AT gmail DOT com wrote:
> 
> On Saturday, July 28, 2012 10:35:02 AM UTC-5, USA Choice User wrote:
> 
> > Sorry I took so long to reply.  I finally got Emacs
> > 23.3 so it will compile using DJGPP on Windows 98SE,
> > with LFN set to "Y".  Following your version suggestion,
> > I only had to make one change--I substituted GCC 4.4.4
> > for GCC 4.7.0.  I also substituted GPP 4.4.4 for GPP
> > 4.7.0 for consistency.
> 
> > However, I can't figure out how or where to splice
> > in your patch, in callproc.c.  I did find the file
> > in the source folder, but to me at least it's not
> > obvious how to fix it (I'm not a C programmer yet,
> > but I can figure things out and follow directions).
> 
> > If you could walk me through the process I'd
> > appreciate it.  Thanks.

As mentioned, for text files, the best way to send small fixes is via (unified) Diff (and Patch in lieu of Ed). But you'd still have to grab the (big) sources and recompile, assuming you had all the correct tools. Even a refreshed, patched binary would make everyone download 40+ MB yet again. Yuck.

So a binary patch (as shown by my FC output) is easier, IMHO, but it's still not automatic. GNU Diff and Patch may? support binary files, but I've not tried. I've also not tried new Xdelta3 nor Courgette nor Open-VCdiff nor bsdiff (needs Bzip2) nor others. Emacs' own hexl-mode is broken by this same bug, so that's ruled out too!

DJGPP does have older XDelta 1.12 (from 2002) in /current/v2apps/ so I did earlier today make a quick patch and UUencode it.

EDIT: Google Groups is having problems posting this, ugh. Maybe if I remove this .uue below it will help (doh).

(snip, email me directly if it's desired)

I also wrote a really crappy tool in .C that you can compile that will read the FC output and automatically fix it for you. For cleanliness in this newsgroup, I've edited out the 8-bit chars, as they were unnecessary anyways.

==emacs.pat======================
fc /m35 /b emacs.old emacs.exe

Comparing G:\TONY\EMACS.OLD and G:\TONY\EMACS.EXE
00115D83:     A9         AE   
00145F00:     80         E8   
00145F01:     7B         1E   
00145F02:     FF         01   
00145F03:     58         00   
00145F04:     75         00   
00145F05:     0C         90   
00146021:     89         C9   
00146022:     EC         C3   
00146023:     5D         80   
00146024:     C3         63   
00146025:     8D         FF   
00146026:     76         58   
00146027:     00         80   
00146028:     00         7B   
00146029:     00         FF   
0014602A:     00         58   
0014602B:     00         74   
0014602C:     00         07   
0014602D:     00         5A   
0014602E:     00         E9   
0014602F:     00         DF   
00146030:     55         FE   
00146031:     89         FF   
00146032:     E5         FF   
00146033:     81         90   
00146034:     EC         C3   
00146035:     04         C8   
00146036:     01         04   
00146037:     00         01   
==emacs.pat======================

You can optionally verify (before and after) by using "md5sum -c blah.md5":

==oldemacs.md5===================
4f171dddc36898e8e3003d5cefae2497 *emacs.exe
==oldemacs.md5===================

==newemacs.md5===================
ad14f38a625ccbfff98510ae832bf734 *emacs.exe
==newemacs.md5===================

BTW, the following .C code is rubbish, but it seems to still work anyways.  ;-)

==tonyhack.c=====================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef FILE* FilePtr;

void seekit(FilePtr t, long o) {
  fflush(t); fseek(t,o,SEEK_SET);

  if (ftell(t) != o) {
    printf("Couldn't seek!\n");
    exit(EXIT_FAILURE);
  }
}

int main(void) {
  static long offset=0L,lineno=0L;
  int rc=EXIT_SUCCESS,res=0;
  FilePtr patch, target;
  char format1[]="%lX: %02X %02X", format2[]="%lX: %02X %*c %02X";
  char buf[1024], *fmt;
  unsigned int hex[3];

target=fopen("emacs.exe","rb+"); patch=fopen("emacs.pat","r");

if ((target == NULL) || (patch == NULL))
  rc=EXIT_FAILURE;
else {
  while (fgets(buf,sizeof(buf),patch) != NULL) {

    lineno++;

    /* adjust for DOS' fc.exe output if no char literal found */
    fmt=format1; if (buf[18] != ' ') fmt=format2;

    res=sscanf(buf,fmt,&offset,&hex[0],&hex[1]);

    if (res > 1) {
      seekit(target,offset);

      fread(&hex[2],1,1,target); hex[2]=(unsigned char)hex[2];

      if (hex[2] != hex[0]) {
        printf("WARNING: %d != %d\n",hex[2],hex[0]);
      }

      seekit(target,offset);

      if (fwrite(&hex[1],1,1,target) == 1L) {
        printf("(res %d) [line %5ld] 0x%lX: %02X => %02X\n",
               res,lineno,offset,hex[2],hex[1]);
      }
    }

  } /* while */
  fclose(patch); fclose(target);
} /* if */

return rc;
} /* main */
==tonyhack.c=====================

I did briefly consider making a Shar archive, but that's still more external utils you need (and probably don't have). I wanted clean, simple, and small, esp. for mailing across the online group, so this way seemed better to my eyes.

- Raw text -


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