diff options
Diffstat (limited to 'development/opencomal/patches')
-rw-r--r-- | development/opencomal/patches/01-missing_includes.diff | 81 | ||||
-rw-r--r-- | development/opencomal/patches/02-vsprintf.diff | 93 | ||||
-rw-r--r-- | development/opencomal/patches/03-fix_auto_segfault.diff | 18 | ||||
-rw-r--r-- | development/opencomal/patches/04-mkdir.diff | 12 | ||||
-rw-r--r-- | development/opencomal/patches/05-sys_errlist.diff | 225 | ||||
-rw-r--r-- | development/opencomal/patches/06-noreturn.diff | 24 | ||||
-rw-r--r-- | development/opencomal/patches/README | 23 |
7 files changed, 476 insertions, 0 deletions
diff --git a/development/opencomal/patches/01-missing_includes.diff b/development/opencomal/patches/01-missing_includes.diff new file mode 100644 index 0000000000..618623e373 --- /dev/null +++ b/development/opencomal/patches/01-missing_includes.diff @@ -0,0 +1,81 @@ +diff -Naur opencomal-0.2.6/src/pdccmd.c opencomal-0.2.6.patched/src/pdccmd.c +--- opencomal-0.2.6/src/pdccmd.c 2002-09-22 13:36:49.000000000 -0400 ++++ opencomal-0.2.6.patched/src/pdccmd.c 2017-12-10 16:51:45.087203071 -0500 +@@ -22,6 +22,7 @@ + #include "pdcsqash.h" + #include "pdcenv.h" + ++#include <string.h> + + PRIVATE void cmd_list_horse(struct string *filename, long from, long to) + { +diff -Naur opencomal-0.2.6/src/pdcenv.c opencomal-0.2.6.patched/src/pdcenv.c +--- opencomal-0.2.6/src/pdcenv.c 2002-09-17 12:20:06.000000000 -0400 ++++ opencomal-0.2.6.patched/src/pdcenv.c 2017-12-10 16:52:01.592203099 -0500 +@@ -16,6 +16,8 @@ + #include "pdcseg.h" + #include "pdcid.h" + ++#include <string.h> ++ + PUBLIC struct comal_env *env_new(char *name) + { + struct comal_env *work = GETCORE(MISC_POOL, struct comal_env); +diff -Naur opencomal-0.2.6/src/pdcexp.c opencomal-0.2.6.patched/src/pdcexp.c +--- opencomal-0.2.6/src/pdcexp.c 2002-12-06 06:02:35.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcexp.c 2017-12-10 16:52:33.823203154 -0500 +@@ -20,7 +20,7 @@ + #include "pdcstr.h" + #include "pdcval.h" + +- ++#include <string.h> + #include <math.h> + + #ifdef HAS_ROUND +diff -Naur opencomal-0.2.6/src/pdcext.c opencomal-0.2.6.patched/src/pdcext.c +--- opencomal-0.2.6/src/pdcext.c 2002-12-05 02:17:02.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcext.c 2017-12-10 16:53:06.231203208 -0500 +@@ -18,6 +18,8 @@ + #include "pdcval.h" + #include "version.h" + ++#include <string.h> ++ + struct inpfile_stkent { + struct inpfile_stkent *next; + FILE *inpfile; +diff -Naur opencomal-0.2.6/src/pdclist.c opencomal-0.2.6.patched/src/pdclist.c +--- opencomal-0.2.6/src/pdclist.c 2002-11-30 09:39:49.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdclist.c 2017-12-10 16:52:20.328203131 -0500 +@@ -15,6 +15,8 @@ + #include "pdcparss.h" + #include "pdcmisc.h" + ++#include <string.h> ++ + PUBLIC int show_exec = 0; + + PRIVATE void list_horse(); +diff -Naur opencomal-0.2.6/src/pdcmisc.c opencomal-0.2.6.patched/src/pdcmisc.c +--- opencomal-0.2.6/src/pdcmisc.c 2002-12-06 05:58:13.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcmisc.c 2017-12-10 16:51:25.608203038 -0500 +@@ -18,6 +18,7 @@ + #include "pdcexec.h" + #include "pdclist.h" + ++#include <string.h> + #include <math.h> + #include <fcntl.h> + +diff -Naur opencomal-0.2.6/src/pdcsqash.c opencomal-0.2.6.patched/src/pdcsqash.c +--- opencomal-0.2.6/src/pdcsqash.c 2002-11-30 09:40:16.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcsqash.c 2017-12-10 16:52:52.257203185 -0500 +@@ -17,6 +17,7 @@ + #include "pdcexec.h" + #include <fcntl.h> + #include <sys/stat.h> ++#include <string.h> + + PRIVATE void sqash_exp(); + PRIVATE void sqash_horse(); diff --git a/development/opencomal/patches/02-vsprintf.diff b/development/opencomal/patches/02-vsprintf.diff new file mode 100644 index 0000000000..4f254064dd --- /dev/null +++ b/development/opencomal/patches/02-vsprintf.diff @@ -0,0 +1,93 @@ +diff -Naur opencomal-0.2.6/src/pdcexec.c opencomal-0.2.6.patched/src/pdcexec.c +--- opencomal-0.2.6/src/pdcexec.c 2002-11-30 09:58:16.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcexec.c 2017-12-10 17:29:51.489206949 -0500 +@@ -25,6 +25,7 @@ + #include "pdcexec.h" + #include "pdcdsys.h" + ++#include <stdarg.h> + #include <fcntl.h> + #include <string.h> + #include <sys/stat.h> +@@ -42,10 +43,13 @@ + + PUBLIC void run_error(int error, char *s, ...) + { ++ va_list ap; + char *buf; + char buf2[MAX_LINELEN]; + +- vsprintf(buf2, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(buf2, s, ap); ++ va_end(ap); + + curenv->error = curenv->lasterr = error; + mem_free(curenv->lasterrmsg); +diff -Naur opencomal-0.2.6/src/pdcmisc.c opencomal-0.2.6.patched/src/pdcmisc.c +--- opencomal-0.2.6/src/pdcmisc.c 2017-12-10 17:23:13.344206273 -0500 ++++ opencomal-0.2.6.patched/src/pdcmisc.c 2017-12-10 17:24:52.465206441 -0500 +@@ -18,6 +18,7 @@ + #include "pdcexec.h" + #include "pdclist.h" + ++#include <stdarg.h> + #include <string.h> + #include <math.h> + #include <fcntl.h> +@@ -58,9 +59,12 @@ + + PUBLIC void my_printf(int stream, int newline, char *s, ...) + { ++ va_list ap; + char buf[MAX_LINELEN]; + +- vsprintf(buf, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(buf, s, ap); ++ va_end(ap); + my_put(stream, buf, -1L); + + if (newline) +@@ -70,9 +74,12 @@ + + PUBLIC void fatal(char *s, ...) + { ++ va_list ap; + char buf[140]; + +- vsprintf(buf, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(buf, s, ap); ++ va_end(ap); + my_printf(MSG_ERROR, 1, "FATAL error: %s", buf); + + longjmp(RESTART, ERR_FATAL); +diff -Naur opencomal-0.2.6/src/pdcparss.c opencomal-0.2.6.patched/src/pdcparss.c +--- opencomal-0.2.6/src/pdcparss.c 2002-11-30 03:22:16.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcparss.c 2017-12-10 17:29:21.935206898 -0500 +@@ -16,6 +16,8 @@ + #include "pdcstr.h" + #include "pdcparss.h" + ++#include <stdarg.h> ++ + PRIVATE int pars_error_happened = 0; + PRIVATE char pars_errtxt[MAX_LINELEN]; + +@@ -282,11 +284,14 @@ + + PUBLIC void pars_error(char *s, ...) + { ++ va_list ap; + if (pars_error_happened) + return; + + pars_error_happened = lex_pos(); +- vsprintf(pars_errtxt, s, (char *) &s + sizeof(s)); ++ va_start(ap, s); ++ vsprintf(pars_errtxt, s, ap); ++ va_end(ap); + } + + diff --git a/development/opencomal/patches/03-fix_auto_segfault.diff b/development/opencomal/patches/03-fix_auto_segfault.diff new file mode 100644 index 0000000000..2a07685e2b --- /dev/null +++ b/development/opencomal/patches/03-fix_auto_segfault.diff @@ -0,0 +1,18 @@ +diff -Naur opencomal-0.2.6/src/pdccmd.c opencomal-0.2.6.patched/src/pdccmd.c +--- opencomal-0.2.6/src/pdccmd.c 2017-12-10 17:36:56.144207669 -0500 ++++ opencomal-0.2.6.patched/src/pdccmd.c 2017-12-10 17:37:14.539207700 -0500 +@@ -260,9 +260,11 @@ + + aline = crunch_line(buf); + +- direct_cmd = !aline->ld; +- result = process_comal_line(aline); +- nr += step; ++ if(aline) { ++ direct_cmd = !aline->ld; ++ result = process_comal_line(aline); ++ nr += step; ++ } + } + + return result; diff --git a/development/opencomal/patches/04-mkdir.diff b/development/opencomal/patches/04-mkdir.diff new file mode 100644 index 0000000000..47e94354f9 --- /dev/null +++ b/development/opencomal/patches/04-mkdir.diff @@ -0,0 +1,12 @@ +diff -Naur opencomal-0.2.6/src/pdclinux.c opencomal-0.2.6.patched/src/pdclinux.c +--- opencomal-0.2.6/src/pdclinux.c 2002-11-30 03:40:20.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdclinux.c 2017-12-10 17:48:17.357208824 -0500 +@@ -486,7 +486,7 @@ + + PUBLIC void sys_mkdir(char *dir) + { +- if (!mkdir(dir,0777)<0) ++ if (mkdir(dir,0777)<0) + run_error(DIR_ERR,strerror(errno)); + } + diff --git a/development/opencomal/patches/05-sys_errlist.diff b/development/opencomal/patches/05-sys_errlist.diff new file mode 100644 index 0000000000..7bf3794e0f --- /dev/null +++ b/development/opencomal/patches/05-sys_errlist.diff @@ -0,0 +1,225 @@ +diff -Naur opencomal-0.2.6/src/pdccmd.c opencomal-0.2.6.patched/src/pdccmd.c +--- opencomal-0.2.6/src/pdccmd.c 2017-12-10 17:36:56.144207669 -0500 ++++ opencomal-0.2.6.patched/src/pdccmd.c 2017-12-10 17:52:49.942209286 -0500 +@@ -36,7 +36,7 @@ + + if (!listfile) + run_error(OPEN_ERR, "File open error %s", +- sys_errlist[errno]); ++ strerror(errno)); + + setvbuf(listfile, NULL, _IOFBF, TEXT_BUFSIZE); + } else { +@@ -126,7 +126,7 @@ + + if (!yyenter) + run_error(OPEN_ERR, "File open error: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + setvbuf(yyenter, NULL, _IOFBF, TEXT_BUFSIZE); + ++entering; +@@ -138,7 +138,7 @@ + if (!feof(yyenter)) + run_error(CMD_ERR, + "Error when reading ENTER file: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } else { + aline = crunch_line(tline); + +diff -Naur opencomal-0.2.6/src/pdcexec.c opencomal-0.2.6.patched/src/pdcexec.c +--- opencomal-0.2.6/src/pdcexec.c 2017-12-10 17:37:01.335207678 -0500 ++++ opencomal-0.2.6.patched/src/pdcexec.c 2017-12-10 17:53:27.853209351 -0500 +@@ -1218,7 +1218,7 @@ + frec->hfno = open(name->s, flags | O_BINARY, S_IREAD | S_IWRITE); + + if (frec->hfno == -1) +- run_error(OPEN_ERR, "OPEN error: %s", sys_errlist[errno]); ++ run_error(OPEN_ERR, "OPEN error: %s", strerror(errno)); + + frec->next = curenv->fileroot; + curenv->fileroot = frec; +@@ -1244,7 +1244,7 @@ + if (close(walk->hfno) == -1) + run_error(CLOSE_ERR, + "Close error on file %ld: %s", +- walk->cfno, sys_errlist[errno]); ++ walk->cfno, strerror(errno)); + + walk = mem_free(walk); + } +@@ -1268,7 +1268,7 @@ + if (close(walk->hfno) == -1) + run_error(CLOSE_ERR, + "CLOSE error on file %ld: %s", +- walk->cfno, sys_errlist[errno]); ++ walk->cfno, strerror(errno)); + else { + if (last) + last->next = walk->next; +@@ -1314,7 +1314,7 @@ + -1) + run_error(POS_ERR, + "Random file positioning error: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + + return f; +@@ -1391,7 +1391,7 @@ + + if (r < 0) + run_error(READ_ERR, "INPUT/READ file error: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + + +@@ -1534,7 +1534,7 @@ + + if (w < 0) + run_error(WRITE_ERR, "File write error: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + + +@@ -1703,7 +1703,7 @@ + if (fclose(*f)) + run_error(SELECT_ERR, + "Error when closing current SELECT file: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + calc_exp(exp, (void **) &result, &type); + +@@ -1715,7 +1715,7 @@ + if (!*f) + run_error(SELECT_ERR, + "Error when opening new SELECT file: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + + mem_free(result); +diff -Naur opencomal-0.2.6/src/pdcexp.c opencomal-0.2.6.patched/src/pdcexp.c +--- opencomal-0.2.6/src/pdcexp.c 2017-12-10 17:36:56.144207669 -0500 ++++ opencomal-0.2.6.patched/src/pdcexp.c 2017-12-10 17:54:02.343209409 -0500 +@@ -220,7 +220,7 @@ + + if (result == -1) + run_error(EOF_ERR, "Error when checking for EOF: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + return result; + } +diff -Naur opencomal-0.2.6/src/pdcext.c opencomal-0.2.6.patched/src/pdcext.c +--- opencomal-0.2.6/src/pdcext.c 2017-12-10 17:36:56.144207669 -0500 ++++ opencomal-0.2.6.patched/src/pdcext.c 2017-12-10 17:54:53.239209496 -0500 +@@ -248,7 +248,7 @@ + pop_inpfile(); + run_error(SYS_ERR, + "Error opening sysin: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + } + +@@ -280,7 +280,7 @@ + + if (!sys_outfile && name->s[0]) + run_error(SYS_ERR, "Error opening sysout: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + return 0; + } else if (strcmp(cmd, "memdump") == 0) { +@@ -323,7 +323,7 @@ + + if (!eof) + run_error(SYS_ERR, "Error reading sysin: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + return ext_get(stream, line, maxlen, prompt); + } +diff -Naur opencomal-0.2.6/src/pdcmisc.c opencomal-0.2.6.patched/src/pdcmisc.c +--- opencomal-0.2.6/src/pdcmisc.c 2017-12-10 17:37:01.335207678 -0500 ++++ opencomal-0.2.6.patched/src/pdcmisc.c 2017-12-10 17:50:59.802209100 -0500 +@@ -39,7 +39,7 @@ + if (fputc('\n', sel_outfile) == EOF) + run_error(SELECT_ERR, + "Error when writing to SELECT OUTPUT file %s", +- sys_errlist[errno]); ++ strerror(errno)); + } else + sys_nl(stream); + } +@@ -51,7 +51,7 @@ + if (fputs(buf, sel_outfile) == EOF) + run_error(SELECT_ERR, + "Error when writing to SELECT OUTPUT file %s", +- sys_errlist[errno]); ++ strerror(errno)); + } else + sys_put(stream, buf, len); + } +diff -Naur opencomal-0.2.6/src/pdcsqash.c opencomal-0.2.6.patched/src/pdcsqash.c +--- opencomal-0.2.6/src/pdcsqash.c 2017-12-10 17:36:56.145207669 -0500 ++++ opencomal-0.2.6.patched/src/pdcsqash.c 2017-12-10 17:54:58.873209505 -0500 +@@ -39,7 +39,7 @@ + close(sqash_file); + run_error(SQASH_ERR, + "Error when writing to file: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + + sqash_i = 0; +@@ -543,7 +543,7 @@ + + if (sqash_file < 0) + run_error(OPEN_ERR, "File open error: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + sqash_buf = mem_alloc(MISC_POOL, SQASH_BUFSIZE); + sqash_i = 0; +@@ -568,7 +568,7 @@ + + if (close(sqash_file) < 0) + run_error(CLOSE_ERR, "Error closing file: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + + +@@ -583,7 +583,7 @@ + if (sqash_hwm < 0) { + close(sqash_file); + run_error(SQASH_ERR, "Error when reading from file: %s", +- sys_errlist[errno]); ++ strerror(errno)); + } + + sqash_i = 0; +@@ -1276,7 +1276,7 @@ + + if (sqash_file < 0) + run_error(OPEN_ERR, "File open error: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + sqash_buf = mem_alloc(MISC_POOL, SQASH_BUFSIZE); + sqash_i = MAXUNSIGNED; +@@ -1332,7 +1332,7 @@ + + if (close(sqash_file) < 0) + run_error(CLOSE_ERR, "Error closing file: %s", +- sys_errlist[errno]); ++ strerror(errno)); + + return root; + } diff --git a/development/opencomal/patches/06-noreturn.diff b/development/opencomal/patches/06-noreturn.diff new file mode 100644 index 0000000000..a64537df5a --- /dev/null +++ b/development/opencomal/patches/06-noreturn.diff @@ -0,0 +1,24 @@ +diff -Naur opencomal-0.2.6/src/pdcexec.h opencomal-0.2.6.patched/src/pdcexec.h +--- opencomal-0.2.6/src/pdcexec.h 2002-09-17 12:20:06.000000000 -0400 ++++ opencomal-0.2.6.patched/src/pdcexec.h 2017-12-10 18:11:31.222211188 -0500 +@@ -10,7 +10,7 @@ + + /* Line execution routines header file */ + +-extern void run_error(int error, char *s, ...); ++extern void run_error(int error, char *s, ...) __attribute__((noreturn)); + extern void exec_call(struct expression *exp, int calltype, void **result, + enum VAL_TYPE *type); + extern int exec_trap(struct comal_line *line); +diff -Naur opencomal-0.2.6/src/pdcmisc.h opencomal-0.2.6.patched/src/pdcmisc.h +--- opencomal-0.2.6/src/pdcmisc.h 2002-12-06 05:31:50.000000000 -0500 ++++ opencomal-0.2.6.patched/src/pdcmisc.h 2017-12-10 18:06:37.942210691 -0500 +@@ -13,7 +13,7 @@ + extern void my_nl(int stream); + extern void my_put(int stream, char *buf, long len); + extern void my_printf(int stream, int newline, char *s, ...); +-extern void fatal(char *s, ...); ++extern void fatal(char *s, ...) __attribute__((noreturn)); + extern void *my_reverse(void *root); + extern void free_list(struct my_list *root); + extern int exp_list_of_nums(struct exp_list *root); diff --git a/development/opencomal/patches/README b/development/opencomal/patches/README new file mode 100644 index 0000000000..834168aa38 --- /dev/null +++ b/development/opencomal/patches/README @@ -0,0 +1,23 @@ +opencomal needed a lot of patching to get it building & running on modern +Slackware. All these patches are by the SlackBuild author. + +01-missing_includes.diff + #include <string.h> + +02-vsprintf.diff + bizarre non-standards-compliant handling of vsprintf() causes immediate + segfault on startup, when it tries to print the banner. + +03-fix_auto_segfault.diff + missing NULL check, causes segfault in 'auto' mode when a syntax error + is entered, followed by ^C. + +04-mkdir.diff + fix the mkdir command so it actually reports errors. + +05-sys_errlist.diff + fix deprecation warning. + +06-noreturn.diff + squelch a bunch of spurious 'might be used uninitialized' warnings. + there are still a couple left, caveat emptor... |