Compare commits

...

No commits in common. "c8" and "c9" have entirely different histories.
c8 ... c9

21 changed files with 107 additions and 1374 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/tcsh-6.20.00.tar.gz
SOURCES/tcsh-6.22.03.tar.gz

View File

@ -1 +1 @@
a77d68434cc4bed731a46a39b9e01523e3a1e98c SOURCES/tcsh-6.20.00.tar.gz
3d1e4a0087a41350ce81fb1a9a04403c5ffb7e5f SOURCES/tcsh-6.22.03.tar.gz

View File

@ -1,25 +0,0 @@
From 8235759d3096654ff2f5c7118bd23f40b7dcbc8f Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Sat, 26 Nov 2016 00:14:18 +0000
Subject: [PATCH] Add all flags for the gethost build.
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 1ef8cb7..5c30451 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -449,7 +449,7 @@ pure:$(P) ${OBJS}
gethost: gethost.c sh.err.h tc.const.h sh.h
rm -f gethost
- ${CC_FOR_GETHOST} -o gethost ${CPPFLAGS} $(srcdir)/gethost.c
+ ${CC_FOR_GETHOST} -o gethost ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} $(srcdir)/gethost.c
tc.defs.c: gethost host.defs
@rm -f $@.tmp
--
2.7.4

View File

@ -1,137 +0,0 @@
diff --git a/Fixes b/Fixes
--- a/Fixes
+++ b/Fixes
@@ -2,7 +2,6 @@
4. Don't play pointer tricks that are undefined in modern c (Brooks Davis)
3. Fix out of bounds read (Brooks Davis)
2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
- 1. PR/471: Delay arginp parsing
20. V6.20.00 - 20161124
19. Don't resize the screen if it did not change size.
diff --git a/sh.c b/sh.c
--- a/sh.c
+++ b/sh.c
@@ -249,7 +249,6 @@ main(int argc, char **argv)
char *tcp, *ttyn;
int f, reenter;
char **tempv;
- const char *targinp = NULL;
int osetintr;
struct sigaction oparintr;
@@ -941,7 +940,30 @@ main(int argc, char **argv)
*p &= ASCII;
}
#endif
- targinp = tempv[0];
+ arginp = SAVE(tempv[0]);
+
+ /*
+ * we put the command into a variable
+ */
+ if (arginp != NULL)
+ setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE);
+
+ /*
+ * * Give an error on -c arguments that end in * backslash to
+ * ensure that you don't make * nonportable csh scripts.
+ */
+ {
+ int count;
+
+ cp = Strend(arginp);
+ count = 0;
+ while (cp > arginp && *--cp == '\\')
+ ++count;
+ if ((count & 1) != 0) {
+ exiterr = 1;
+ stderror(ERR_ARGC);
+ }
+ }
prompt = 0;
nofile = 1;
break;
@@ -1186,7 +1208,7 @@ main(int argc, char **argv)
sigset_interrupting(SIGXFSZ, queue_phup);
#endif
- if (quitit == 0 && targinp == 0) {
+ if (quitit == 0 && arginp == 0) {
#ifdef SIGTSTP
(void) signal(SIGTSTP, SIG_IGN);
#endif
@@ -1304,7 +1326,7 @@ main(int argc, char **argv)
*/
sigset_interrupting(SIGCHLD, queue_pchild);
- if (intty && !targinp)
+ if (intty && !arginp)
(void) ed_Setup(editing);/* Get the tty state, and set defaults */
/* Only alter the tty state if editing */
@@ -1339,7 +1361,7 @@ main(int argc, char **argv)
#ifdef _PATH_DOTCSHRC
(void) srcfile(_PATH_DOTCSHRC, 0, 0, NULL);
#endif
- if (!targinp && !onelflg && !havhash)
+ if (!arginp && !onelflg && !havhash)
dohash(NULL,NULL);
#ifndef LOGINFIRST
#ifdef _PATH_DOTLOGIN
@@ -1359,7 +1381,7 @@ main(int argc, char **argv)
if (!srccat(varval(STRhome), STRsldottcshrc))
(void) srccat(varval(STRhome), STRsldotcshrc);
- if (!targinp && !onelflg && !havhash)
+ if (!arginp && !onelflg && !havhash)
dohash(NULL,NULL);
/*
@@ -1379,7 +1401,7 @@ main(int argc, char **argv)
exitset--;
/* Initing AFTER .cshrc is the Right Way */
- if (intty && !targinp) { /* PWP setup stuff */
+ if (intty && !arginp) { /* PWP setup stuff */
ed_Init(); /* init the new line editor */
#ifdef SIG_WINDOW
check_window_size(1); /* mung environment */
@@ -1395,37 +1417,6 @@ main(int argc, char **argv)
setNS(STRecho);
- if (targinp) {
- /* If this -c command caused an error before, skip processing */
- if (reenter && arginp) {
- exitcode = 1;
- goto done;
- }
-
- arginp = SAVE(targinp);
- /*
- * we put the command into a variable
- */
- if (arginp != NULL)
- setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE);
-
- /*
- * * Give an error on -c arguments that end in * backslash to
- * ensure that you don't make * nonportable csh scripts.
- */
- {
- int count;
-
- cp = Strend(arginp);
- count = 0;
- while (cp > arginp && *--cp == '\\')
- ++count;
- if ((count & 1) != 0) {
- exiterr = 1;
- stderror(ERR_ARGC);
- }
- }
- }
/*
* All the rest of the world is inside this call. The argument to process
* indicates whether it should catch "error unwinds". Thus if we are a

View File

@ -1,157 +0,0 @@
From b27c203ff06a33b9fa6c0f2e14a8825eb3f672da Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Sun, 27 Nov 2016 16:40:58 +0000
Subject: [PATCH 1/2] PR/471: Daiki Ueno: Delay interpreting arginp until we've
processed our startup files (which can change the NLS environment).
---
sh.c | 62 +++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 33 insertions(+), 29 deletions(-)
diff --git a/sh.c b/sh.c
index 3b7db65..c73d42d 100644
--- a/sh.c
+++ b/sh.c
@@ -248,6 +248,7 @@ main(int argc, char **argv)
char *tcp, *ttyn;
int f, reenter;
char **tempv;
+ const char *targinp = NULL;
int osetintr;
struct sigaction oparintr;
@@ -937,30 +938,7 @@ main(int argc, char **argv)
*p &= ASCII;
}
#endif
- arginp = SAVE(tempv[0]);
-
- /*
- * we put the command into a variable
- */
- if (arginp != NULL)
- setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE);
-
- /*
- * * Give an error on -c arguments that end in * backslash to
- * ensure that you don't make * nonportable csh scripts.
- */
- {
- int count;
-
- cp = Strend(arginp);
- count = 0;
- while (cp > arginp && *--cp == '\\')
- ++count;
- if ((count & 1) != 0) {
- exiterr = 1;
- stderror(ERR_ARGC);
- }
- }
+ targinp = tempv[0];
prompt = 0;
nofile = 1;
break;
@@ -1205,7 +1183,7 @@ main(int argc, char **argv)
sigset_interrupting(SIGXFSZ, queue_phup);
#endif
- if (quitit == 0 && arginp == 0) {
+ if (quitit == 0 && targinp == 0) {
#ifdef SIGTSTP
(void) signal(SIGTSTP, SIG_IGN);
#endif
@@ -1323,7 +1301,7 @@ main(int argc, char **argv)
*/
sigset_interrupting(SIGCHLD, queue_pchild);
- if (intty && !arginp)
+ if (intty && !targinp)
(void) ed_Setup(editing);/* Get the tty state, and set defaults */
/* Only alter the tty state if editing */
@@ -1358,7 +1336,7 @@ main(int argc, char **argv)
#ifdef _PATH_DOTCSHRC
(void) srcfile(_PATH_DOTCSHRC, 0, 0, NULL);
#endif
- if (!arginp && !onelflg && !havhash)
+ if (!targinp && !onelflg && !havhash)
dohash(NULL,NULL);
#ifndef LOGINFIRST
#ifdef _PATH_DOTLOGIN
@@ -1378,7 +1356,7 @@ main(int argc, char **argv)
if (!srccat(varval(STRhome), STRsldottcshrc))
(void) srccat(varval(STRhome), STRsldotcshrc);
- if (!arginp && !onelflg && !havhash)
+ if (!targinp && !onelflg && !havhash)
dohash(NULL,NULL);
/*
@@ -1398,7 +1376,7 @@ main(int argc, char **argv)
exitset--;
/* Initing AFTER .cshrc is the Right Way */
- if (intty && !arginp) { /* PWP setup stuff */
+ if (intty && !targinp) { /* PWP setup stuff */
ed_Init(); /* init the new line editor */
#ifdef SIG_WINDOW
check_window_size(1); /* mung environment */
@@ -1413,6 +1391,32 @@ main(int argc, char **argv)
if (nexececho)
setNS(STRecho);
+
+ if (targinp) {
+ arginp = SAVE(targinp);
+ /*
+ * we put the command into a variable
+ */
+ if (arginp != NULL)
+ setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE);
+
+ /*
+ * * Give an error on -c arguments that end in * backslash to
+ * ensure that you don't make * nonportable csh scripts.
+ */
+ {
+ int count;
+
+ cp = Strend(arginp);
+ count = 0;
+ while (cp > arginp && *--cp == '\\')
+ ++count;
+ if ((count & 1) != 0) {
+ exiterr = 1;
+ stderror(ERR_ARGC);
+ }
+ }
+ }
/*
* All the rest of the world is inside this call. The argument to process
* indicates whether it should catch "error unwinds". Thus if we are a
--
2.7.4
From 517fdacc6e194acfa56aecdb5bbf4cf7b129fbc2 Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Sun, 27 Nov 2016 16:41:24 +0000
Subject: [PATCH 2/2] mention latest fix
---
Fixes | 1 +
1 file changed, 1 insertion(+)
diff --git a/Fixes b/Fixes
index 7440349..c79dc38 100644
--- a/Fixes
+++ b/Fixes
@@ -1,3 +1,4 @@
+ 21. PR/471: Delay arginp parsing
20. V6.20.00 - 20161124
19. Don't resize the screen if it did not change size.
18. V6.19.01 - 20161025
--
2.7.4

View File

@ -1,49 +0,0 @@
From 75ccc1197d63d015348b9113ed8d9f7abace567e Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Mon, 28 Nov 2016 17:14:20 +0000
Subject: [PATCH] Fix type of read in prompt confirmation (eg. rmstar) (David
Kaspar)
---
Fixes | 1 +
sh.func.c | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Fixes b/Fixes
index c79dc38..1c2e183 100644
--- a/Fixes
+++ b/Fixes
@@ -1,3 +1,4 @@
+ 22. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
21. PR/471: Delay arginp parsing
20. V6.20.00 - 20161124
19. Don't resize the screen if it did not change size.
diff --git a/sh.func.c b/sh.func.c
index a866076..2118399 100644
--- a/sh.func.c
+++ b/sh.func.c
@@ -2734,16 +2734,18 @@ nlsclose(void)
int
getYN(const char *prompt)
{
- int doit, c;
+ int doit;
+ char c;
+
xprintf("%s", prompt);
flush();
- (void) force_read(SHIN, &c, 1);
+ (void) force_read(SHIN, &c, sizeof(c));
/*
* Perhaps we should use the yesexpr from the
* actual locale
*/
doit = (strchr(CGETS(22, 14, "Yy"), c) != NULL);
- while (c != '\n' && force_read(SHIN, &c, 1) == 1)
+ while (c != '\n' && force_read(SHIN, &c, sizeof(c)) == sizeof(c))
continue;
return doit;
}
--
2.7.4

View File

@ -1,26 +0,0 @@
From 6a542dc4fb2ba26518a47e9b3a9bcd6a91b94596 Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Fri, 2 Dec 2016 16:59:28 +0000
Subject: [PATCH] Fix out of bounds read (Brooks Davis) (reproduce by starting
tcsh and hitting tab at the prompt)
---
ed.chared.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ed.chared.c b/ed.chared.c
index 1277e53..310393e 100644
--- a/ed.chared.c
+++ b/ed.chared.c
@@ -750,7 +750,7 @@ c_substitute(void)
/*
* If we found a history character, go expand it.
*/
- if (HIST != '\0' && *p == HIST)
+ if (p >= InputBuf && HIST != '\0' && *p == HIST)
nr_exp = c_excl(p);
else
nr_exp = 0;
--
2.7.4

View File

@ -1,28 +0,0 @@
From 2309245d647853442f6a5450130f56499698176e Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Wed, 7 Dec 2016 02:52:27 +0000
Subject: [PATCH] Don't play pointer tricks that are undefined in modern c
(Brooks Davis)
---
tw.init.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tw.init.c b/tw.init.c
index 68adbb9..d9525c5 100644
--- a/tw.init.c
+++ b/tw.init.c
@@ -125,9 +125,8 @@ tw_str_add(stringlist_t *sl, size_t len)
sl->buff = xrealloc(sl->buff, sl->tbuff * sizeof(Char));
/* Re-thread the new pointer list, if changed */
if (ptr != NULL && ptr != sl->buff) {
- intptr_t offs = sl->buff - ptr;
for (i = 0; i < sl->nlist; i++)
- sl->list[i] += offs;
+ sl->list[i] = sl->buff + (sl->list[i] - ptr);
}
disabled_cleanup(&pintr_disabled);
}
--
2.9.3

View File

@ -1,69 +0,0 @@
From 8016b940223e73ec5ba031c4c8451e57efa9d37b Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Sat, 24 Dec 2016 10:22:22 +0000
Subject: [PATCH 1/3] Reset numbering since 6.20.00
---
Fixes | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Fixes b/Fixes
index 1c2e183..ef39e42 100644
--- a/Fixes
+++ b/Fixes
@@ -1,5 +1,6 @@
- 22. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
- 21. PR/471: Delay arginp parsing
+ 2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
+ 1. PR/471: Delay arginp parsing
+
20. V6.20.00 - 20161124
19. Don't resize the screen if it did not change size.
18. V6.19.01 - 20161025
--
2.9.3
From 4ee184c298368e8a7f2954197f3f279a70dd10aa Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Sat, 24 Dec 2016 12:39:23 +0000
Subject: [PATCH 2/3] Note a missing fix.
---
Fixes | 1 +
1 file changed, 1 insertion(+)
diff --git a/Fixes b/Fixes
index ef39e42..c99ffa3 100644
--- a/Fixes
+++ b/Fixes
@@ -1,3 +1,4 @@
+ 3. Fix out of bounds read (Brooks Davis)
2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
1. PR/471: Delay arginp parsing
--
2.9.3
From 4f3088e31cc72c314ecb803fac0405dac5047179 Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Sat, 24 Dec 2016 13:15:47 +0000
Subject: [PATCH 3/3] Note another missing fix.
---
Fixes | 1 +
1 file changed, 1 insertion(+)
diff --git a/Fixes b/Fixes
index c99ffa3..aec768e 100644
--- a/Fixes
+++ b/Fixes
@@ -1,3 +1,4 @@
+ 4. Don't play pointer tricks that are undefined in modern c (Brooks Davis)
3. Fix out of bounds read (Brooks Davis)
2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
1. PR/471: Delay arginp parsing
--
2.9.3

View File

@ -1,480 +0,0 @@
From f605e04aec4ff608c045a40ae8df1bb6bae21aa5 Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Wed, 1 Feb 2017 14:26:16 +0200
Subject: [PATCH 1/5] Cleanup README files
Rename README to BUILDING and fold in README.imake so
all build instructions are now in a single file.
Add README.md for a short intro on GitHub.
---
README => BUILDING | 115 +++++++++++++++++++++++++++--------------------------
Imakefile | 11 +++--
Makefile.in | 6 +--
Makefile.std | 6 +--
Makefile.vms | 6 +--
Ported | 2 +-
README.imake | 9 -----
README.md | 17 ++++++++
8 files changed, 90 insertions(+), 82 deletions(-)
rename README => BUILDING (68%)
delete mode 100644 README.imake
create mode 100644 README.md
diff --git a/README b/BUILDING
similarity index 68%
rename from README
rename to BUILDING
index 77693cd..f19f849 100644
--- a/README
+++ b/BUILDING
@@ -1,32 +1,44 @@
-This is tcsh version 6.20.00. Tcsh is a version of the Berkeley
-C-Shell, with the addition of: a command line editor, command and file
-name completion, listing, etc. and a bunch of small additions to the
+Tcsh is an enhanced but completely compatible version of the Berkeley
+C-Shell, with the addition of a command line editor, command and file
+name completion, listing, etc., and a bunch of small additions to the
shell itself.
Tcsh has been ported to most unix variants, and can be tinkered to work
in unix systems that it has not ported yet. See the Ported file for
a more complete list of ported systems and in the config directory for
a configuration file that matches your system.
+
Tcsh also runs under VMS/POSIX and OS/2+emx; the OS/2 port is not
complete yet.
-Feel free to use it. These changes to csh may only be included in a
-commercial product if the inclusion or exclusion does not change the
+Feel free to use it. These changes to csh may only be included in
+a commercial product if the inclusion or exclusion does not change the
purchase price, level of support, etc. Please respect the individual
authors by giving credit where credit is due (in other words, don't
claim that you wrote portions that you haven't, and don't delete the
-names of the authors from the source code or documentation).
+names of the authors from the source code or documentation).
To install tcsh:
-0) Try running "./configure". If that doesn't work, goto step 1.
+1) Try running "./configure". If that doesn't work, goto step 2.
Run "./configure --help" to see possible options. After running
- configure, goto step 3.
+ configure, goto step 5.
+
+2) If you have imake running on your machine, you may try building with
+ it. Note that imake is not supported for all the platforms yet, so
+ this might not work on your machine. If that is the case please let
+ us know, and goto step 3. If you can send a patch that fixes the
+ problem we would appreciate it.
+
+ a) Modify configurable parameters in imake.config to your liking.
+ b) xmkmf; make depend
-1) Otherwise copy Makefile.std to Makefile. Look at the Makefile and
+ Goto step 5.
+
+3) Otherwise copy Makefile.std to Makefile. Look at the Makefile and
make sure that you are using the right compilation flags.
-2) Copy the appropriate for your machine and OS config file from the
+4) Copy the appropriate for your machine and OS config file from the
config subdirectory into config.h. Consult the file "Ported" for
settings known to work on various machines. If you are trying to
compile tcsh on a machine for which there is no config file yet,
@@ -34,35 +46,36 @@ To install tcsh:
the supplied ones. If you get tcsh working on a new machine, I'd
appreciate a copy of the config file plus additional information
about the architecture/OS. If you are creating a new config file,
- look very hard at BSDJOBS and BSDTIMES if you are running
- a non-BSD machine. For vanila SysV, these would all be #undef-ed,
- but others may vary (such as A/UX or HPUX). On a pyramid, compile
- in the UCB universe even if you are running under the ATT universe
- usually; it will work anyway, and you get job control for free.
+ look very hard at BSDJOBS and BSDTIMES if you are running a non-BSD
+ machine. For vanila SysV, these would all be #undef-ed, but others
+ may vary (such as A/UX or HPUX). On a pyramid, compile in the UCB
+ universe even if you are running under the ATT universe usually; it
+ will work anyway, and you get job control for free.
-3) Look at config_f.h, and enable or disable any features you want.
+5) Look at config_f.h, and enable or disable any features you want.
It is configured the way I like it, but you may disagree.
-4) Look at host.defs to make sure that you have the right defines to set
- the environment variables "HOSTTYPE", "MACHTYPE", "OSTYPE" and
- "VENDOR" correctly. If you need to make changes, PLEASE SEND THEM
+6) Look at host.defs to make sure that you have the right defines to
+ set the environment variables "HOSTTYPE", "MACHTYPE", "OSTYPE" and
+ "VENDOR" correctly. If you need to make changes, PLEASE SEND THEM
BACK TO ME.
-5) You may want to adjust the DESTBIN and DESTMAN entries in
- the Makefile. These are the directories that tcsh, and the tcsh.1
- man entry will be placed in when you do a "make install" and "make
- install.man" respectively. If you decide to install tcsh somewhere
- other than in /usr/local/bin/tcsh, you should #define _PATH_TCSHELL
+7) You may want to adjust the DESTBIN and DESTMAN entries in Makefile.
+ These are the directories that tcsh, and the tcsh.1 man entry will
+ be placed in when you do a "make install" and "make install.man"
+ respectively. If you decide to install tcsh somewhere other
+ than in /usr/local/bin/tcsh, you should #define _PATH_TCSHELL
"/your/installation/directory/tcsh" in pathnames.h.
-6) make
+8) make
-7) Read the documentation while you are waiting. The file tcsh.man
+9) Read the documentation while you are waiting. The file tcsh.man
is in standard [nt]roff -man format. If you like, you can run the
- tcsh.man2html script (requires Perl) to generate an HTML version of
- the manpage which you can read with Mosaic, lynx or other HTML browser.
+ tcsh.man2html script (requires Perl) to generate an HTML version
+ of the manpage which you can read with Mosaic, lynx or other HTML
+ browser.
-8) Test tcsh by typing ./tcsh to see that it has compiled correctly.
+10) Test tcsh by typing ./tcsh to see that it has compiled correctly.
The history command should give a time stamp on every entry.
Typing normal characters should echo each exactly once. Control-A
should put the cursor at the beginning of the input line, but after
@@ -80,29 +93,19 @@ To install tcsh:
passwd appears on the screen, you have lost /dev/tty. Otherwise
everything is fine.
-9) Once satisfied that tcsh is working correctly, complete the installation
- by typing "make install" to install the binary, and "make install.man" to
- install the documentation. Don't forget to look at complete.tcsh for
- useful completions...
-
-10) Enjoy.
-
-11) PLEASE file any bug reports (and fixes), code for new features at:
+11) Once satisfied that tcsh is working correctly, complete the
+ installation by typing "make install" to install the binary, and
+ "make install.man" to install the documentation. Don't forget to
+ look at complete.tcsh for useful completions...
- http://bugs.gw.com/
-
- Comments, questions, etc. (even flames) are welcome via email to:
-
- The tcsh bugs mailing list
- tcsh-bugs@mx.gw.com
-
-Various:
+12) Enjoy.
***************************************************************************
-On sysv versions < 3.0 (not hpux) Doug Gwyn's public domain directory
+On sysv versions < 3.0 (not hpux) Doug Gwyn's public domain directory
manipulation library has to be installed. This library is available
for anonymous ftp from prep.ai.mit.edu:/pub/gnu/dirent.tar.Z
+
If the network is not installed, then there is a gethostname()
routine is tc.os.c
@@ -130,24 +133,23 @@ error message to that effect. If you don't like the message:
Or: Comment the error printing out in tc.alloc.c
Or: Compile -DSYSMALLOC
-
***************************************************************************
From: Scott Krotz <krotz@honey.rtsg.mot.com>
-Tcsh has been ported to minix by Scott Krotz (krotz@honey.rtsg.mot.com).
+Tcsh has been ported to minix by Scott Krotz (krotz@honey.rtsg.mot.com).
Unfortunately the minix sed is broken, so you'll have to find a way to
make tc.const.h, sh.err.h, ed.defns.h which are automatically generated.
-The easiest way to create them is to make a copy from unix, copying
+The easiest way to create them is to make a copy from unix, copying
minix to config.h, and then 'make sh.err.h tc.const.h ed.defns.h'
The OS/dependent files are in mi.termios.h, mi.wait.h, mi.varargs.h
-You will get some warnings, but dont worry about them, just ignore
-them. After tcsh has compiled and the gcc binary is converted to a
-minix binary, remember to chmem it to give it more memory - it will
-need it! How much you need depends on how many aliases you have, etc..
-Add at least 50000 to it.
+You will get some warnings, but dont worry about them, just ignore them.
+After tcsh has compiled and the gcc binary is converted to a minix
+binary, remember to chmem it to give it more memory - it will need it!
+How much you need depends on how many aliases you have, etc.. Add at
+least 50000 to it.
One last thing. You might have to make some links for include files so
that they are in the directories that tcsh is expecting while compiling.
@@ -193,12 +195,11 @@ I can make the binary available to anyone who wants it (for example people
who can't get access to a cross-compiling environment, and who don't yet
have gcc running under minix).
-
***************************************************************************
-If your compiler cannot handle long symbol names, add
+If your compiler cannot handle long symbol names, add
-#include "snames.h"
+#include "snames.h"
to your config.h file
diff --git a/Imakefile b/Imakefile
index 5dc0db7..be2bebe 100644
--- a/Imakefile
+++ b/Imakefile
@@ -520,12 +520,11 @@ TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \
tc.vers.${SUF} tc.who.${SUF}
-MISCF = Makefile.std Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
- WishList config_f.h eight-bit.me glob.3 patchlevel.h \
- pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
- README.imake complete.tcsh vmsreadme.txt Makefile.vms termcap.vms \
- snames.h host.defs gethost.c tcsh.man2html Makefile.in configure.ac \
- Makefile.win32 aclocal.m4
+MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \
+ FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \
+ tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \
+ Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \
+ Makefile.in configure.ac Makefile.win32 aclocal.m4
CONFSRCS=config/[a-z]*
diff --git a/Makefile.in b/Makefile.in
index caf8d9c..210b7de 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -405,11 +405,11 @@ TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
tc.vers.${SUF} tc.who.${SUF}
PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
-AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
+AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
- README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
- host.defs gethost.c tcsh.man2html configure.ac configure config.h.in \
+ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
+ gethost.c tcsh.man2html configure.ac configure config.h.in \
tests/testsuite.at aclocal.m4
TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \
tests/expr.at tests/lexical.at tests/mb-eucjp.at \
diff --git a/Makefile.std b/Makefile.std
index ffd33b1..3466d4c 100644
--- a/Makefile.std
+++ b/Makefile.std
@@ -315,11 +315,11 @@ TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
tc.vers.${SUF} tc.who.${SUF}
PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
-AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
+AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
- README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
- host.defs gethost.c tcsh.man2html configure.ac configure config.h.in \
+ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
+ gethost.c tcsh.man2html configure.ac configure config.h.in \
aclocal.m4
VHSRCS=${PVSRCS} ${AVSRCS}
diff --git a/Makefile.vms b/Makefile.vms
index d47f9ce..bc24114 100644
--- a/Makefile.vms
+++ b/Makefile.vms
@@ -293,11 +293,11 @@ TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
tc.vers.${SUF} tc.who.${SUF}
PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
-AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
+AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
- README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
- host.defs gethost.c tcsh.man2html configure.ac aclocal.m4
+ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
+ gethost.c tcsh.man2html configure.ac aclocal.m4
VHSRCS=${PVSRCS} ${AVSRCS}
diff --git a/Ported b/Ported
index ca1ac3b..f1151c7 100644
--- a/Ported
+++ b/Ported
@@ -338,7 +338,7 @@ CFLAGS : normal
LIBES : -ltermcap
OS : bsd 4.3reno
CONFIG : bsdreno
-NOTES : ttyname() is buggy. calls closedir() twice. See README
+NOTES : ttyname() is buggy. calls closedir() twice. See BUILDING
ENVIRON : n/a
VERSION : 6.00.04
diff --git a/README.imake b/README.imake
deleted file mode 100644
index dfe2e2f..0000000
--- a/README.imake
+++ /dev/null
@@ -1,9 +0,0 @@
-
-If you have imake running on your machine, you may skip steps 1 and 2
-described in the README file and try instead the process described here.
-Note that imake is not supported for all the platforms yet, so this
-might not work on your machine. If that is the case please let us know.
-If you can send a patch that fixes the problem we would appreciate it.
-
-1. edit imake.config and modify the configurable parameters to your liking.
-2. 'xmkmf; make depend; make'
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..43a92bb
--- /dev/null
+++ b/README.md
@@ -0,0 +1,17 @@
+# Tcsh - C shell with file name completion and command line editing
+
+The Tcsh source code is available on GitHub as a read-only mirror at:
+
+ http://github.com/tcsh-org/tcsh
+
+Instructions for compiling Tcsh can be found in [BUILDING].
+
+PLEASE file any bug reports (and fixes), code for new features at:
+
+ http://bugs.gw.com/
+
+Comments, questions, etc. (even flames) are welcome via email to
+the Tcsh Bugs mailing list:
+
+ tcsh-bugs@mx.gw.com
+
--
2.9.3
From 709e97df63dab42dc7cc474f54b621f732228b25 Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Wed, 1 Feb 2017 15:45:10 +0200
Subject: [PATCH 2/5] Improve formatting
---
README.md | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 43a92bb..fcbdbfc 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,21 @@
-# Tcsh - C shell with file name completion and command line editing
+# Tcsh
-The Tcsh source code is available on GitHub as a read-only mirror at:
+*C shell with file name completion and command line editing*
- http://github.com/tcsh-org/tcsh
+The Tcsh source code is available on GitHub as a read-only repo
+mirror at:
-Instructions for compiling Tcsh can be found in [BUILDING].
+> http://github.com/tcsh-org/tcsh
-PLEASE file any bug reports (and fixes), code for new features at:
+Instructions for compiling Tcsh can be found in
+[BUILDING](blob/master/BUILDING).
- http://bugs.gw.com/
+PLEASE file any bug reports, fixes, and code for new features at:
+
+> http://bugs.gw.com/
Comments, questions, etc. (even flames) are welcome via email to
the Tcsh Bugs mailing list:
- tcsh-bugs@mx.gw.com
+> tcsh-bugs@mx.gw.com
--
2.9.3
From e784b20c10a214a944953c25601918c7ab0c1f69 Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Wed, 1 Feb 2017 16:01:43 +0200
Subject: [PATCH 3/5] Add build status
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index fcbdbfc..6ff9b7a 100644
--- a/README.md
+++ b/README.md
@@ -19,3 +19,4 @@ the Tcsh Bugs mailing list:
> tcsh-bugs@mx.gw.com
+[![Build Status](https://travis-ci.org/tcsh-org/tcsh.svg?branch=master)](https://travis-ci.org/tcsh-org/tcsh)
--
2.9.3
From 1f2066458f442cc956138c24c79110f36a30cf0d Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Wed, 1 Feb 2017 16:34:17 +0200
Subject: [PATCH 4/5] Learning curve
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 6ff9b7a..466c22b 100644
--- a/README.md
+++ b/README.md
@@ -7,8 +7,7 @@ mirror at:
> http://github.com/tcsh-org/tcsh
-Instructions for compiling Tcsh can be found in
-[BUILDING](blob/master/BUILDING).
+Instructions for compiling Tcsh can be found in [BUILDING].
PLEASE file any bug reports, fixes, and code for new features at:
--
2.9.3
From 19a63ad9f28fd9cb7e92bd397f128f5de7619887 Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Wed, 1 Feb 2017 23:58:37 +0200
Subject: [PATCH 5/5] Fix linking.
---
README.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 466c22b..f273f8f 100644
--- a/README.md
+++ b/README.md
@@ -18,4 +18,8 @@ the Tcsh Bugs mailing list:
> tcsh-bugs@mx.gw.com
-[![Build Status](https://travis-ci.org/tcsh-org/tcsh.svg?branch=master)](https://travis-ci.org/tcsh-org/tcsh)
+[![Build Status][status]][travis]
+
+[BUILDING]: BUILDING
+[status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master
+[travis]: https://travis-ci.org/tcsh-org/tcsh
--
2.9.3

View File

@ -1,60 +0,0 @@
From 7fd9ae6ddd1dc726c354f5ed7f8104b1a6e35d93 Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Fri, 10 Feb 2017 13:44:34 +0000
Subject: [PATCH 1/2] Look for tgetent in libtinfo as well (Werner Fink)
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 2a56740..28bcc16 100755
--- a/configure
+++ b/configure
@@ -4284,7 +4284,7 @@ return tgetent ();
return 0;
}
_ACEOF
-for ac_lib in '' termlib termcap curses ncurses; do
+for ac_lib in '' termlib tinfo termcap curses ncurses; do
if test -z "$ac_lib"; then
ac_res="none required"
else
diff --git a/configure.ac b/configure.ac
index 0515787..4a964ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,7 +315,7 @@ esac
dnl Checks for libraries
AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(getspnam, sec)
-AC_SEARCH_LIBS([tgetent], [termlib termcap curses ncurses], [], [
+AC_SEARCH_LIBS([tgetent], [termlib tinfo termcap curses ncurses], [], [
AC_MSG_ERROR([unable to find the tgetent() function])
])
AC_SEARCH_LIBS(gethostbyname, nsl)
--
2.9.3
From a177220dce0f757cbba7a6476e1a44b1b7207925 Mon Sep 17 00:00:00 2001
From: Kimmo Suominen <kimmo@suominen.com>
Date: Fri, 10 Feb 2017 16:51:05 +0200
Subject: [PATCH 2/2] Look for tgetent in libtinfo as well (Werner Fink)
---
Fixes | 1 +
1 file changed, 1 insertion(+)
diff --git a/Fixes b/Fixes
index aec768e..7bd907d 100644
--- a/Fixes
+++ b/Fixes
@@ -1,3 +1,4 @@
+ 5. Look for tgetent in libtinfo as well (Werner Fink)
4. Don't play pointer tricks that are undefined in modern c (Brooks Davis)
3. Fix out of bounds read (Brooks Davis)
2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
--
2.9.3

View File

@ -1,43 +0,0 @@
From 8e6dfd53321a0b0047f7d75db21a946c166c600b Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Fri, 17 Feb 2017 11:17:27 -0500
Subject: [PATCH] Unfortunately the AsciiOnly reversion causes a SEGV because
*ch is used to index in the command array, and now contains INVALID_BYTE. env
-i ./tcsh <meta>b
---
ed.inputl.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/ed.inputl.c b/ed.inputl.c
index f543a6f..1a0d356 100644
--- a/ed.inputl.c
+++ b/ed.inputl.c
@@ -796,13 +796,17 @@ GetNextChar(Char *cp)
return -1;
}
}
- cbp++;
- if (normal_mbtowc(cp, cbuf, cbp) == -1) {
- reset_mbtowc();
- if (cbp < MB_CUR_MAX)
- continue; /* Maybe a partial character */
- /* And drop the following bytes, if any */
- *cp = (unsigned char)*cbuf | INVALID_BYTE;
+ if (AsciiOnly) {
+ *cp = (unsigned char)*cbuf;
+ } else {
+ cbp++;
+ if (normal_mbtowc(cp, cbuf, cbp) == -1) {
+ reset_mbtowc();
+ if (cbp < MB_CUR_MAX)
+ continue; /* Maybe a partial character */
+ /* And drop the following bytes, if any */
+ *cp = (unsigned char)*cbuf | INVALID_BYTE;
+ }
}
break;
}
--
2.9.3

View File

@ -1,39 +0,0 @@
From 2ad4fc1705893207598ed5cd21713ddf3f17bba0 Mon Sep 17 00:00:00 2001
From: zoulasc <christos@zoulas.com>
Date: Thu, 23 Feb 2017 11:55:33 -0500
Subject: [PATCH]
https://github.com/tcsh-org/tcsh/pull/1#issuecomment-282035528
---
tests/lexical.at | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/lexical.at b/tests/lexical.at
index 7b7da4e..3dc6024 100644
--- a/tests/lexical.at
+++ b/tests/lexical.at
@@ -567,10 +567,10 @@ run=3
]])
AT_DATA([uniformity_test.csh],
[[
-set SERVICE_NAME_LOG = `cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[:blank:]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g'`
+set SERVICE_NAME_LOG = `cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g'`
echo -n "$SERVICE_NAME_LOG" > ./output1
-cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[:blank:]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g' > ./output2
+cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g' > ./output2
diff -uprN ./output1 ./output2 >& /dev/null
@@ -587,7 +587,7 @@ AT_DATA([quoting_result_test.csh],
echo "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP\)(HOST=db\)(PORT=1521\)\)(CONNECT_DATA=(SERVER=DEDICATED\)(SERVICE_NAME=bns03\)\)\)" > ./expected_result
set string = "jdbc_url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bns03)))"
-set SERVICE_NAME_LOG = `echo "$string" | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[:blank:]*\([^$]*\)$/\1/p' | perl -pe 's/\)/\\\)/g'`
+set SERVICE_NAME_LOG = `echo "$string" | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\)/\\\)/g'`
echo "$SERVICE_NAME_LOG" > ./actual_result
--
2.9.3

View File

@ -1,48 +0,0 @@
From 1ef6e9d0eef9278829f863fff55755b7a5415b81 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Fri, 11 Jan 2019 10:49:54 -0500
Subject: [PATCH] Abort history loading on long lines
diff --git a/sh.lex.c b/sh.lex.c
index fee790a..e945795 100644
--- a/sh.lex.c
+++ b/sh.lex.c
@@ -145,6 +145,7 @@ lex(struct wordent *hp)
struct wordent *wdp;
eChar c;
int parsehtime = enterhist;
+ int toolong = 0;
histvalid = 0;
histline.len = 0;
@@ -179,6 +180,8 @@ lex(struct wordent *hp)
wdp = new;
wdp->word = word(parsehtime);
parsehtime = 0;
+ if (enterhist && toolong++ > 10 * 1024)
+ stderror(ERR_LTOOLONG);
} while (wdp->word[0] != '\n');
cleanup_ignore(hp);
cleanup_until(hp);
@@ -291,9 +294,12 @@ word(int parsehtime)
Char hbuf[12];
int h;
int dolflg;
+ int toolong = 0;
cleanup_push(&wbuf, Strbuf_cleanup);
loop:
+ if (enterhist && toolong++ > 256 * 1024)
+ seterror(ERR_WTOOLONG);
while ((c = getC(DOALL)) == ' ' || c == '\t')
continue;
if (cmap(c, _META | _ESC))
@@ -352,6 +358,8 @@ word(int parsehtime)
c1 = 0;
dolflg = DOALL;
for (;;) {
+ if (enterhist && toolong++ > 256 * 1024)
+ seterror(ERR_WTOOLONG);
if (c1) {
if (c == c1) {
c1 = 0;

View File

@ -1,47 +0,0 @@
From 83c5be028419b3f27c3cc707b88fb21bfa4e1b11 Mon Sep 17 00:00:00 2001
From: zoulasc <christos@zoulas.com>
Date: Sat, 19 Oct 2019 08:52:53 -0400
Subject: [PATCH] FIx PR/113: failing -c command causes infinite loop
diff --git a/sh.c b/sh.c
index 4b5c624..dd87172 100644
--- a/sh.c
+++ b/sh.c
@@ -237,6 +237,7 @@ main(int argc, char **argv)
int nofile = 0;
volatile int nverbose = 0;
volatile int rdirs = 0;
+ volatile int exitcode = 0;
int quitit = 0;
Char *cp;
#ifdef AUTOLOGOUT
@@ -1390,6 +1391,12 @@ main(int argc, char **argv)
if (targinp) {
+ /* If this -c command caused an error before, skip processing */
+ if (reenter && arginp) {
+ exitcode = 1;
+ goto done;
+ }
+
arginp = SAVE(targinp);
/*
* we put the command into a variable
@@ -1422,6 +1429,7 @@ main(int argc, char **argv)
*/
process(setintr);
+done:
/*
* Mop-up.
*/
@@ -1443,7 +1451,7 @@ main(int argc, char **argv)
}
record();
exitstat();
- return (0);
+ return exitcode;
}
void

View File

@ -1,25 +0,0 @@
From 4723e1754cd28657183358334fe77fe328f01bd0 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos.zoulas@twosigma.com>
Date: Fri, 18 Oct 2019 13:35:49 -0400
Subject: [PATCH] When the load of history caused an error, say so.
diff --git a/sh.err.c b/sh.err.c
index c676f5e..010b23c 100644
--- a/sh.err.c
+++ b/sh.err.c
@@ -43,6 +43,7 @@
#endif
char *seterr = NULL; /* Holds last error if there was one */
+extern int enterhist;
#define ERR_FLAGS 0xf0000000
#define ERR_NAME 0x10000000
@@ -630,6 +631,8 @@ stderror(unsigned int id, ...)
*/
flush();/*FIXRESET*/
haderr = 1; /* Now to diagnostic output */
+ if (enterhist)
+ xprintf("Can't load history: ");/*FIXRESET*/
if (flags & ERR_NAME)
xprintf("%s: ", bname);/*FIXRESET*/
if ((flags & ERR_OLD)) {

View File

@ -1,31 +0,0 @@
From 67db04d8d8ada0aa2fb7dfdf83f3a408ad5a01dc Mon Sep 17 00:00:00 2001
From: zoulasc <christos@zoulas.com>
Date: Mon, 20 Jan 2020 11:29:01 -0500
Subject: [PATCH] Prevent phup() and record() from being executed more than
once because writing history recursively deadlocks (Brett Frankenberger)
diff --git a/sh.c b/sh.c
index dd87172..75ba62d 100644
--- a/sh.c
+++ b/sh.c
@@ -1839,6 +1839,10 @@ exitstat(void)
void
phup(void)
{
+ static int again = 0;
+ if (again++)
+ return;
+
if (loginsh) {
setcopy(STRlogout, STRhangup, VAR_READWRITE);
#ifdef _PATH_DOTLOGOUT
@@ -2516,6 +2520,10 @@ defaultpath(void)
static void
record(void)
{
+ static int again = 0;
+ if (again++)
+ return;
+
if (!fast) {
recdirs(NULL, adrof(STRsavedirs) != NULL);
rechist(NULL, adrof(STRsavehist) != NULL);

View File

@ -1,35 +0,0 @@
From 38ffe6da549152a0c411407f5846d0b8896bc25c Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Thu, 30 Jul 2020 09:42:39 +0200
Subject: [PATCH] Call stderror consistently and avoid inf loops
Suggested by Kamil Dudka
---
sh.lex.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh.lex.c b/sh.lex.c
index a10436c..fcaae97 100644
--- a/sh.lex.c
+++ b/sh.lex.c
@@ -304,7 +304,7 @@ word(int parsehtime)
cleanup_push(&wbuf, Strbuf_cleanup);
loop:
if (enterhist && toolong++ > 256 * 1024)
- seterror(ERR_WTOOLONG);
+ stderror(ERR_WTOOLONG);
while ((c = getC(DOALL)) == ' ' || c == '\t')
continue;
if (cmap(c, _META | _ESC))
@@ -364,7 +364,7 @@ loop:
dolflg = DOALL;
for (;;) {
if (enterhist && toolong++ > 256 * 1024)
- seterror(ERR_WTOOLONG);
+ stderror(ERR_WTOOLONG);
if (c1) {
if (c == c1) {
c1 = 0;
--
2.25.4

View File

@ -1,17 +1,13 @@
From cab544f34758f71ab3070f343efb6daee68daf81 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 8 Sep 2021 11:00:35 +0200
Subject: [PATCH] Modifiers no longer breaks history
Fix bug reported by Jan Macku: alias postcmd '/bin/echo
-n "COMMAND:"'"'"'\!#:-$:gx'"'"'' echo 1 2 3 4 5
^P prints echo 1 2 3 4
Reason: domod() enters junk history entries with event number
From 04a68ad191cfcb87cdff70a6b913721e423cd28b Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 23 Aug 2021 08:31:59 -0400
Subject: [PATCH] Fix bug reported by Jan Macku: alias postcmd '/bin/echo
-n "COMMAND:"'"'"'\!#:-$:gx'"'"'' echo 1 2 3 4 5 ^P prints echo 1
2 3 4 Reason: domod() enters junk history entries with event number
HIST_PURGE aliasrun which is used to run postcmd modifies the history
appending those entries. Fix by explicitly cleaning up those entries in
aliasrun
Based on upstream patch: 04a68ad191cfcb87cdff70a6b913721e423cd28b from Christos Zoulas <christos@zoulas.com>
---
sh.decls.h | 1 +
sh.hist.c | 11 +++++++++++
@ -19,10 +15,10 @@ Fix bug reported by Jan Macku: alias postcmd '/bin/echo
3 files changed, 14 insertions(+)
diff --git a/sh.decls.h b/sh.decls.h
index 8dc22d5..a75563b 100644
index e230becd..1ac9716e 100644
--- a/sh.decls.h
+++ b/sh.decls.h
@@ -218,6 +218,7 @@ extern int t_pmatch (const Char *, const Char *,
@@ -217,6 +217,7 @@ extern int t_pmatch (const Char *, const Char *,
*/
extern void dohist (Char **, struct command *);
extern struct Hist *enthist (int, struct wordent *, int, int, int);
@ -31,10 +27,10 @@ index 8dc22d5..a75563b 100644
extern char *fmthist (int, ptr_t);
extern void rechist (Char *, int);
diff --git a/sh.hist.c b/sh.hist.c
index 1abd522..bafc711 100644
index 14d862a3..40660bdc 100644
--- a/sh.hist.c
+++ b/sh.hist.c
@@ -1178,6 +1178,17 @@ dohist(Char **vp, struct command *c)
@@ -1184,6 +1184,17 @@ dohist(Char **vp, struct command *c)
}
}
@ -53,7 +49,7 @@ index 1abd522..bafc711 100644
char *
fmthist(int fmt, ptr_t ptr)
diff --git a/tc.func.c b/tc.func.c
index feb1c89..4849b55 100644
index 9f2b1a29..df4aa7a3 100644
--- a/tc.func.c
+++ b/tc.func.c
@@ -999,6 +999,7 @@ aliasrun(int cnt, Char *s1, Char *s2)
@ -68,10 +64,7 @@ index feb1c89..4849b55 100644
}
cleanup_until(&w);
pendjob();
+ cleanhist();
+ cleanhist();
/* Restore status */
setv(STRstatus, putn((tcsh_number_t)status), VAR_READWRITE);
}
--
2.31.1

View File

@ -1,20 +1,27 @@
From 534e2628b598b38801759535f38c228793253345 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 8 Sep 2021 10:52:43 +0200
Subject: [PATCH] Expose HIST_PURGE - Compare pointer against null - Use
From c14852867786c798f98a23d075e76a2e2acce204 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 23 Aug 2021 08:30:57 -0400
Subject: [PATCH] - Expose HIST_PURGE - Compare pointer against null - Use
initlex()
Based on upstream patch c14852867786c798f98a23d075e76a2e2acce204 from Christos Zoulas <christos@zoulas.com>
---
sh.h | 1 +
sh.h | 2 ++
sh.lex.c | 6 ++----
2 files changed, 3 insertions(+), 4 deletions(-)
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sh.h b/sh.h
index a41e2e0..5f9cb14 100644
index 3c285a9e..77e801c6 100644
--- a/sh.h
+++ b/sh.h
@@ -1019,6 +1019,7 @@ EXTERN struct varent {
@@ -78,6 +78,7 @@ typedef unsigned long intptr_t;
#if defined(KANJI) && defined(WIDE_STRINGS) && defined(HAVE_NL_LANGINFO) && defined(CODESET)
#define AUTOSET_KANJI
#endif
+
/*
* Sanity
*/
@@ -1027,6 +1028,7 @@ EXTERN struct varent {
* The following are for interfacing redo substitution in
* aliases to the lexical routines.
*/
@ -23,20 +30,20 @@ index a41e2e0..5f9cb14 100644
EXTERN struct wordent *alhistt IZERO_STRUCT;/* Node after last in arg list */
EXTERN Char **alvec IZERO_STRUCT,
diff --git a/sh.lex.c b/sh.lex.c
index b754fd3..065c78b 100644
index 5b0c6d8d..afe053e5 100644
--- a/sh.lex.c
+++ b/sh.lex.c
@@ -155,8 +155,7 @@ lex(struct wordent *hp)
histline.len = 0;
@@ -153,8 +153,7 @@ lex(struct wordent *hp)
btell(&lineloc);
if (!postcmd_active)
btell(&lineloc);
- hp->next = hp->prev = hp;
- hp->word = STRNULL;
+ initlex(hp);
+ initlex(hp);
hadhist = 0;
do
c = readc(0);
@@ -703,7 +702,7 @@ getexcl(Char sc)
@@ -711,7 +710,7 @@ getexcl(Char sc)
lastev = eventno;
hp = gethent(sc);
@ -45,7 +52,7 @@ index b754fd3..065c78b 100644
return;
hadhist = 1;
dol = 0;
@@ -893,7 +892,6 @@ getsub(struct wordent *en)
@@ -901,7 +900,6 @@ getsub(struct wordent *en)
* We raise the limit to 50000000
*/
@ -53,6 +60,3 @@ index b754fd3..065c78b 100644
static struct wordent *
dosub(Char sc, struct wordent *en, int global)
{
--
2.31.1

View File

@ -12,8 +12,8 @@
Name: tcsh
Summary: An enhanced version of csh, the C shell
Version: 6.20.00
Release: 15%{?dist}
Version: 6.22.03
Release: 6%{?dist}
License: BSD
URL: http://www.tcsh.org/
@ -27,6 +27,7 @@ Requires(post): coreutils
Requires(post): grep
Requires(postun): sed
BuildRequires: make
BuildRequires: gcc
BuildRequires: git
BuildRequires: autoconf
@ -42,31 +43,15 @@ BuildRequires: ncurses-devel
# Upstream patches -- official upstream patches released by upstream since the
# ---------------- last rebase that are necessary for any reason:
Patch000: tcsh-6.20.00-000-add-all-flags-for-gethost-build.patch
Patch001: tcsh-6.20.00-001-delay-arginp-interpreting.patch
Patch002: tcsh-6.20.00-002-type-of-read-in-prompt-confirm.patch
Patch003: tcsh-6.20.00-003-fix-out-of-bounds-read.patch
Patch004: tcsh-6.20.00-004-do-not-use-old-pointer-tricks.patch
Patch005: tcsh-6.20.00-005-reset-fixes-numbering.patch
Patch006: tcsh-6.20.00-006-cleanup-in-readme-files.patch
Patch007: tcsh-6.20.00-007-look-for-tgetent-in-libtinfo.patch
Patch008: tcsh-6.20.00-008-guard-ascii-only-reversion.patch
Patch009: tcsh-6.20.00-009-fix-regexp-for-backlash-quoting-tests.patch
Patch010: tcsh-6.20.00-010-fix-memory-consumption-while-loading-corrupted-history.patch
Patch011: tcsh-6.20.00-011-fix-infinite-loop-after-ctrlC.patch
Patch012: tcsh-6.20.00-012-warrning-history-loading.patch
Patch013: tcsh-6.20.00-013-prevent-phup-and-record-from-multiple-execution.patch
Patch014: tcsh-6.20.00-014-call-stderror-consistently-and-avoid-inf-loops.patch
Patch015: tcsh-6.20.00-expose-HIST_PURGE.patch
Patch016: tcsh-6.20.00-dont-corrupt-history-using-modifiers.patch
Patch001: tcsh-6.22.03-expose-HIST_PURGE.patch
Patch002: tcsh-6.22.03-dont-corrupt-history-using-modifiers.patch
# Downstream patches -- these should be always included when doing rebase:
# ------------------
Patch100: tcsh-6.20.00-manpage-memoryuse.patch
# This reverts patch001: tcsh-6.20.00-001-delay-arginp-interpreting.patch
# bug 1845684
Patch101: tcsh-6.20.00-001-delay-arginp-interpreting-revert.patch
# Downstream patches for RHEL -- patches that we keep only in RHEL for various
# --------------------------- reasons, but are not enabled in Fedora:
@ -195,24 +180,74 @@ fi
# =============================================================================
%changelog
* Mon Oct 18 2021 Siteshwar Vashisht <svashisht@redhat.com> - 6.20.00-15
- Fix regression caused by bacported patch, command var is now set as before
Resolves: #1845684
* Mon Sep 06 2021 Jan Macku <jamacku@redhat.com> - 6.22.03-6
- Modifiers no longer breaks history - rhbz#1997986
* Wed Sep 08 2021 Jan Macku <jamacku@redhat.com> - 6.20.00-14
- Modifiers no longer breaks history - (#1997981)
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 6.22.03-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Mon Nov 16 2020 Jan Macku <jamacku@redhat.com> - 6.20.00-13
- fix regression caused by corrupted history (#1818766)
* Mon Jul 26 2021 Siteshwar Vashisht <svashisht@redhat.com> - 6.22.03-4
- Bump version number
* Fri Nov 01 2019 Jan Macku <jamacku@redhat.com> - 6.20.00-12
- rebuilt
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 6.22.03-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Fri Nov 01 2019 Jan Macku <jamacku@redhat.com> - 6.20.00-11
- rebuilt
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.22.03-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Oct 31 2019 Jan Macku <jamacku@redhat.com> - 6.20.00-10
- fix for rapid memory consumption caused by corrupted history (#1765649)
* Thu Nov 19 2020 Jan Macku <jamacku@redhat.com> - 6.22.03-1
- Update to tcsh-6.22.03
- Drop tcsh-6.22.02-avoid-gcc-to-fail.patch - applied by upstream
- Drop tcsh-6.22.02-call-seterror-consistently-and-abort-quickly.patch - applied by upstream
- Drop tcsh-6.22.02-avoid-crashing-when-loading-corrupted-history.patch - applied by upstream
* Wed Oct 14 2020 Jan Macku <jamacku@redhat.com> - 6.22.02-5
- Switch to stderror() when parsing history so that we stop processing immediately to avoid crashes
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 6.22.02-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Feb 07 2020 Jan Macku <jamacku@redhat.com> - 6.22.02-3
- Avoid gcc 10 to fail during build on "multiple definition of handle_interrupt"
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 6.22.02-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Dec 12 2019 Jan Macku <jamacku@redhat.com> - 6.22.02-1
- Update to tcsh-6.22.02
* Fri Nov 29 2019 Jan Macku <jamacku@redhat.com> - 6.22.00-1
- Update to tcsh-6.22.00
- Drop tcsh-6.21.00-000-failing-exit-command-causes-infinite-loop.patch - applied by upstream
* Fri Oct 25 2019 Jan Macku <jamacku@redhat.com> - 6.21.00-3
- Added upstream patch to fix infinite loop caused by exit command
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6.21.00-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu May 16 2019 Jan Macku <jamacku@redhat.com> - 6.21.00-01
- Update to tcsh-6.21.00
- Drop tcsh-6.20.00-000-add-all-flags-for-gethost-build.patch - applied by upstream
- Drop tcsh-6.20.00-001-delay-arginp-interpreting.Patches - applied by upstream
- Drop tcsh-6.20.00-002-type-of-read-in-prompt-confirm.patch - applied by upstream
- Drop tcsh-6.20.00-003-fix-out-of-bounds-read.patch - applied by upstream
- Drop tcsh-6.20.00-004-do-not-use-old-pointer-tricks.patch - applied by upstream
- Drop tcsh-6.20.00-005-reset-fixes-numbering.patch - applied by upstream
- Drop tcsh-6.20.00-006-cleanup-in-readme-files.patch - applied by upstream
- Drop tcsh-6.20.00-007-look-for-tgetent-in-libtinfo.patch - applied by upstream
- Drop tcsh-6.20.00-008-guard-ascii-only-reversion.patch - applied by upstream
- Drop tcsh-6.20.00-009-fix-regexp-for-backlash-quoting-tests.patch - applied by upstream
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6.20.00-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 6.20.00-11
- Rebuilt for libcrypt.so.2 (#1666033)
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.20.00-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.20.00-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild