--- config/rootfiles/common/bc | 8 +++--- lfs/bc | 15 +++++------ src/patches/bc-1.06.95-memory_leak-1.patch | 41 ++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 src/patches/bc-1.06.95-memory_leak-1.patch
diff --git a/config/rootfiles/common/bc b/config/rootfiles/common/bc index 145c177..2e983a8 100644 --- a/config/rootfiles/common/bc +++ b/config/rootfiles/common/bc @@ -1,6 +1,6 @@ usr/bin/bc usr/bin/dc -#usr/info/bc.info -#usr/info/dc.info -#usr/man/man1/bc.1 -#usr/man/man1/dc.1 +#usr/share/info/bc.info +#usr/share/info/dc.info +#usr/share/man/man1/bc.1 +#usr/share/man/man1/dc.1 diff --git a/lfs/bc b/lfs/bc index 28b27cb..77a2d21 100644 --- a/lfs/bc +++ b/lfs/bc @@ -24,10 +24,10 @@
include Config
-VER = 1.06 +VER = 1.06.95
THISAPP = bc-$(VER) -DL_FILE = $(THISAPP).tar.gz +DL_FILE = $(THISAPP).tar.bz2 DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) @@ -40,7 +40,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = d44b5dddebd8a7a7309aea6c36fda117 +$(DL_FILE)_MD5 = 5126a721b73f97d715bb72c13c889035
install : $(TARGET)
@@ -69,12 +69,9 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) - @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && sed -i '/PROTO.*readline/d' bc/scan.l - cd $(DIR_APP) && sed -i '/flex -I8/s/8//' configure - cd $(DIR_APP) && sed -i '/stdlib/a #include <string.h>' lib/number.c - cd $(DIR_APP) && sed -i 's/program.*save/static &/' bc/load.c - cd $(DIR_APP) && ./configure --prefix=/usr --with-readline + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/bc-1.06.95-memory_leak-1.patch + cd $(DIR_APP) && ./configure --prefix=/usr --with-readline --mandir=/usr/share/man --infodir=/usr/share/info cd $(DIR_APP) && make $(MAKETUNING) cd $(DIR_APP) && make install @rm -rf $(DIR_APP) diff --git a/src/patches/bc-1.06.95-memory_leak-1.patch b/src/patches/bc-1.06.95-memory_leak-1.patch new file mode 100644 index 0000000..65703f9 --- /dev/null +++ b/src/patches/bc-1.06.95-memory_leak-1.patch @@ -0,0 +1,41 @@ +Submitted By: Bruce Dubbs (bdubbs at linuxfromscratch dot org) +Date: 2014-04-18 +Initial Package Version: 1.06.95 +Origin: Gentoo +Description: Fixes memory leaks and an uninitialized variable + +diff -Naur bc-1.06.95.orig/bc/bc.y bc-1.06.95/bc/bc.y +--- bc-1.06.95.orig/bc/bc.y 2006-09-04 21:39:31.000000000 -0500 ++++ bc-1.06.95/bc/bc.y 2014-04-09 13:27:04.602661243 -0500 +@@ -569,6 +569,7 @@ + generate (">"); + break; + } ++ free($2); + } + | expression '+' expression + { +diff -Naur bc-1.06.95.orig/bc/storage.c bc-1.06.95/bc/storage.c +--- bc-1.06.95.orig/bc/storage.c 2006-09-04 21:39:31.000000000 -0500 ++++ bc-1.06.95/bc/storage.c 2014-04-09 13:28:11.770763410 -0500 +@@ -99,6 +99,7 @@ + { + f = &functions[indx]; + f->f_defined = FALSE; ++ f->f_void = FALSE; + f->f_body = (char *) bc_malloc (BC_START_SIZE); + f->f_body_size = BC_START_SIZE; + f->f_code_size = 0; +diff -Naur bc-1.06.95.orig/bc/util.c bc-1.06.95/bc/util.c +--- bc-1.06.95.orig/bc/util.c 2006-09-04 21:39:31.000000000 -0500 ++++ bc-1.06.95/bc/util.c 2014-04-09 13:27:39.841190064 -0500 +@@ -602,8 +602,7 @@ + case FUNCTDEF: + if (id->f_name != 0) + { +- if (namekind != FUNCT) +- free(name); ++ free(name); + /* Check to see if we are redefining a math lib function. */ + if (use_math && namekind == FUNCTDEF && id->f_name <= 6) + id->f_name = next_func++;