[project @ 1996-07-19 18:36:04 by partain]
[ghc-hetmet.git] / glafp-utils / perl-4.035-fixes
1 From mjeffery@reed.edu Sun Nov 29 14:07:23 1992
2 From: mjeffery@reed.edu (Mark Jefferys)
3 Newsgroups: comp.lang.perl
4 Subject: Re: Recursion error in perl 4.035 ?
5 Date: 28 Nov 92 23:31:14 GMT
6 Organization: Reed College, Portland, OR
7
8 In article <1f7uvvINN9tp@roundup.crhc.uiuc.edu> parkes@uiuc.edu writes:
9
10 % In cons.c, change the code at or around 1423 from
11
12 %     if (willsave)
13 %         (void)apush(tosave,arg->arg_ptr.arg_str);
14
15 % to
16
17 %     if (willsave && arg->arg_ptr.arg_str )
18 %         (void)apush(tosave,arg->arg_ptr.arg_str);
19
20 This is half of my patch to which Larry gave a "Looks OK to me."
21 It's been a few months, do I'll post it again.
22
23
24 Mark
25
26
27 Index: cons.c
28 *** Orig/cons.c Thu Jun 11 22:42:01 1992
29 --- cons.c      Sun Jun 28 18:31:20 1992
30 ***************
31 *** 1353,1359 ****
32   
33                     /* in any event, save the iterator */
34   
35 !                   (void)apush(tosave,cmd->c_short);
36                 }
37                 shouldsave |= tmpsave;
38             }
39 --- 1353,1360 ----
40   
41                     /* in any event, save the iterator */
42   
43 !                   if (cmd->c_short)  /* Better safe than sorry */
44 !                       (void)apush(tosave,cmd->c_short);
45                 }
46                 shouldsave |= tmpsave;
47             }
48 ***************
49 *** 1420,1426 ****
50         shouldsave = TRUE;
51         break;
52       }
53 !     if (willsave)
54         (void)apush(tosave,arg->arg_ptr.arg_str);
55       return shouldsave;
56   }
57 --- 1421,1427 ----
58         shouldsave = TRUE;
59         break;
60       }
61 !     if (willsave && arg->arg_ptr.arg_str)
62         (void)apush(tosave,arg->arg_ptr.arg_str);
63       return shouldsave;
64   }
65 -- 
66 Mark Jefferys           Internet: mjeffery@reed.edu
67
68 From ezk@cs.columbia.edu Fri Dec  4 19:44:03 1992
69 From: ezk@cs.columbia.edu (Erez "HWank1" Zadok)
70 Newsgroups: comp.lang.perl
71 Subject: REPOST: FIXES to perl/makewhatis (core dump on OW3 man pages)
72 Date: 3 Dec 92 12:42:05 GMT
73
74 [This is a repost... -Erez]
75
76 I've found three small bugs in the the latest version of perl (4.035), which
77 I fixed.
78
79 The bugs only appeared when I got Tom Christiansen's man package, and ran
80 the makewhatis script.  Furthermore, it only occurred for one particular set
81 of manual pages -- SunOS's OpenWindows 3.
82
83 Since it seemed related to DBM, I tried to recompile perl with several
84 possible combinations of Sun's /bin/cc, gcc (2.2.2), ndbm, gdbm,
85 - -DDEBUGGING, -traditional (for gcc), Perl's malloc, Sun's malloc, etc. to no
86 avail.  Perl was still dumping core with a segmentation fault.  "make test"
87 was ok.  I was running on various Sun 4 machines, running SunOS 4.1.2.
88
89 After debugging I found out that perl was trying to dereference pointers
90 that were not initialized.
91
92 I fixed this by adding initialization to three declarations in perl.h.  The
93 ones to rsfp and statstab were needed for non-compressed man pages.  When I
94 started using compressed man pages I discovered I had to initialize fdpid as
95 well.  Now everything works fine.  Here is the diff file:
96
97 *** array.h.orig        Tue Nov 24 02:16:30 1992
98 --- array.h     Mon Nov 23 14:31:16 1992
99 ***************
100 *** 17,22 ****
101 --- 17,33 ----
102    * 
103    */
104   
105 + #ifdef NULL
106 + #undef NULL
107 + #endif
108 + #ifndef I286
109 + #  define NULL 0
110 + #else
111 + #  define NULL 0L
112 + #endif
113 + #define Null(type) ((type)NULL)
114 + #define Nullarray Null(ARRAY*)
115
116   struct atbl {
117       STR       **ary_array;
118       STR **ary_alloc;
119 *** perl.h.orig Tue Nov 24 02:16:10 1992
120 --- perl.h      Mon Nov 23 14:30:51 1992
121 ***************
122 *** 868,874 ****
123   
124   EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
125   EXT char *origfilename;
126 ! EXT FILE * VOLATILE rsfp;
127   EXT char buf[1024];
128   EXT char *bufptr;
129   EXT char *oldbufptr;
130 --- 868,874 ----
131   
132   EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
133   EXT char *origfilename;
134 ! EXT FILE * VOLATILE rsfp INIT(Nullfp);
135   EXT char buf[1024];
136   EXT char *bufptr;
137   EXT char *oldbufptr;
138 ***************
139 *** 952,958 ****
140   EXT struct stat statbuf;
141   EXT struct stat statcache;
142   EXT STAB *statstab INIT(Nullstab);
143 ! EXT STR *statname;
144   #ifndef MSDOS
145   EXT struct tms timesbuf;
146   #endif
147 --- 952,958 ----
148   EXT struct stat statbuf;
149   EXT struct stat statcache;
150   EXT STAB *statstab INIT(Nullstab);
151 ! EXT STR *statname INIT(Nullstr);
152   #ifndef MSDOS
153   EXT struct tms timesbuf;
154   #endif
155 ***************
156 *** 1013,1019 ****
157   EXT ARRAY *lineary;           /* lines of script for debugger */
158   EXT ARRAY *dbargs;            /* args to call listed by caller function */
159   
160 ! EXT ARRAY *fdpid;             /* keep fd-to-pid mappings for mypopen */
161   EXT HASH *pidstatus;          /* keep pid-to-status mappings for waitpid */
162   
163   EXT int *di;                  /* for tmp use in debuggers */
164 --- 1013,1019 ----
165   EXT ARRAY *lineary;           /* lines of script for debugger */
166   EXT ARRAY *dbargs;            /* args to call listed by caller function */
167   
168 ! EXT ARRAY *fdpid INIT(Nullarray); /* keep fd-to-pid mappings for mypopen */
169   EXT HASH *pidstatus;          /* keep pid-to-status mappings for waitpid */
170   
171   EXT int *di;                  /* for tmp use in debuggers */
172
173
174 Erez Zadok.
175 Central Research Facilities.
176 Columbia University Department of Computer Science.
177 - ---
178 "A wank's morning starts one jiffy    | Arpa:   ezk@cs.columbia.edu
179  after midnight."                     | Usenet: ...!rutgers!columbia!cs!ezk
180  -HebrewWank #1 (US meaning, not UK!) | Bitnet: erzus@cuvmb.BITNET