summaryrefslogtreecommitdiff
path: root/web/glasgow/lit2x-0.16/grasp-utils/perl-4.035-fixes
blob: e456aa49e80b948a53535b68e9908370b35e24c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
From mjeffery@reed.edu Sun Nov 29 14:07:23 1992
From: mjeffery@reed.edu (Mark Jefferys)
Newsgroups: comp.lang.perl
Subject: Re: Recursion error in perl 4.035 ?
Date: 28 Nov 92 23:31:14 GMT
Organization: Reed College, Portland, OR

In article <1f7uvvINN9tp@roundup.crhc.uiuc.edu> parkes@uiuc.edu writes:

% In cons.c, change the code at or around 1423 from
% 
%     if (willsave)
%         (void)apush(tosave,arg->arg_ptr.arg_str);
% 
% to
% 
%     if (willsave && arg->arg_ptr.arg_str )
%         (void)apush(tosave,arg->arg_ptr.arg_str);

This is half of my patch to which Larry gave a "Looks OK to me."
It's been a few months, do I'll post it again.


Mark


Index: cons.c
*** Orig/cons.c	Thu Jun 11 22:42:01 1992
--- cons.c	Sun Jun 28 18:31:20 1992
***************
*** 1353,1359 ****
  
  		    /* in any event, save the iterator */
  
! 		    (void)apush(tosave,cmd->c_short);
  		}
  		shouldsave |= tmpsave;
  	    }
--- 1353,1360 ----
  
  		    /* in any event, save the iterator */
  
! 		    if (cmd->c_short)  /* Better safe than sorry */
! 			(void)apush(tosave,cmd->c_short);
  		}
  		shouldsave |= tmpsave;
  	    }
***************
*** 1420,1426 ****
  	shouldsave = TRUE;
  	break;
      }
!     if (willsave)
  	(void)apush(tosave,arg->arg_ptr.arg_str);
      return shouldsave;
  }
--- 1421,1427 ----
  	shouldsave = TRUE;
  	break;
      }
!     if (willsave && arg->arg_ptr.arg_str)
  	(void)apush(tosave,arg->arg_ptr.arg_str);
      return shouldsave;
  }
-- 
Mark Jefferys		Internet: mjeffery@reed.edu

From ezk@cs.columbia.edu Fri Dec  4 19:44:03 1992
From: ezk@cs.columbia.edu (Erez "HWank1" Zadok)
Newsgroups: comp.lang.perl
Subject: REPOST: FIXES to perl/makewhatis (core dump on OW3 man pages)
Date: 3 Dec 92 12:42:05 GMT

[This is a repost... -Erez]

I've found three small bugs in the the latest version of perl (4.035), which
I fixed.

The bugs only appeared when I got Tom Christiansen's man package, and ran
the makewhatis script.  Furthermore, it only occurred for one particular set
of manual pages -- SunOS's OpenWindows 3.

Since it seemed related to DBM, I tried to recompile perl with several
possible combinations of Sun's /bin/cc, gcc (2.2.2), ndbm, gdbm,
- -DDEBUGGING, -traditional (for gcc), Perl's malloc, Sun's malloc, etc. to no
avail.  Perl was still dumping core with a segmentation fault.  "make test"
was ok.  I was running on various Sun 4 machines, running SunOS 4.1.2.

After debugging I found out that perl was trying to dereference pointers
that were not initialized.

I fixed this by adding initialization to three declarations in perl.h.  The
ones to rsfp and statstab were needed for non-compressed man pages.  When I
started using compressed man pages I discovered I had to initialize fdpid as
well.  Now everything works fine.  Here is the diff file:

*** array.h.orig	Tue Nov 24 02:16:30 1992
--- array.h	Mon Nov 23 14:31:16 1992
***************
*** 17,22 ****
--- 17,33 ----
   * 
   */
  
+ #ifdef NULL
+ #undef NULL
+ #endif
+ #ifndef I286
+ #  define NULL 0
+ #else
+ #  define NULL 0L
+ #endif
+ #define Null(type) ((type)NULL)
+ #define Nullarray Null(ARRAY*)
+ 
  struct atbl {
      STR	**ary_array;
      STR **ary_alloc;
*** perl.h.orig	Tue Nov 24 02:16:10 1992
--- perl.h	Mon Nov 23 14:30:51 1992
***************
*** 868,874 ****
  
  EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
  EXT char *origfilename;
! EXT FILE * VOLATILE rsfp;
  EXT char buf[1024];
  EXT char *bufptr;
  EXT char *oldbufptr;
--- 868,874 ----
  
  EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
  EXT char *origfilename;
! EXT FILE * VOLATILE rsfp INIT(Nullfp);
  EXT char buf[1024];
  EXT char *bufptr;
  EXT char *oldbufptr;
***************
*** 952,958 ****
  EXT struct stat statbuf;
  EXT struct stat statcache;
  EXT STAB *statstab INIT(Nullstab);
! EXT STR *statname;
  #ifndef MSDOS
  EXT struct tms timesbuf;
  #endif
--- 952,958 ----
  EXT struct stat statbuf;
  EXT struct stat statcache;
  EXT STAB *statstab INIT(Nullstab);
! EXT STR *statname INIT(Nullstr);
  #ifndef MSDOS
  EXT struct tms timesbuf;
  #endif
***************
*** 1013,1019 ****
  EXT ARRAY *lineary;		/* lines of script for debugger */
  EXT ARRAY *dbargs;		/* args to call listed by caller function */
  
! EXT ARRAY *fdpid;		/* keep fd-to-pid mappings for mypopen */
  EXT HASH *pidstatus;		/* keep pid-to-status mappings for waitpid */
  
  EXT int *di;			/* for tmp use in debuggers */
--- 1013,1019 ----
  EXT ARRAY *lineary;		/* lines of script for debugger */
  EXT ARRAY *dbargs;		/* args to call listed by caller function */
  
! EXT ARRAY *fdpid INIT(Nullarray); /* keep fd-to-pid mappings for mypopen */
  EXT HASH *pidstatus;		/* keep pid-to-status mappings for waitpid */
  
  EXT int *di;			/* for tmp use in debuggers */


Erez Zadok.
Central Research Facilities.
Columbia University Department of Computer Science.
- ---
"A wank's morning starts one jiffy    | Arpa:   ezk@cs.columbia.edu
 after midnight."                     | Usenet: ...!rutgers!columbia!cs!ezk
 -HebrewWank #1 (US meaning, not UK!) | Bitnet: erzus@cuvmb.BITNET