Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards fixing regressions #441

Closed
tueda opened this issue Apr 11, 2023 · 5 comments
Closed

Towards fixing regressions #441

tueda opened this issue Apr 11, 2023 · 5 comments

Comments

@tueda
Copy link
Collaborator

tueda commented Apr 11, 2023

So, I made a script that tries to run git cherry-pick for all patches in a range of commits. Conflicted patches are skipped.

mkdir tmp
cd tmp
git clone https://github.com/vermaseren/form.git
cd form
git checkout v5.0.0-beta.1
wget https://gist.githubusercontent.com/tueda/62efdd8524e57c91cd8c770dfe98c9dd/raw/auto-cherry-pick.sh
chmod +x auto-cherry-pick.sh
./auto-cherry-pick.sh FORM-3-1..v5.0.0-beta.1

Then

git log --oneline v5.0.0-beta.1..

or

git log --oneline v5.0.0-beta.1.. sources  # only inside the source directory

gives candidates of regressions that can be fixed simply by git cherry-pick. Of course, some of them are false positives. And there are some undetected ones (because git cherry-pick conflicts).

Question: how to proceed?

git log --oneline v5.0.0-beta.1..
14866d8 fix: possible memory error in calling macros with arguments (#434)
a5beea4 docs: remove invalid licence comment in extcmd.c (#431)
3188fbd fix: moebius_ function (#422, #430)
8165e80 fixing a few typos in sources folder
658bb45 fixing another bunch of typos in sources/
7440741 Fix issue with implicitly or autodeclared dimension of autodeclared index
cf39bb0 Allow setting ContinuationLines to 0, meaning infinity
e5a9db9 Remove more gcc warnings (gcc version dependent)
ad7be37 Put in the fix and undid another
3a6b7ec Undoes some of the previous commit to test the failing checks.
e3f63b5 Repaired an inefficiency when many expressions are defined (TYPEEXPRESSION)
b021935 Repairs the 'famous' GZIP bug.
8917fae Repair of the infamous gzip memory leak.
ba2f606 Fixes #219
09b1f39 And repaired the problem with the check in the fix of #55
60af3fd Fixes #55   PrepPoly did not convert some arguments to fast notation.
56295bd Fix for issue #186
ed4e066 Repaired fix.frm
50be42c fixed up the previous fixes and some asserts in the ruby file
b7ba717 And yet another bug in TakeContent
91c8499 Fixed gcd_. Was problem with constant terms.
f479692 Repaired a sortbot problem with big terms
f5a216c Bucket fix and temporary collect %
7d8af84 Partially fix "make check"
415c646 Wrong variable was set to -1 on compiler error
6e8bd2f removed debug output
f6973bd small fix in polynomial multiplication
7fd8d58 Changed the PUTNUMBER macro's to avoid warnings on 32-bits systems.
1915da7 fixed small memory leak in poly_to_argument
39b2ebd bugfix: if already factorized, don't factorize again
8661eeb ParFORM: fixed a bug of #write
dbecf7f ParFORM: blocked statistics report from slaves
c8776ed Little bugfix in %X option in #write. Counting problem.
8174a5a Added tests for examples in the user manual (up to chapter 6 right now).
3189f17 Fixed a bug when testing TFORM. In the multithreaded case the PID was not handled correctly.
bb0fe0f Added timeout option. Fixed piped IO to executable (stderr was lost).
c2d530f Improved ruby code for testing and added two more test cases.
d013702 Initial commit of automatic test suite.
c078d4c Add autoconf file.
29fe836 Removed misspelled file.
ea97300 Added autoconf files.
e5c2c32 Moved to doxyfile directory.
3f52204 Added doxygen configuration.
git log --oneline v5.0.0-beta.1.. sources
14866d8 fix: possible memory error in calling macros with arguments (#434)
a5beea4 docs: remove invalid licence comment in extcmd.c (#431)
3188fbd fix: moebius_ function (#422, #430)
8165e80 fixing a few typos in sources folder
658bb45 fixing another bunch of typos in sources/
7440741 Fix issue with implicitly or autodeclared dimension of autodeclared index
cf39bb0 Allow setting ContinuationLines to 0, meaning infinity
e5a9db9 Remove more gcc warnings (gcc version dependent)
ad7be37 Put in the fix and undid another
3a6b7ec Undoes some of the previous commit to test the failing checks.
e3f63b5 Repaired an inefficiency when many expressions are defined (TYPEEXPRESSION)
b021935 Repairs the 'famous' GZIP bug.
8917fae Repair of the infamous gzip memory leak.
ba2f606 Fixes #219
09b1f39 And repaired the problem with the check in the fix of #55
60af3fd Fixes #55   PrepPoly did not convert some arguments to fast notation.
56295bd Fix for issue #186
b7ba717 And yet another bug in TakeContent
91c8499 Fixed gcd_. Was problem with constant terms.
f479692 Repaired a sortbot problem with big terms
f5a216c Bucket fix and temporary collect %
415c646 Wrong variable was set to -1 on compiler error
6e8bd2f removed debug output
f6973bd small fix in polynomial multiplication
7fd8d58 Changed the PUTNUMBER macro's to avoid warnings on 32-bits systems.
1915da7 fixed small memory leak in poly_to_argument
39b2ebd bugfix: if already factorized, don't factorize again
8661eeb ParFORM: fixed a bug of #write
dbecf7f ParFORM: blocked statistics report from slaves
c8776ed Little bugfix in %X option in #write. Counting problem.
@vermaseren
Copy link
Owner

vermaseren commented Apr 11, 2023 via email

@tueda
Copy link
Collaborator Author

tueda commented Apr 19, 2023

./check/check.rb --stat valgrind sources/vorm gives the following failures:

Diagrams_1                   (examples.frm:1827)  FAILED  |                | 00:00:00.907
Diagrams_2                   (examples.frm:1843)  FAILED  |                | 00:00:00.912
Diagrams_3                   (examples.frm:1873)  FAILED  |                | 00:00:00.928
Diagrams_4                   (examples.frm:1901)  FAILED  |                | 00:00:01.970
moebius_3                    (features.frm:162)   FAILED  |                | 00:00:00.963
Format_noreset_linelen       (features.frm:458)   FAILED  |                | 00:00:00.934
Issue392_ContinuationLines_0 (features.frm:1046)  FAILED  |                | 00:00:00.955
Issue7_1                     (fixes.frm:119)      TIMEOUT |################|>00:05:00.000
Issue7_2                     (fixes.frm:135)      FAILED  |                | 00:00:01.127
Issue7_3                     (fixes.frm:152)      TIMEOUT |################|>00:05:00.000
Issue324                     (fixes.frm:2115)     FAILED  |                | 00:00:00.909
Issue325                     (fixes.frm:2124)     FAILED  |                | 00:00:00.930
Issue405                     (fixes.frm:2278)     FAILED  |                | 00:00:00.911
Issue434                     (fixes.frm:2288)     FAILED  |                | 00:00:00.915

Cherry-picking the following commits

commit subject fixes note
2b2592c Allow setting ContinuationLines to 0, meaning infinity (#392) Issue392_ContinuationLines_0
dd1a71c Do not reset line length when calling Format with arguments Format_noreset_linelen conflict
982111a Fix issue with implicitly or autodeclared dimension of autodeclared index (#324, #325, #405) Issue324, Issue325, Issue405
bfc7e33 fix some typos in sources conflict
fb26f35 fixing another bunch of typos in sources/
9d7eeb9 fixing a few typos in sources folder conflict
28e15ea fix: moebius_ function (#422, #430) moebius_3
e7c52d3 docs: remove invalid licence comment in extcmd.c (#431)
741861a fix: possible memory error in calling macros with arguments (#434) Issue434

fixes many of them.

Patches (for "git am")
From 12bf1032d14375289124c9ed2eeb5c9c709972ea Mon Sep 17 00:00:00 2001
From: Vitaly Magerya <[email protected]>
Date: Thu, 2 Sep 2021 14:50:22 +0200
Subject: [PATCH 1/9] [repatch] Allow setting ContinuationLines to 0, meaning
 infinity

Repatched 2b2592c (#441)
---
 sources/setfile.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sources/setfile.c b/sources/setfile.c
index d6863c6..20bf85b 100644
--- a/sources/setfile.c
+++ b/sources/setfile.c
@@ -671,7 +671,6 @@ int AllocSetups(VOID)
 
 	sp = GetSetupPar((UBYTE *)"continuationlines");
 	AM.FortranCont = sp->value;
-	if ( AM.FortranCont <= 0 ) AM.FortranCont = 1;
 	sp = GetSetupPar((UBYTE *)"oldorder");
 	AM.OldOrderFlag = sp->value;
 	sp = GetSetupPar((UBYTE *)"resettimeonclear");
-- 
2.34.1


From 6ac3053e233df4faebb8dcd6d50b45ceb3e192de Mon Sep 17 00:00:00 2001
From: Ben Ruijl <[email protected]>
Date: Wed, 11 May 2022 17:24:30 +0200
Subject: [PATCH 2/9] [repatch] Do not reset line length when calling Format
 with arguments

Repatched dd1a71ce1 (#441)
---
 sources/compcomm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sources/compcomm.c b/sources/compcomm.c
index 665b930..7bf1afc 100644
--- a/sources/compcomm.c
+++ b/sources/compcomm.c
@@ -407,7 +407,6 @@ WrongOption:		MesPrint("&Illegal option in Format FloatPrecision: %s",s);
 		else {
 Unknown:	MesPrint("&Unknown option: %s",s); error = 1;
 		}
-		AC.LineLength = 72;
 	}
 	return(error);
 }
-- 
2.34.1


From 5a6f5266b86f3832cf06724e66929bcc4d70012c Mon Sep 17 00:00:00 2001
From: Ben Ruijl <[email protected]>
Date: Thu, 7 Jul 2022 16:19:32 +0200
Subject: [PATCH 3/9] [repatch] Fix issue with implicitly/auto-declared
 dimension of index

Resolves #324, resolves #325, resolves #405

Repatched 982111a (#441)
---
 sources/names.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sources/names.c b/sources/names.c
index c23f8fc..fd01e89 100644
--- a/sources/names.c
+++ b/sources/names.c
@@ -1163,6 +1163,7 @@ UBYTE *DoDimension(UBYTE *s, int *dim, int *dim4)
 	int type, error = 0;
 	WORD numsymbol;
 	NAMETREE **oldtree = AC.activenames;
+	LIST* oldsymbols = AC.Symbols;
 	*dim4 = -NMIN4SHIFT;
 	if ( FG.cTable[*s] == 1 ) {
 retry:
@@ -1176,6 +1177,7 @@ retry:
 	else if ( ( (FG.cTable[*s] == 0 ) || ( *s == '[' ) )
 		&& ( s = SkipAName(s) ) != 0 ) {
 		AC.activenames = &(AC.varnames);
+		AC.Symbols = &(AC.SymbolList);
 		c = *s; *s = 0;
 		if ( ( ( type = GetName(AC.exprnames,t,&numsymbol,NOAUTO) ) != NAMENOTFOUND )
 		|| ( ( type = GetName(AC.varnames,t,&numsymbol,WITHAUTO) ) != NAMENOTFOUND ) ) {
@@ -1183,7 +1185,7 @@ retry:
 		}
 		else {
 			numsymbol = AddSymbol(t,-MAXPOWER,MAXPOWER,0,0);
-			if ( *oldtree != AC.autonames && AC.WarnFlag )
+			if ( AC.WarnFlag )
 			MesPrint("&Warning: Implicit declaration of %s as a symbol",t);
 		}
 		*dim = -numsymbol;
@@ -1197,7 +1199,7 @@ retry:
 			}
 			else {
 				numsymbol = AddSymbol(t,-MAXPOWER,MAXPOWER,0,0);
-				if ( *oldtree != AC.autonames && AC.WarnFlag )
+				if ( AC.WarnFlag )
 				MesPrint("&Warning: Implicit declaration of %s as a symbol",t);
 			}
 			*dim4 = -numsymbol-NMIN4SHIFT;
@@ -1210,6 +1212,7 @@ retry:
 illeg:	MesPrint("&Illegal dimension specification. Should be number >= 0, symbol or symbol:symbol");
 		return(0);
 	}
+	AC.Symbols = oldsymbols;
 	AC.activenames = oldtree;
 	if ( error ) return(0);
 	return(s);
-- 
2.34.1


From a488ee45c2a047035963879c9c111b39463ab6b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= <[email protected]>
Date: Fri, 2 Dec 2022 21:53:49 +0100
Subject: [PATCH 4/9] [repatch] fix some typos in sources

Repatched bfc7e33 (#441)
---
 sources/compcomm.c  | 2 +-
 sources/dollar.c    | 2 +-
 sources/factor.c    | 2 +-
 sources/gentopo.cc  | 2 +-
 sources/parallel.c  | 4 ++--
 sources/proces.c    | 4 ++--
 sources/ratio.c     | 2 +-
 sources/reshuf.c    | 2 +-
 sources/sch.c       | 2 +-
 sources/sort.c      | 8 ++++----
 sources/store.c     | 2 +-
 sources/structs.h   | 2 +-
 sources/symmetr.c   | 2 +-
 sources/tables.c    | 2 +-
 sources/transform.c | 4 ++--
 sources/variable.h  | 2 +-
 sources/vector.h    | 4 ++--
 17 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/sources/compcomm.c b/sources/compcomm.c
index 7bf1afc..ad30c94 100644
--- a/sources/compcomm.c
+++ b/sources/compcomm.c
@@ -7093,7 +7093,7 @@ int DoPutInside(UBYTE *inp, int par)
   	#[ CoSwitch :
 
 	Syntax: Switch $var;
-	Be carefull with illegal nestings with repeat, if, while.
+	Be careful with illegal nestings with repeat, if, while.
 */
 
 int CoSwitch(UBYTE *s)
diff --git a/sources/dollar.c b/sources/dollar.c
index f79e719..585e072 100644
--- a/sources/dollar.c
+++ b/sources/dollar.c
@@ -2626,7 +2626,7 @@ int DollarRaiseLow(UBYTE *name, LONG value)
 /**
  *	Evaluates one argument of a do loop. Such an argument is constructed
  *	from SNUMBERs DOLLAREXPRESSIONs and possibly DOLLAREXPR2s which indicate
- *	factors of the preceeding dollar. Hence we have
+ *	factors of the preceding dollar. Hence we have
  *	SNUMBER,num
  *	DOLLAREXPRESSION,numdollar
  *	DOLLAREXPRESSION,numdollar,DOLLAREXPR2,numfactor
diff --git a/sources/factor.c b/sources/factor.c
index 578a835..99499c4 100644
--- a/sources/factor.c
+++ b/sources/factor.c
@@ -557,7 +557,7 @@ int FactorInExpr(PHEAD WORD *term, WORD level)
 	Load the first term in the workspace
 */
 	if ( GetTerm(BHEAD oldwork) == 0 ) {
-		SetScratch(file,&oldposition); /* We still need this untill Processor is clean */
+		SetScratch(file,&oldposition); /* We still need this until Processor is clean */
 		AR.DeferFlag = olddeferflag;
 		oldwork[0] = 4; oldwork[1] = 1; oldwork[2] = 1; oldwork[3] = 3; 
 		goto Complete;
diff --git a/sources/gentopo.cc b/sources/gentopo.cc
index 78f459d..0d68ec4 100644
--- a/sources/gentopo.cc
+++ b/sources/gentopo.cc
@@ -364,7 +364,7 @@ void T_MNodeClass::mkNdCl(void)
 int T_MNodeClass::clCmp(int nd0, int nd1, int cn)
 {
 
-    // Wether two nodes are in a same class or not.
+    // Whether two nodes are in a same class or not.
     int cmp = ndcl[nd0] - ndcl[nd1];
     if (cmp != 0) {
       return cmp;
diff --git a/sources/parallel.c b/sources/parallel.c
index 85f11cf..012ea2d 100644
--- a/sources/parallel.c
+++ b/sources/parallel.c
@@ -847,7 +847,7 @@ cancelled:
  * outputfile.
  *
  * @return   1  if the sorting on the master was done.
- *           0  if EndSort() still must perform a regular sorting becuase it is not
+ *           0  if EndSort() still must perform a regular sorting because it is not
  *              at the ground level or not on the master or in the sequential mode
  *              or in the InParallel mode.
  *          -1  if an error occured.
@@ -1974,7 +1974,7 @@ int PF_Init(int *argc, char ***argv)
 	if ( PF.me == MASTER ) {
 		char *c;
 /*
-			get these from the environment at the moment sould be in setfile/tail
+			get these from the environment at the moment should be in setfile/tail
 */
 		if ( ( c = getenv("PF_LOG") ) != 0 ) {
 			if ( *c ) PF.log = (int)atoi(c);
diff --git a/sources/proces.c b/sources/proces.c
index cce5c8b..b33abd6 100644
--- a/sources/proces.c
+++ b/sources/proces.c
@@ -2047,7 +2047,7 @@ showtable:							AO.OutFill = AO.OutputLine = (UBYTE *)m;
 					}
 /*
 					If there are more arguments we have to do some
-					pattern matching. This should be easy. We addapted the
+					pattern matching. This should be easy. We adapted the
 					pattern, so that the array indices match already.
 					Note that if there is no match the program will become
 					very slow.
@@ -4563,7 +4563,7 @@ OverWork:
  *		If there are more powers needed there will be a recursion.
  *
  *		No attempt is made to use binomials because we have no
- *		information about commutating properties.
+ *		information about commuting properties.
  *
  *		There is a searching for the contents of brackets if needed.
  *		This searching may be rather slow because of the single links.
diff --git a/sources/ratio.c b/sources/ratio.c
index 500847b..c6c8ee7 100644
--- a/sources/ratio.c
+++ b/sources/ratio.c
@@ -139,7 +139,7 @@ We have to revise the code for the second case.
  		#] RatioFind : 
  		#[ RatioGen :
 
-		The algoritm:
+		The algorithm:
 		x1^-n1*x2^n2	==>  x2 --> x1 + x3
 		x1^n1*x2^-n2	==>  x1 --> x2 - x3
 		x1^-n1*x2^-n2	==>
diff --git a/sources/reshuf.c b/sources/reshuf.c
index b8f683f..e451536 100644
--- a/sources/reshuf.c
+++ b/sources/reshuf.c
@@ -1175,7 +1175,7 @@ WORD DoDistrib(PHEAD WORD *term, WORD level)
 		0:	Make all possible divisions:  2^nargs
 		1:	fun1 should get n arguments:  nargs! / ( n! (nargs-n)! )
 		2:	fun2 should get n arguments:  nargs! / ( n! (nargs-n)! )
-	The distiction between 1 and two is for noncommuting objects.
+	The distinction between 1 and two is for noncommuting objects.
 		3:  fun1 should get n arguments. Super symmetric option.
 		4:	fun2 idem
 	The super symmetric option involves:
diff --git a/sources/sch.c b/sources/sch.c
index 695fed1..911f661 100644
--- a/sources/sch.c
+++ b/sources/sch.c
@@ -1276,7 +1276,7 @@ VOID WriteLists(VOID)
 			MesPrint("\nCurrently dictionary %s is active\n",
 				AO.Dictionaries[olddict-1]->name);
 		else
-			MesPrint("\nCurrently there is no actice dictionary\n");
+			MesPrint("\nCurrently there is no active dictionary\n");
 	}
 	if ( AC.CodesFlag ) {
 		if ( C->numlhs > 0 ) {
diff --git a/sources/sort.c b/sources/sort.c
index 747a837..0625147 100644
--- a/sources/sort.c
+++ b/sources/sort.c
@@ -1968,7 +1968,7 @@ WORD FlushOut(POSITION *position, FILEHANDLE *fi, int compr)
  *		Adds the coefficients of the terms *ps1 and *ps2.
  *		The problem comes when there is not enough space for a new
  *		longer coefficient. First a local solution is tried.
- *		If this is not succesfull we need to move terms around.
+ *		If this is not successful we need to move terms around.
  *		The possibility of a garbage collection should not be
  *		ignored, as avoiding this costs very much extra space which
  *		is nearly wasted otherwise.
@@ -2102,8 +2102,8 @@ RegEnd:
  *		At first we allow only univariate polynomials in the PolyFun.
  *		This restriction will be lifted a.s.a.p.
  *
- *		@param ps1 A pointer to the postion of the first term
- *		@param ps2 A pointer to the postion of the second term
+ *		@param ps1 A pointer to the position of the first term
+ *		@param ps2 A pointer to the position of the second term
  *		@return If zero the terms cancel. Otherwise the new term is in *ps1.
  */
 
@@ -2932,7 +2932,7 @@ NoPoly:
 				There is a little problem here with fast arguments
 				We don't want to sacrifice speed, but we like to
 				keep a rational ordering. This last one suffers in
-				the solution that has been choosen here.
+				the solution that has been chosen here.
 */
 				if ( AC.properorderflag ) {
 					WORD oldpolyflag;
diff --git a/sources/store.c b/sources/store.c
index 649b7a1..549bfaa 100644
--- a/sources/store.c
+++ b/sources/store.c
@@ -2843,7 +2843,7 @@ RENUMBER GetTable(WORD expr, POSITION *position, WORD mode)
 
 	oldw = AT.WorkPointer + 1 + SUBEXPSIZE;
 /*
-	The protoype is loaded in the WorkSpace by the Index routine.
+	The prototype is loaded in the WorkSpace by the Index routine.
 	After all it has to find an occurrence with the proper arguments.
 	This sets the WorkPointer. Hence be careful now.
 */
diff --git a/sources/structs.h b/sources/structs.h
index 8cdf20a..e1085d1 100644
--- a/sources/structs.h
+++ b/sources/structs.h
@@ -1480,7 +1480,7 @@ struct M_const {
 #endif
     int     FileOnlyFlag;          /* (M) Writing only to file */
     int     Interact;              /* (M) Interactive mode flag */
-    int     MaxParLevel;           /* (M) Maximum nesting of parantheses */
+    int     MaxParLevel;           /* (M) Maximum nesting of parentheses */
     int     OutBufSize;            /* (M) size of OutBuffer */
     int     SMaxFpatches;          /* (M) */
     int     SMaxPatches;           /* (M) */
diff --git a/sources/symmetr.c b/sources/symmetr.c
index 022072f..e0a12da 100644
--- a/sources/symmetr.c
+++ b/sources/symmetr.c
@@ -317,7 +317,7 @@ NextWV:
 	(somewhat slow) permutation routine that has as its worst
 	cases some rather unlikely configurations, rather than some
 	common ones (as would have been the case with the conventional
-	permuation routine).
+	permutation routine).
 		assume:
 		vvvvvvvvvvvviiiiiii		(tvfix in tfixvec and tifix in tfixind)
 		VVVVVVVVVIIIIIIIIII		(vwc in wcvec and iwc in wcind)
diff --git a/sources/tables.c b/sources/tables.c
index 02403e1..ab68c97 100644
--- a/sources/tables.c
+++ b/sources/tables.c
@@ -2007,7 +2007,7 @@ WORD Apply(WORD *term, WORD level)
 	rhs of table(indices,pattern). It does this up to maxtogo times
 	in the given term. It starts with the occurrences inside the
 	arguments of functions. If necessary it finishes at groundlevel.
-	An infite number of tries is indicates by maxtogo = 2^15-1 or 2^31-1.
+	An infinite number of tries is indicated by maxtogo = 2^15-1 or 2^31-1.
 	The occurrences are replaced by subexpressions. This allows TestSub
 	to finish the job properly.
 
diff --git a/sources/transform.c b/sources/transform.c
index 4a0a789..9568ec6 100644
--- a/sources/transform.c
+++ b/sources/transform.c
@@ -2906,7 +2906,7 @@ WORD RunMulArg(PHEAD WORD *fun, WORD *args)
  		#[ RunIsLyndon :
 
 		Determines whether the range constitutes a Lyndon word.
-		The two cases of ordering are distinguised by the order of
+		The two cases of ordering are distinguished by the order of
 		the numbers of the arguments in the range.
 */
 
@@ -2984,7 +2984,7 @@ nexti1:;
 		Determines whether the range constitutes a Lyndon word.
 		If not, we rotate it to a Lyndon word. If this is not possible
 		we return the noLyndon condition.
-		The two cases of ordering are distinguised by the order of
+		The two cases of ordering are distinguished by the order of
 		the numbers of the arguments in the range.
 */
 
diff --git a/sources/variable.h b/sources/variable.h
index 688f805..f64741f 100644
--- a/sources/variable.h
+++ b/sources/variable.h
@@ -7,7 +7,7 @@
  *  Contains a number of defines to make the coding easier.
  *	Especially the defines for the use of the lists are very nice.
  *	And of course the AC for A.Cc and AT for either A.T of B->T
- *	are indispensible to keep FORM and TFORM in one set of sources.
+ *	are indispensable to keep FORM and TFORM in one set of sources.
  */
 
 /* #[ License : */
diff --git a/sources/vector.h b/sources/vector.h
index 7020933..9defdd2 100644
--- a/sources/vector.h
+++ b/sources/vector.h
@@ -189,7 +189,7 @@
  * Returns the size of the vector X.
  *
  * @param  X  the vector object.
- * @return    the size of the vetor.
+ * @return    the size of the vector.
  */
 #define VectorSize(X) \
 	((X).size)
@@ -203,7 +203,7 @@
  * Returns the capacity (the number of the already allocated elements) of the vector X.
  *
  * @param  X  the vector object.
- * @return    the capacity of the vetor.
+ * @return    the capacity of the vector.
  */
 #define VectorCapacity(X) \
 	((X).capacity)
-- 
2.34.1


From 8d58643e0c4d952204918c4518f47858870e75f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= <[email protected]>
Date: Sat, 3 Dec 2022 20:35:27 +0100
Subject: [PATCH 5/9] [repatch] fixing another bunch of typos in sources/

Repatched fb26f35 (#441)
---
 sources/argument.c      |  2 +-
 sources/checkpoint.c    |  4 ++--
 sources/extcmd.c        |  8 ++++----
 sources/gentopo.cc      |  2 +-
 sources/mallocprotect.h |  2 +-
 sources/minos.c         |  2 +-
 sources/opera.c         |  2 +-
 sources/optimize.cc     |  4 ++--
 sources/parallel.c      | 12 ++++++------
 sources/poly.cc         |  2 +-
 sources/polyfact.cc     |  2 +-
 sources/polygcd.cc      |  4 ++--
 sources/pre.c           |  2 +-
 sources/proces.c        |  2 +-
 sources/reken.c         |  2 +-
 sources/sort.c          |  2 +-
 sources/startup.c       |  2 +-
 sources/store.c         |  4 ++--
 sources/structs.h       |  2 +-
 sources/symmetr.c       |  2 +-
 sources/threads.c       |  6 +++---
 sources/tools.c         |  2 +-
 22 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/sources/argument.c b/sources/argument.c
index 2d7eb49..beb425f 100644
--- a/sources/argument.c
+++ b/sources/argument.c
@@ -530,7 +530,7 @@ ScaledVariety:;
 					}
 /*
                   	We generate a statement for adapting all terms in the
-					argument sucessively
+					argument successively
 */
 					r4 = AddRHS(AT.ebufnum,1);
 					while ( (r4+j+12) > CC->Top ) r4 = DoubleCbuffer(AT.ebufnum,r4,3);
diff --git a/sources/checkpoint.c b/sources/checkpoint.c
index 77be02b..9bf64e6 100644
--- a/sources/checkpoint.c
+++ b/sources/checkpoint.c
@@ -2343,9 +2343,9 @@ int DoRecovery(int *moduletype)
 	R_SET(AR.SortType, WORD);
 	R_SET(AR.ShortSortCount, WORD);
 
-	/* this is usually done in Process(), but sometimes FORM doesn't
+	/* this is usually done in Process(), but sometimes FORM does not
 	   end up executing Process() before it uses the AR.CompressPointer,
-	   so we need to explicitely set it here. */
+	   so we need to explicitly set it here. */
 	AR.CompressPointer = AR.CompressBuffer;
 
 #ifdef WITHPTHREADS
diff --git a/sources/extcmd.c b/sources/extcmd.c
index 9c808c6..20652fe 100644
--- a/sources/extcmd.c
+++ b/sources/extcmd.c
@@ -536,7 +536,7 @@ static VOID pushDescriptor(int *fifo, int top, int fd)
 	}
 }/*pushDescriptor*/
 
-/*Close all descriptors greate or equal than startFrom except those
+/*Close all descriptors greater or equal than startFrom except those
   listed in the ascendantly ordered array usedFd of length top:*/
 static FORM_INLINE VOID closeAllDescriptors(int startFrom, int *usedFd, int top)
 {
@@ -562,7 +562,7 @@ static VOID closepipe(L_APIPE *thepipe)
 }/*closepipe*/
 
 /*Parses the cmd line like "sh -c myprg", passes each option to the
-  correspondinig element of argv, ends agrv by NULL. Returns the 
+  corresponding element of argv, ends agrv by NULL. Returns the 
   number of stored argv elements, or -1 if fails:*/
 static FORM_INLINE int parseline(char **argv, char *cmd)
 {
@@ -1211,7 +1211,7 @@ typedef struct{
 }ECINFOSTRUCT;
 
 /* Creates a new external channel starting the command cmd (if cmd !=NULL)
-	or using informaion from (ECINFOSTRUCT *)shellname, if cmd ==NULL:*/
+	or using information from (ECINFOSTRUCT *)shellname, if cmd ==NULL:*/
 static FORM_INLINE void *createExternalChannel(
 					  EXTHANDLE *h,
 					  char *cmd, /*Command to run or NULL*/
@@ -1398,7 +1398,7 @@ int initPresetExternalChannels(UBYTE *theline, int thetimeout)
 		theline = (UBYTE *)c + 1;
 		/*Now we have two descriptors.
 		  According to the protocol, FORM must send to external channel 
-		  it's PID with added '\n' and read back two comma-separaetd
+		  it's PID with added '\n' and read back two comma-separated
 		  decimals with added '\n'. The first must be repeated FORM PID,
 		  the second must be the parent PID
 		*/
diff --git a/sources/gentopo.cc b/sources/gentopo.cc
index 0d68ec4..29d742c 100644
--- a/sources/gentopo.cc
+++ b/sources/gentopo.cc
@@ -91,7 +91,7 @@ T_EGraph::T_EGraph(int nnodes, int nedges, int mxdeg)
 
     nNodes  = nnodes;
     nEdges  = nedges;
-    maxdeg  = mxdeg;    // maxmum value of degree of nodes
+    maxdeg  = mxdeg;    // maximum value of degree of nodes
     nExtern = 0;
 
     nodes = new T_ENode[nNodes];
diff --git a/sources/mallocprotect.h b/sources/mallocprotect.h
index b9a5d46..5849ec2 100644
--- a/sources/mallocprotect.h
+++ b/sources/mallocprotect.h
@@ -355,7 +355,7 @@ static void *mprotectMalloc(size_t theSize)
 #if MALLOCPROTECT > 0
 
 	/*Potential problems with alignment if the requested size is not 
-	a multiple of items. But no poblems on x86-64:*/
+	a multiple of items. But no problems on x86-64:*/
 	return ret+ (theSize-pageSize-requestedSize);
 #endif
 }/*mprotectMalloc*/
diff --git a/sources/minos.c b/sources/minos.c
index 112629f..536d45a 100644
--- a/sources/minos.c
+++ b/sources/minos.c
@@ -1428,7 +1428,7 @@ int ExistsObject(DBASE *d,MLONG tablenumber,char *arguments)
   	#] ExistsObject : 
   	#[ DeleteObject :
 
-	Returns 1 if Object has been deleteted.
+	Returns 1 if Object has been deleted.
 	We leave a hole. Actually the object is still there but has been
 	inactivated. It can be reactivated by calling this routine again.
 */
diff --git a/sources/opera.c b/sources/opera.c
index 2a860f0..1d4e84d 100644
--- a/sources/opera.c
+++ b/sources/opera.c
@@ -1438,7 +1438,7 @@ WORD TraceN(PHEAD WORD *term, WORD *params, WORD num, WORD level)
 
 		This routine is a simplified version of Trace4Gen. We know here
 		only three cases: Adjacent objects, same objects and all different.
-		The othere difference lies of course in the struct which is now
+		The other difference lies of course in the struct which is now
 		not of type TRACES, but of type TRACES.
 
 */
diff --git a/sources/optimize.cc b/sources/optimize.cc
index 4ad82d4..7054e75 100644
--- a/sources/optimize.cc
+++ b/sources/optimize.cc
@@ -2974,7 +2974,7 @@ bool do_optimization (const optimization optim, vector<WORD> &instr, int newid)
 		instr.push_back(varnumx);  // symbol id
 		instr.push_back(n); 	   // power
 		instr.push_back(1);
-		instr.push_back(1); 	   // coeffient 1
+		instr.push_back(1); 	   // coefficient 1
 		instr.push_back(3);
 		instr.push_back(0); 	   // trailing 0
 	}
@@ -3291,7 +3291,7 @@ bool do_optimization (const optimization optim, vector<WORD> &instr, int newid)
 			// check signs (type=4: x+y and -x-y, type=5: x-y and -x+y) ??????
 			// check signs (type=4: x+y, type=5: x-y) !!!!!!!!!!
 			if (SGN(ncoeffx) * SGN(ncoeffy) * (optim.type==4 ? 1 : -1) == 1) {
-				// check absolute value of coeeficients
+				// check absolute value of coefficients
 				if (BigLong((UWORD *)coeffx, ABS(ncoeffx)-1, (UWORD *)coeffy, ABS(ncoeffy)-1) == 0) {
 					// substitute
 					vector<WORD> coeff(coeffx, coeffx+ABS(ncoeffx));
diff --git a/sources/parallel.c b/sources/parallel.c
index 012ea2d..bb12d58 100644
--- a/sources/parallel.c
+++ b/sources/parallel.c
@@ -850,7 +850,7 @@ cancelled:
  *           0  if EndSort() still must perform a regular sorting because it is not
  *              at the ground level or not on the master or in the sequential mode
  *              or in the InParallel mode.
- *          -1  if an error occured.
+ *          -1  if an error occurred.
  *
  * @remark  The slaves will send the sorted terms back to the master in the regular
  *          sorting (after the initialization of the send buffer in PF_EndSort()).
@@ -993,7 +993,7 @@ static  WORD *PF_CurrentBracket;
  *
  * To enable keep-brackets when AR.DeferFlag is set, we need to do some
  * preparation here:
- *   \li  copy the part ouside brackets to current_bracket
+ *   \li  copy the part outside brackets to current_bracket
  *   \li  skip term if part outside brackets is same as for last term
  *   \li  if POfill >= POfull receive new terms as usual
  *
@@ -1514,7 +1514,7 @@ static int PF_WaitAllSlaves(void)
 
 	if ( has_sent ) M_free(has_sent,"PF_WaitAllSlaves");
 /*
-		0 on sucess (exit from the main loop by loop condition), or -1 if fails
+		0 on success (exit from the main loop by loop condition), or -1 if fails
 		(exit from the main loop since readySlaves=PF.numtasks+1):
 */
 	return(PF.numtasks-readySlaves);
@@ -1691,7 +1691,7 @@ int PF_Processor(EXPRESSIONS e, WORD i, WORD LastExpression)
 				PACK_LONG(sb->fill[0], AN.ninterms);
 				/*
 				 * For the "slow startup". We double maxinterms up to ProcessBucketSize
-				 * after (houpefully) the all workers got some terms.
+				 * after (hopefully) the all workers got some terms.
 				 */
 				if ( cmaxinterms >= PF.numtasks - 2 ) {
 					maxinterms *= 2;
@@ -1953,7 +1953,7 @@ int PF_Processor(EXPRESSIONS e, WORD i, WORD LastExpression)
 int PF_Init(int *argc, char ***argv)
 {
 /*
-		this should definitly be somewhere else ...
+		this should definitely be somewhere else ...
 */
 	PF_CurrentBracket = 0;
 
@@ -2216,7 +2216,7 @@ int PF_BroadcastPreDollar(WORD **dbuffer, LONG *newsize, int *numterms)
 /*
 			The problem is that sometimes dollar variables are longer
 			than PF_packbuf! So we split long expression into chunks.
-			There are n filled chunks and one portially filled chunk:
+			There are n filled chunks and one partially filled chunk:
 */
 		LONG n = ((*newsize)+1)/PF_maxDollarChunkSize;
 /*
diff --git a/sources/poly.cc b/sources/poly.cc
index 0d5e594..1553ca4 100644
--- a/sources/poly.cc
+++ b/sources/poly.cc
@@ -1990,7 +1990,7 @@ int poly::number_of_terms () const {
   	#[ first_variable :
 */
 
-// returns the lexcicographically first variable of a polynomial
+// returns the lexicographically first variable of a polynomial
 int poly::first_variable () const {
 	
 	POLY_GETIDENTITY(*this);
diff --git a/sources/polyfact.cc b/sources/polyfact.cc
index 7d040ba..d1319db 100644
--- a/sources/polyfact.cc
+++ b/sources/polyfact.cc
@@ -176,7 +176,7 @@ const vector<poly> polyfact::extended_gcd_Euclidean_lifted (const poly &a, const
 	sa /= s.integer_lcoeff();
 	sb /= s.integer_lcoeff();
 
-	// Lift the result to modolu p^n with p-adic Newton's iteration.
+	// Lift the result to modulo p^n with p-adic Newton's iteration.
 	poly samodp(sa);
 	poly sbmodp(sb);
 	poly term(BHEAD 1);
diff --git a/sources/polygcd.cc b/sources/polygcd.cc
index eb5ea2d..d2ca3c6 100644
--- a/sources/polygcd.cc
+++ b/sources/polygcd.cc
@@ -83,7 +83,7 @@ template<class T> ostream& operator<< (ostream &out, const vector<T> &x) {
  *   Notes
  *   =====
  *   - The input and output integers are represented as polynomials.
- *     These polynonials must consist of one term with all powers
+ *     These polynomials must consist of one term with all powers
  *     equal to zero.
  *   - The result is always positive.
  *   - Over ZZ/p^n, the gcd is defined as 1.
@@ -666,7 +666,7 @@ const poly polygcd::sparse_interpolation_fix_poly (const poly &a, int x) {
  *     e.g. "Computing the Greatest Common Divisor of Multivariate
  *     Polynomials over Finite Fields" by Suling Yang. [TODO]
  *   - For calculation modulo small prime numbers, such a Vandermonde
- *     matrix doesnot exist, because there are not enough different
+ *     matrix does not exist, because there are not enough different
  *     numbers. In that case, we should resort to random equations of
  *     which enough exist. [TODO]
  *   - Non-monic cases are handled inefficiently. Implement LINZIP? [TODO]
diff --git a/sources/pre.c b/sources/pre.c
index 7c5b428..0aeb894 100644
--- a/sources/pre.c
+++ b/sources/pre.c
@@ -5735,7 +5735,7 @@ int DoRmExternal(UBYTE *s)
 					stored.
 
 					FORM continues to read the running external
-					program output until the extrenal program outputs a
+					program output until the external program outputs a
 					prompt.
 
 */
diff --git a/sources/proces.c b/sources/proces.c
index b33abd6..127f94d 100644
--- a/sources/proces.c
+++ b/sources/proces.c
@@ -758,7 +758,7 @@ ReStart:
 					else if ( t[2] >= 0 ) {
 /*
 						Compute Binom(numterms+power-1,power-1)
-						We need potentially long arrithmetic.
+						We need potentially long arithmetic.
 						That is why we had to allocate AN.BinoScrat
 */
 						if ( AN.last1 == t[3] && AN.last2 == cbuf[t[4]].NumTerms[t[2]] + t[3] - 1 ) {
diff --git a/sources/reken.c b/sources/reken.c
index 21905e6..79bde51 100644
--- a/sources/reken.c
+++ b/sources/reken.c
@@ -2233,7 +2233,7 @@ GcdErr:
 	digit Lehmer-Euclid algorithm of Jebelean it seems.
 
 	Maybe this can be programmed slightly better and we can get another
-	few percent speed increase. Further improvements for the assymptotic
+	few percent speed increase. Further improvements for the asymptotic
 	case come from splitting the calculation as in Karatsuba and working
 	with FFT divisions and multiplications etc. But this is when hundreds
 	of words are involved at the least.
diff --git a/sources/sort.c b/sources/sort.c
index 0625147..36c73ce 100644
--- a/sources/sort.c
+++ b/sources/sort.c
@@ -11,7 +11,7 @@
  *
  *	Special routines for the parallel sorting are in the file threads.c
  *	Also the sorting of terms in polynomials is special but most of that is
- *	controled by changing the address of the compare routine. Other routines
+ *	controlled by changing the address of the compare routine. Other routines
  *	relevant for adding rational polynomials are in the file polynito.c
  */
 /* #[ License : */
diff --git a/sources/startup.c b/sources/startup.c
index 980ab22..2e2f122 100644
--- a/sources/startup.c
+++ b/sources/startup.c
@@ -728,7 +728,7 @@ VOID ReserveTempFiles(int par)
 		they can make the same .str file. We prevent this with first trying
 		a file that contains the digits of the pid. If this file
 		has already been taken we fall back on the old scheme.
-		The whole is controled with the -M (MultiRun) parameter in the
+		The whole is controlled with the -M (MultiRun) parameter in the
 		command tail.
 */
 	if ( AM.MultiRun ) {
diff --git a/sources/store.c b/sources/store.c
index 549bfaa..1d4f53f 100644
--- a/sources/store.c
+++ b/sources/store.c
@@ -1600,7 +1600,7 @@ FullTerm:
 		it at 'to'.
 		The value to be returned is the number of words read.
 		Renumbering is done also.
-		This is controled by the renumber table, given in 'renumber'
+		This is controlled by the renumber table, given in 'renumber'
 
 		This routine should work with a number of cache buffers. The
 		exact number should be definable in form.set.
@@ -4674,7 +4674,7 @@ WORD ReadSaveVariables(UBYTE *buffer, UBYTE *top, LONG *size, LONG *outsize,\
 
 RSVEnd:
 		/* we are here because the remaining buffer cannot hold the next
-		   struct. we position the file behind the last sucessfully translated
+		   struct. we position the file behind the last successfully translated
 		   struct and return. */
 		ADDPOS(pos, *size);
 		SeekFile(AO.SaveData.Handle, &pos, SEEK_SET);
diff --git a/sources/structs.h b/sources/structs.h
index e1085d1..df59047 100644
--- a/sources/structs.h
+++ b/sources/structs.h
@@ -197,7 +197,7 @@ typedef struct ReNuMbEr {
 
 /**
  *  Much information is stored in arrays of which we can double the size
- *  if the array proves to be too small. Such arrays are controled by
+ *  if the array proves to be too small. Such arrays are controlled by
  *  a variable of type #LIST. The routines that expand the lists are in the
  *  file tools.c
  */
diff --git a/sources/symmetr.c b/sources/symmetr.c
index e0a12da..13703e1 100644
--- a/sources/symmetr.c
+++ b/sources/symmetr.c
@@ -297,7 +297,7 @@ NextWV:
 				while ( n > 0 && ( *wv == FROMSET || *wv == SETTONUM
 				|| *wv == LOADDOLLAR ) ) { wv += wv[1]; wm++; n--; }
 /*              
-                Freak problem: doesn't test for n and ran into a reamining
+                Freak problem: doesn't test for n and ran into a remaining
                 code equal to SETTONUM followed by a big number and then
                 ran out of the memory.
 
diff --git a/sources/threads.c b/sources/threads.c
index 92f313b..2f226a4 100644
--- a/sources/threads.c
+++ b/sources/threads.c
@@ -1032,7 +1032,7 @@ int UpdateOneThread(int identity)
  *	because this is part of the 'overhead'.
  *
  *	@param from     the source thread which has all the variables already
- *	@param identity the TFORM defined integer thread identitier of the thread that needs the copy
+ *	@param identity the TFORM defined integer thread identifier of the thread that needs the copy
  *	@param thr      the bucket that contains the terms to be processed by 'identity'
  *	@param par		if 1 copies the already active pieces in the (de)compress buffer
  *	@return Standard return convention (OK -> 0)
@@ -2457,7 +2457,7 @@ int SendOneBucket(int type)
 /**
  *	We divide the expressions marked by partodo over the workers.
  *	The workers are responsible for writing their results into the buffers
- *	of the master (output). This is to be controled by locks.
+ *	of the master (output). This is to be controlled by locks.
  *	The order of the expressions may get changed this way.
  *
  *	The InParallel statement allows the execution of complete expressions
@@ -3577,7 +3577,7 @@ SortBotOut(PHEAD WORD *term)
  *	but now also each worker part is divided into blocks. This allows the
  *	worker to fill blocks while the master is already working on blocks that
  *	were filled before. The blocks are arranged in a circular fashion.
- *	The whole is controled by locks which seems faster than setting it up
+ *	The whole is controlled by locks which seems faster than setting it up
  *	with signals.
  *
  *	This routine is run by the master when we don't use the sortbots.
diff --git a/sources/tools.c b/sources/tools.c
index d4278b8..066c69e 100644
--- a/sources/tools.c
+++ b/sources/tools.c
@@ -499,7 +499,7 @@ STREAM *OpenStream(UBYTE *name, int type, int prevarmode, int raiselow)
 			{/*Block*/
 				int n, *tmpn;
 				if( (n=getCurrentExternalChannel()) == 0 )
-					Error0("@No current extrenal channel");
+					Error0("@No current external channel");
 				stream = CreateStream((UBYTE *)"externalchannel");
 				stream->handle = CreateHandle();
 				tmpn = (int *)Malloc1(sizeof(int),"external channel handle");
-- 
2.34.1


From 2b32ea55cbca5e45001d6a6c1f4bfffa6acd6f79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= <[email protected]>
Date: Sun, 11 Dec 2022 15:35:52 +0100
Subject: [PATCH 6/9] [repatch] fixing a few typos in sources folder

Repatched 9d7eeb9 (#441)
---
 sources/extcmd.c    | 18 +++++++++---------
 sources/mpi.c       |  2 +-
 sources/parallel.c  |  2 +-
 sources/polyfact.h  |  4 ++--
 sources/polywrap.cc |  2 +-
 sources/reken.c     | 10 +++++-----
 sources/startup.c   |  2 +-
 sources/store.c     |  4 ++--
 sources/structs.h   | 10 +++++-----
 sources/tables.c    |  2 +-
 sources/threads.c   |  2 +-
 sources/transform.c |  2 +-
 12 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/sources/extcmd.c b/sources/extcmd.c
index 20652fe..40e53be 100644
--- a/sources/extcmd.c
+++ b/sources/extcmd.c
@@ -75,7 +75,7 @@
 
 	By default, the terminator if an empty line. For the current external
 	channel it can be set by means of the function
-	int setTerminatorForExternalChannel(newterminaror).
+	int setTerminatorForExternalChannel(newterminator).
 	The function returns 0 in success, or !0 if something is wrong (no
 	current channel, too long terminator).
 
@@ -110,7 +110,7 @@
 	List of all public functions:
 	int openExternalChannel(UBYTE *cmd,int daemonize,UBYTE *shellname, UBYTE * stderrname);
 	int initPresetExternalChannels(UBYTE *theline, int thetimeout);
-	int setTerminatorForExternalChannel(char *newterminaror);
+	int setTerminatorForExternalChannel(char *newterminator);
 	int setKillModeForExternalChannel(int signum, int sentToWholeGroup);
 	int closeExternalChannel(int n);
 	int selectExternalChannel(int n);
@@ -1054,7 +1054,7 @@ mysighandler_t oldPIPE=NULL;
 				  /*Ignore SIGPIPE (up to the end of the process):*/
 				  signal(SIGPIPE,SIG_IGN);
 
-				  /*Wait on read() while the granchild close the pipe 
+				  /*Wait on read() while the grandchild close the pipe 
 					 (on success) or send -2 (if exec() fails).*/
 				  /*There are two possibilities: 
 					  -1 -- this is ok, the pipe was closed on exec,
@@ -1064,7 +1064,7 @@ mysighandler_t oldPIPE=NULL;
 				  */
 				  if( readpid(fdsig2[0]) != (pid_t)-1 )/*something is wrong*/
 					  writepid(fdsig[1],(pid_t)-1);
-				  else/*ok, send PID of the granchild to the father:*/
+				  else/*ok, send PID of the grandchild to the father:*/
 					  writepid(fdsig[1],childpid);
 				  /*Die and free the life space for the grandchild:*/
 				  _exit(0);/*The child, just exit, not return*/
@@ -1253,7 +1253,7 @@ static FORM_INLINE void *createExternalChannel(
 		}
 #ifdef WITHMPI
 		if(h->pid<0)
-			statusbuf[0]='!';/*Brodcast fail to slaves*/
+			statusbuf[0]='!';/*Broadcast fail to slaves*/
 	}
 	 /*else: Keep h->pid = 0 and h->fsend = 0 for slaves in parallel mode!*/
 
@@ -1339,7 +1339,7 @@ int i=0;
   	#] openExternalChannel : 
   	#[ initPresetExternalChannels :
 */
-/*Just simpe wrapper to invoke  openExternalChannel()
+/*Just simple wrapper to invoke  openExternalChannel()
 	from initPresetExternalChannels():*/
 static FORM_INLINE int openPresetExternalChannel(int fdin, int fdout, pid_t theppid)
 {
@@ -1368,7 +1368,7 @@ r#,w# where r# is a read-only descriptor and w# is a write-only
 descriptor. Alternatively, the environment variable FORM_PIPES can be
 used.
 	The following function expects as the first argument 
-this comma-separated list of the  desctiptor pairs and tries to 
+this comma-separated list of the  descriptor pairs and tries to 
 initialize each of channel during thetimeout milliseconds:*/
 
 int initPresetExternalChannels(UBYTE *theline, int thetimeout)
@@ -1412,7 +1412,7 @@ int initPresetExternalChannels(UBYTE *theline, int thetimeout)
 		if( ( *b != ',' ) || ( ppid != getpid() ) )goto presetFails;
 		/*read the parent PID:*/
 		/*The problem is that we do not know the the real type of pid_t.
-		  But long should be ehough. On obsolete systems (when LONG_MAX
+		  But long should be enough. On obsolete systems (when LONG_MAX
 		  is not defined) we assume pid_t is 32-bit integer.
 		  This can lead to problem with portability: */
 		ppid = (pid_t)str2i(b+1,&b,LONG_MAX);
@@ -1602,7 +1602,7 @@ int main (void)
 	printf("Initial channel:%d\n",last=openExternalChannel((UBYTE*)"cat",0,NULL,NULL));
 
 	if( ( i = setTerminatorForExternalChannel("qu") ) != 0 ) return 1;
-	printf("Terminaror is 'qu'\n");
+	printf("Terminator is 'qu'\n");
 
 	while ( fgets(buf, 1024, stdin) != NULL ) {
 		if ( *buf == 'N' ) {
diff --git a/sources/mpi.c b/sources/mpi.c
index fff7757..c9142b8 100644
--- a/sources/mpi.c
+++ b/sources/mpi.c
@@ -693,7 +693,7 @@ int PF_Unpack(void *buffer, size_t count, MPI_Datatype type)
  * the string. If the string does not fit to the buffer PF_packbuf,
  * the function packs only the initial portion. It returns
  * the number of packed bytes, so if (str[length-1]=='\0') then the whole
- * string fits to the buffer, if not, then the rest (str+length) bust be
+ * string fits to the buffer, if not, then the rest (str+length) must be
  * packed and send again. On error, the function returns the negative
  * error code.
  *
diff --git a/sources/parallel.c b/sources/parallel.c
index bb12d58..558af6e 100644
--- a/sources/parallel.c
+++ b/sources/parallel.c
@@ -462,7 +462,7 @@ static int PF_InitTree(void)
 	}
 
 	if ( PF_root == NULL )
-	if ( ( PF_root = (NODE*)Malloc1(sizeof(NODE)*numnodes,"nodes in mergtree") ) == NULL )
+	if ( ( PF_root = (NODE*)Malloc1(sizeof(NODE)*numnodes,"nodes in mergetree") ) == NULL )
 		return(-1);
 /*
 		then initialize all the nodes
diff --git a/sources/polyfact.h b/sources/polyfact.h
index 177106e..dba1fa3 100644
--- a/sources/polyfact.h
+++ b/sources/polyfact.h
@@ -30,11 +30,11 @@
 #include <string>
 
 // First prime modulo which factorization is tried. Too small results
-// in more unsuccesful attempts; too large is slower.
+// in more unsuccessful attempts; too large is slower.
 const int POLYFACT_FIRST_PRIME = 17;
 
 // Fraction of [1,p) that is used for substitutions of variables. Too
-// small results in more unsuccesful attempts; too large is slower.
+// small results in more unsuccessful attempts; too large is slower.
 const int POLYFACT_IDEAL_FRACTION = 5;
 
 // Number of ideals that are tried before failure due to unlucky
diff --git a/sources/polywrap.cc b/sources/polywrap.cc
index 5894031..37ad681 100644
--- a/sources/polywrap.cc
+++ b/sources/polywrap.cc
@@ -705,7 +705,7 @@ WORD *poly_ratfun_add (PHEAD WORD *t1, WORD *t2) {
  *
  *   Description
  *   ===========
- *   This method seaches a term for multiple polyratfuns and
+ *   This method searches a term for multiple polyratfuns and
  *   multiplies their contents. The result is properly
  *   normalized. Normalization also works for terms with a single
  *   polyratfun.
diff --git a/sources/reken.c b/sources/reken.c
index 79bde51..513009f 100644
--- a/sources/reken.c
+++ b/sources/reken.c
@@ -5,7 +5,7 @@
  *	Hence there are routines for dealing with integers and with rational
  *	of 'arbitrary precision' (within limits)
  *	There are also routines for that calculus modulus an integer.
- *	In addition there are the routines for factorials and bernoulli numbers.
+ *	In addition there are the routines for factorials and Bernoulli numbers.
  *	The random number function is currently only for internal purposes.
  */
 /* #[ License : */
@@ -522,7 +522,7 @@ WORD DivRat(PHEAD UWORD *a, WORD na, UWORD *b, WORD nb, UWORD *c, WORD *nc)
  		#[ Simplify :		WORD Simplify(a,na,b,nb)
 
 	Determines the greatest common denominator of a and b and
-	devides both by it. A possible sign is put in a. This is
+	divides both by it. A possible sign is put in a. This is
 	the simplification of the fraction a/b.
 
 */
@@ -1651,7 +1651,7 @@ UWORD Quotient(UWORD *a, WORD *na, WORD b)
  		#] Quotient : 
  		#[ Remain10 :		WORD Remain10(a,na)
 
-	Routine devides a by 10 and gives the remainder as return value.
+	Routine divides a by 10 and gives the remainder as return value.
 	The value of a will be the quotient! a must be positive.
 
 */
@@ -1678,7 +1678,7 @@ WORD Remain10(UWORD *a, WORD *na)
  		#] Remain10 : 
  		#[ Remain4 :		WORD Remain4(a,na)
 
-	Routine devides a by 10000 and gives the remainder as return value.
+	Routine divides a by 10000 and gives the remainder as return value.
 	The value of a will be the quotient! a must be positive.
 
 */
@@ -3516,7 +3516,7 @@ int Factorial(PHEAD WORD n, UWORD *a, WORD *na)
 	Builds up what is needed and remembers it for the next time.
 	b_0 = 1
 	(n+1)*b_n = -b_{n-1}-sum_(i,1,n-1,b_i*b_{n-i})
-	The n-1 playes only a role for b_2.
+	The n-1 plays only a role for b_2.
 	We have hard coded b_0,b_1,b_2 and b_odd. After that:
 	(2n+1)*b_2n = -sum_(i,1,n-1,b_2i*b_{2n-2i})
 
diff --git a/sources/startup.c b/sources/startup.c
index 2e2f122..2a14608 100644
--- a/sources/startup.c
+++ b/sources/startup.c
@@ -2,7 +2,7 @@
  * 
  *  This file contains the main program.
  *  It also deals with the very early stages of the startup of FORM
- *	and the final stages when the program attemps some cleanup.
+ *	and the final stages when the program attempts some cleanup.
  *	Here is the routine that analyses the command tail.
  */
 /* #[ License : */
diff --git a/sources/store.c b/sources/store.c
index 1d4f53f..b310654 100644
--- a/sources/store.c
+++ b/sources/store.c
@@ -4161,7 +4161,7 @@ WORD ReadSaveHeader(VOID)
  *
  *  Called by CoLoad() and FindInIndex().
  *
- *  @param  fileind  contains the read FILEINDEX after succesful return. must
+ *  @param  fileind  contains the read FILEINDEX after successful return. must
  *                   point to allocated, big enough memory.
  *  @return          = 0 everything okay, != 0 an error occurred
  */
@@ -4170,7 +4170,7 @@ WORD ReadSaveIndex(FILEINDEX *fileind)
 	/* do we need some translation for the FILEINDEX? */
 	if ( AO.transFlag ) {
 		/* if a translated FILEINDEX can hold less entries than the original
-		   FILEINDEX, then we need to buffer the extra entires in this static
+		   FILEINDEX, then we need to buffer the extra entries in this static
 		   variable (can happen going from 32bit to 64bit */
 		static FILEINDEX sbuffer;
 
diff --git a/sources/structs.h b/sources/structs.h
index df59047..4c19ced 100644
--- a/sources/structs.h
+++ b/sources/structs.h
@@ -1452,7 +1452,7 @@ struct M_const {
     LONG    CompressSize;          /* (M) Size of Compress buffer */
     LONG    ScratSize;             /* (M) Size of Fscr[] buffers */
     LONG    HideSize;              /* (M) Size of Fscr[2] buffer */
-    LONG    SizeStoreCache;        /* (M) Size of the chaches for reading global expr. */
+    LONG    SizeStoreCache;        /* (M) Size of the caches for reading global expr. */
     LONG    MaxStreamSize;         /* (M) Maximum buffer size in reading streams */
     LONG    SIOsize;               /* (M) Sort InputOutput buffer size */
     LONG    SLargeSize;            /* (M) */
@@ -1929,7 +1929,7 @@ struct C_const {
     WORD    SymChangeFlag;         /* (C) */
     WORD    CollectPercentage;     /* (C) Collect function percentage */
     WORD    ShortStatsMax;         /* For  On FewerStatistics 10; */
-	WORD	extrasymbols;          /* Flag for the extra symbsols output mode */
+	WORD	extrasymbols;          /* Flag for the extra symbols output mode */
     WORD    PolyRatFunChanged;     /* Keeps track whether we changed in the compiler */
     WORD    ToBeInFactors;
     WORD    InnerTest;            /* For debugging */
@@ -2136,7 +2136,7 @@ struct T_const {
     UWORD   *factorials;           /* (T) buffer of factorials. Dynamic. */
     WORD    *small_power_n;        /*     length of the number */
     UWORD  **small_power;          /*     the number*/	
-    UWORD   *bernoullis;           /* (T) The buffer with bernoulli numbers. Dynamic. */
+    UWORD   *bernoullis;           /* (T) The buffer with Bernoulli numbers. Dynamic. */
     WORD    *primelist;
     LONG    *pfac;                 /* (T) array of positions of factorials. Dynamic. */
     LONG    *pBer;                 /* (T) array of positions of Bernoulli's. Dynamic. */
@@ -2161,7 +2161,7 @@ struct T_const {
     VOID    *auxr_;
 #endif
     PARTI   partitions;
-    LONG    sBer;                  /* (T) Size of the bernoullis buffer */
+    LONG    sBer;                  /* (T) Size of the Bernoullis buffer */
     LONG    pWorkPointer;          /* (R) Offset-pointer in pWorkSpace */
     LONG    lWorkPointer;          /* (R) Offset-pointer in lWorkSpace */
     LONG    posWorkPointer;        /* (R) Offset-pointer in posWorkSpace */
@@ -2215,7 +2215,7 @@ struct T_const {
     WORD    TMbuff;                /* (R) Communication between TestSub and Genera */
 	WORD	TMdolfac;              /* factor number for dollar */
     WORD    nfac;                  /* (T) Number of highest stored factorial */
-    WORD    nBer;                  /* (T) Number of highest bernoulli number. */
+    WORD    nBer;                  /* (T) Number of highest Bernoulli number. */
     WORD    mBer;                  /* (T) Size of buffer pBer. */
     WORD    PolyAct;               /* (R) Used for putting the PolyFun at end. ini at 0 */
     WORD    RecFlag;               /* (R) Used in TestSub. ini at zero. */
diff --git a/sources/tables.c b/sources/tables.c
index ab68c97..fecaed3 100644
--- a/sources/tables.c
+++ b/sources/tables.c
@@ -1,7 +1,7 @@
 /** @file tables.c
  * 
  *  Contains all functions that deal with the table bases on the 'FORM level'
- *  The low level databse routines are in minos.c
+ *  The low level database routines are in minos.c
  */
 /* #[ License : */
 /*
diff --git a/sources/threads.c b/sources/threads.c
index 2f226a4..f3230b7 100644
--- a/sources/threads.c
+++ b/sources/threads.c
@@ -3271,7 +3271,7 @@ restart:;
 */
 		if ( thr->totnum-thr->usenum < numtogo ) goto restart;
 /*
-		If the thread is in the term loading phace
+		If the thread is in the term loading phase
 		(thr->busy == BUCKETPREPARINGTERM) we better stay away from it.
 		We wait now for the thread to be busy, and don't allow it
 		now to drop out of this state till we are done here.
diff --git a/sources/transform.c b/sources/transform.c
index 9568ec6..48a53d6 100644
--- a/sources/transform.c
+++ b/sources/transform.c
@@ -2167,7 +2167,7 @@ WORD RunPermute(PHEAD WORD *fun, WORD *args, WORD *info)
 		if ( *info > totarg ) return(0);
 /*
 		Now we have a look whether there are dollar variables to be expanded
-		We also sift out all values that are out of range.
+		We also shift out all values that are out of range.
 */
 		withdollar = 0;  in = info;
 		while ( in < infostop ) {
-- 
2.34.1


From bb44fccc70a70cfa54273ee95fd1f3d309d26a89 Mon Sep 17 00:00:00 2001
From: Takahiro Ueda <[email protected]>
Date: Thu, 15 Dec 2022 22:12:03 +0900
Subject: [PATCH 7/9] [repatch] fix: moebius_ function (#422, #430)

* Build issue on 32-bit machines.

* Corner cases where n ~ MAXPOSITIVE.

Repatched 28e15ea (#441)
---
 sources/reken.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sources/reken.c b/sources/reken.c
index 513009f..3279bab 100644
--- a/sources/reken.c
+++ b/sources/reken.c
@@ -3739,8 +3739,8 @@ WORD Moebius(PHEAD WORD nn)
 		b: the number is not already in the table.
 */
 	if ( nn >= AR.moebiustablesize ) {
-		if ( AR.moebiustablesize <= 0 ) { newsize = nn + 20; }
-		else { newsize = nn*2; }
+		if ( AR.moebiustablesize <= 0 ) { newsize = (LONG)nn + 20; }
+		else { newsize = (LONG)nn*2; }
 		if ( newsize > MAXPOSITIVE ) newsize = MAXPOSITIVE;
 		newtable = (char *)Malloc1(newsize*sizeof(char),"Moebius");
 		for ( i = 0; i < AR.moebiustablesize; i++ ) newtable[i] = AR.moebiustable[i];
@@ -3749,7 +3749,8 @@ WORD Moebius(PHEAD WORD nn)
 		AR.moebiustable = newtable;			
 		AR.moebiustablesize = newsize;
 	}
-	if ( AR.moebiustable[nn] != 2 ) return((WORD)AR.moebiustable[nn]);
+	/* NOTE: nn == MAXPOSITIVE never fits in moebiustable. */
+	if ( nn != MAXPOSITIVE && AR.moebiustable[nn] != 2 ) return((WORD)AR.moebiustable[nn]);
 	mu = 1;
 	if ( n == 1 ) goto putvalue;
 	if ( n % 2 == 0 ) {
@@ -3759,8 +3760,12 @@ WORD Moebius(PHEAD WORD nn)
 		mu = -mu;
 		if ( n == 1 ) goto putvalue;
 	}
+#if ( BITSINWORD == 32 )
 	for ( i = 0; i < AR.numinprimelist; i++ ) {
 		x = AR.PrimeList[i];
+#else
+	for ( x = 3; x < MAXPOSITIVE; x += 2 ) {
+#endif
 		if ( n % x == 0 ) {
 			n /= x;
 			if ( n % x == 0 ) { mu = 0; goto putvalue; }
@@ -3772,7 +3777,7 @@ WORD Moebius(PHEAD WORD nn)
 	}
 	mu = -mu;
 putvalue:
-	AR.moebiustable[nn] = mu;
+	if ( nn != MAXPOSITIVE ) AR.moebiustable[nn] = mu;
 	return((WORD)mu);
 }
 
-- 
2.34.1


From 8df00510c785c72172548e7de545ad4895445287 Mon Sep 17 00:00:00 2001
From: Takahiro Ueda <[email protected]>
Date: Fri, 23 Dec 2022 13:45:53 +0900
Subject: [PATCH 8/9] [repatch] docs: remove invalid licence comment in
 extcmd.c (#431)

Repatched e7c52d3 (#441)
---
 sources/extcmd.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sources/extcmd.c b/sources/extcmd.c
index 40e53be..61f612e 100644
--- a/sources/extcmd.c
+++ b/sources/extcmd.c
@@ -33,19 +33,17 @@
 
 	This module is written by M.Tentyukov as a part of implementation of
 	interaction between FORM and external processes, first release
-	09.04.2004. A part of this code is copyied from the DIANA project
+	09.04.2004. A part of this code is copied from the DIANA project, which was
 	written by M. Tentyukov and published under the GPL version 2 as
-	published by the Free Software Foundation.  The code of this module
-	is NOT covered by GPL; it can be used under the terms of the FORM 
-	License http://www.nikhef.nl/~form/license.html
+	published by the Free Software Foundation.
 
 	This file is completely re-written by M.Tentyukov in May 2006.
 	Since the interface was changed, the public function were changed,
-	also. A new publc functions were added: initPresetExternalChannels()
+	also. A new public functions were added: initPresetExternalChannels()
 	(see comments just before this function in the present file) and
 	setKillModeForExternalChannel (a pointer, not a function).
 
-	If a macro WITHEXTERNALCHANNEL is not defined, all public punctions
+	If a macro WITHEXTERNALCHANNEL is not defined, all public functions
 	are stubs returning failure.
 
 	The idea is to start an external command  swallowing
-- 
2.34.1


From 6217ecad76a95174413c71f87adecac5af8266c2 Mon Sep 17 00:00:00 2001
From: Takahiro Ueda <[email protected]>
Date: Tue, 7 Mar 2023 12:30:27 +0900
Subject: [PATCH 9/9] [repatch] fix: memory error in calling macros with
 arguments (#434)

The pointer to the currently processed preprocessor variable is
invalidated when the list of preprocessor variables is extended.

Repatched 741861a (#441)
---
 sources/pre.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sources/pre.c b/sources/pre.c
index 0aeb894..01fbd71 100644
--- a/sources/pre.c
+++ b/sources/pre.c
@@ -321,6 +321,7 @@ higherlevel:
 */
 					int nargs = 1;
 					PREVAR *p;
+					size_t p_offset;
 					*s++ = 0; namebuf[i-2] = 0;
 					if ( StrICmp(namebuf,(UBYTE *)"random_") == 0 ) {
 						UBYTE *ranvalue;
@@ -438,6 +439,7 @@ higherlevel:
 					while ( *s ) s++;
 					s++;
 					t = p->argnames;
+					p_offset = p - PreVar;
 					for ( j = 0; j < p->nargs; j++ ) {
 						if ( ( nargs == p->nargs-1 ) && ( *t == '?' ) ) {
 							PutPreVar(t,0,0,0);
@@ -447,6 +449,7 @@ higherlevel:
 							while ( *s ) s++;
 							s++;
 						}
+						p = PreVar + p_offset;
 						while ( *t ) t++;
 						t++;
 					}
-- 
2.34.1

Would you guys like me to push these patches? (Or another way to proceed?)

How can we repair "Diagrams" and Issue #7?

@vermaseren
Copy link
Owner

vermaseren commented Apr 19, 2023 via email

@tueda
Copy link
Collaborator Author

tueda commented Apr 20, 2023

OK, I will push the above patches. At the moment, I have no idea why Issue #7 was re-broken...

tueda pushed a commit that referenced this issue Apr 20, 2023
tueda pushed a commit that referenced this issue Apr 20, 2023
tueda pushed a commit that referenced this issue Apr 20, 2023
tueda pushed a commit that referenced this issue Apr 20, 2023
tueda added a commit that referenced this issue Apr 20, 2023
* Build issue on 32-bit machines.

* Corner cases where n ~ MAXPOSITIVE.

Repatched 28e15ea (#441)
tueda added a commit that referenced this issue Apr 20, 2023
The pointer to the currently processed preprocessor variable is
invalidated when the list of preprocessor variables is extended.

Repatched 741861a (#441)
@tueda
Copy link
Collaborator Author

tueda commented Feb 26, 2024

Closing as this has been superseded by #475.

@tueda tueda closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants