[Debian-hebrew-package] r998 - in /pkg/libhdate/trunk/debian: changelog patches/cflags.patch patches/duplicate_gnu_source.patch patches/missing_format.patch patches/nested_extern.patch patches/series patches/size_t.patch
tzafrir at users.alioth.debian.org
tzafrir at users.alioth.debian.org
Sat Sep 21 06:02:21 UTC 2013
Author: tzafrir
Date: Sat Sep 21 06:02:20 2013
New Revision: 998
URL: http://svn.debian.org/wsvn/debian-hebrew/?sc=1&rev=998
Log:
Pass build-flags properly and fix bugs exposed
* cflags.patch: pass along build-flags set by deb-helpers.
* As a result of building with warnings and hardening, several other
fixes:
- missing_format.patch - missing a format string for fprintf.
- duplicate_gnu_source.patch - _GNU_SOURCE was set both in autoconf
and in files.
- nested_extern.patch - Don't #include files inside a function.
- size_t.patch - int vs. size_t issues.'
Added:
pkg/libhdate/trunk/debian/patches/cflags.patch
pkg/libhdate/trunk/debian/patches/duplicate_gnu_source.patch
pkg/libhdate/trunk/debian/patches/missing_format.patch
pkg/libhdate/trunk/debian/patches/nested_extern.patch
pkg/libhdate/trunk/debian/patches/size_t.patch
Modified:
pkg/libhdate/trunk/debian/changelog
pkg/libhdate/trunk/debian/patches/series
Modified: pkg/libhdate/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/libhdate/trunk/debian/changelog?rev=998&op=diff
==============================================================================
--- pkg/libhdate/trunk/debian/changelog (original)
+++ pkg/libhdate/trunk/debian/changelog Sat Sep 21 06:02:20 2013
@@ -8,6 +8,14 @@
* A symbols file for libhdate1.
* typo_output.patch: fix a typo "ouput" (Lintian).
* Bump standards version: 3.9.4.
+ * cflags.patch: pass along build-flags set by deb-helpers.
+ * As a result of building with warnings and hardening, several other
+ fixes:
+ - missing_format.patch - missing a format string for fprintf.
+ - duplicate_gnu_source.patch - _GNU_SOURCE was set both in autoconf
+ and in files.
+ - nested_extern.patch - Don't #include files inside a function.
+ - size_t.patch - int vs. size_t issues.
-- Tzafrir Cohen <tzafrir at debian.org> Thu, 01 Nov 2012 16:53:34 +0200
Added: pkg/libhdate/trunk/debian/patches/cflags.patch
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/libhdate/trunk/debian/patches/cflags.patch?rev=998&op=file
==============================================================================
--- pkg/libhdate/trunk/debian/patches/cflags.patch (added)
+++ pkg/libhdate/trunk/debian/patches/cflags.patch Sat Sep 21 06:02:20 2013
@@ -0,0 +1,82 @@
+Description: Pass variables set by Debian build system
+Author: Tzafrir Cohen <tzafrir at debian.org>
+
+The Debian build system sets several variables (LDFLAGS, CFLAGS,
+CPPFLAGS).
+
+* CFLAGS was overriden by the configure script.
+* The perl and python bindings were not using the values of those
+ variables.
+
+--- a/configure.in
++++ b/configure.in
+@@ -33,7 +33,6 @@ AC_C_CONST
+ AC_CONFIG_MACRO_DIR([m4])
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+-CFLAGS=
+ LIBS=-lm
+
+ dnl =======================================================================================
+--- a/configure
++++ b/configure
+@@ -12466,7 +12466,6 @@ fi
+
+
+
+-CFLAGS=
+ LIBS=-lm
+
+
+--- a/bindings/perl/Makefile.am
++++ b/bindings/perl/Makefile.am
+@@ -11,8 +11,8 @@ all-am: hdate.so
+
+
+ hdate.so: hdate_wrap.cxx
+- g++ -fpic -c hdate_wrap.cxx $(PE_CFLAGS) -I$(top_srcdir)/src
+- g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so
++ g++ -fpic -c hdate_wrap.cxx $(CFLAGS) $(CPPFLAGS) $(PE_CFLAGS) -I$(top_srcdir)/src
++ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so $(LDFLAGS)
+
+ hdate_wrap.cxx: hdate.i
+ swig -perl -c++ hdate.i
+--- a/bindings/perl/Makefile.in
++++ b/bindings/perl/Makefile.in
+@@ -402,8 +402,8 @@ uninstall-am:
+ @WITH_PERL_TRUE at all-am: hdate.so
+
+ @WITH_PERL_TRUE at hdate.so: hdate_wrap.cxx
+- at WITH_PERL_TRUE@ g++ -fpic -c hdate_wrap.cxx $(PE_CFLAGS) -I$(top_srcdir)/src
+- at WITH_PERL_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so
++ at WITH_PERL_TRUE@ g++ -fpic -c hdate_wrap.cxx $(CFLAGS) $(CPPFLAGS) $(PE_CFLAGS) -I$(top_srcdir)/src
++ at WITH_PERL_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so $(LDFLAGS)
+
+ @WITH_PERL_TRUE at hdate_wrap.cxx: hdate.i
+ @WITH_PERL_TRUE@ swig -perl -c++ hdate.i
+--- a/bindings/python/Makefile.am
++++ b/bindings/python/Makefile.am
+@@ -11,8 +11,8 @@ all-am: _hdate.so
+
+
+ _hdate.so: hdate_wrap.cxx
+- g++ -fpic -c hdate_wrap.cxx $(PY_CFLAGS) -I$(top_srcdir)/src
+- g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so
++ g++ -fpic -c hdate_wrap.cxx $(CPPFLAGS) $(CFLAGS) $(PY_CFLAGS) -I$(top_srcdir)/src
++ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so $(LDFLAGS)
+
+ hdate_wrap.cxx: hdate.i
+ swig -python -c++ hdate.i
+--- a/bindings/python/Makefile.in
++++ b/bindings/python/Makefile.in
+@@ -402,8 +402,8 @@ uninstall-am:
+ @WITH_PYTHON_TRUE at all-am: _hdate.so
+
+ @WITH_PYTHON_TRUE at _hdate.so: hdate_wrap.cxx
+- at WITH_PYTHON_TRUE@ g++ -fpic -c hdate_wrap.cxx $(PY_CFLAGS) -I$(top_srcdir)/src
+- at WITH_PYTHON_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so
++ at WITH_PYTHON_TRUE@ g++ -fpic -c hdate_wrap.cxx $(CPPFLAGS) $(CFLAGS) $(PY_CFLAGS) -I$(top_srcdir)/src
++ at WITH_PYTHON_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so $(LDFLAGS)
+
+ @WITH_PYTHON_TRUE at hdate_wrap.cxx: hdate.i
+ @WITH_PYTHON_TRUE@ swig -python -c++ hdate.i
Added: pkg/libhdate/trunk/debian/patches/duplicate_gnu_source.patch
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/libhdate/trunk/debian/patches/duplicate_gnu_source.patch?rev=998&op=file
==============================================================================
--- pkg/libhdate/trunk/debian/patches/duplicate_gnu_source.patch (added)
+++ pkg/libhdate/trunk/debian/patches/duplicate_gnu_source.patch Sat Sep 21 06:02:20 2013
@@ -0,0 +1,53 @@
+Description: _GNU_SOURCE is already set in autoconf.
+Author: Tzafrir Cohen <Tzafrir at debian.org>
+
+--- a/examples/hcal/hdate.c
++++ b/examples/hcal/hdate.c
+@@ -20,7 +20,6 @@
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+-#define _GNU_SOURCE // For mempcpy, asprintf
+ #include <hdate.h> // For hebrew date
+ //#include "../../src/hdate.h"
+ #include <stdlib.h> // For atoi, getenv, setenv
+--- a/examples/hcal/local_functions.c
++++ b/examples/hcal/local_functions.c
+@@ -25,7 +25,6 @@
+ /**************************************************
+ * functions to support hcal and hdate
+ **************************************************/
+-#define _GNU_SOURCE // For mempcpy, asprintf
+
+ #include <hdate.h> // For hebrew date
+ //include "../../src/hdate.h"
+--- a/examples/hcal/hcal.c
++++ b/examples/hcal/hcal.c
+@@ -20,7 +20,6 @@
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+-#define _GNU_SOURCE // for mempcpy
+ #include <stdio.h> // For printf
+ #include <hdate.h> // For hebrew date
+ //#include "../../src/hdate.h"
+--- a/src/deprecated.c
++++ b/src/deprecated.c
+@@ -16,7 +16,6 @@
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+-#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+--- a/src/hdate_strings.c
++++ b/src/hdate_strings.c
+@@ -18,7 +18,6 @@
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+-#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
Added: pkg/libhdate/trunk/debian/patches/missing_format.patch
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/libhdate/trunk/debian/patches/missing_format.patch?rev=998&op=file
==============================================================================
--- pkg/libhdate/trunk/debian/patches/missing_format.patch (added)
+++ pkg/libhdate/trunk/debian/patches/missing_format.patch Sat Sep 21 06:02:20 2013
@@ -0,0 +1,17 @@
+Description: Use an explicit format string when printing config file
+Author: Tzafrir Cohen <tzafrir at debian.org>
+
+The call to print the default configuration text to the configuration file
+should use an explicit "%s". However the text comes from the code and does
+not happen to contain any '%' sign, so it is not explitable.
+--- a/examples/hcal/local_functions.c
++++ b/examples/hcal/local_functions.c
+@@ -676,7 +676,7 @@ FILE* get_config_file( const char* confi
+ error(0, errno, "%s: %s", N_("failure attempting to create config file"), config_file_path);
+ return;
+ }
+- fprintf(config_file, default_config_file_text);
++ fprintf(config_file, "%s", default_config_file_text);
+ error(0,0,"%s: %s",N_("config file created"), config_file_path);
+ if (fclose(config_file) != 0) error(0,errno,"%s %s",N_("failure closing"),config_file_name);
+ }
Added: pkg/libhdate/trunk/debian/patches/nested_extern.patch
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/libhdate/trunk/debian/patches/nested_extern.patch?rev=998&op=file
==============================================================================
--- pkg/libhdate/trunk/debian/patches/nested_extern.patch (added)
+++ pkg/libhdate/trunk/debian/patches/nested_extern.patch Sat Sep 21 06:02:20 2013
@@ -0,0 +1,31 @@
+Description: Do not include headers inside a function.
+Author: Tzafrir Cohen <tzafrir at debian.org>
+
+If you #include unistd.h inside a function, the declerations made in it
+can be considered nested functions.
+--- a/examples/hcal/local_functions.c
++++ b/examples/hcal/local_functions.c
+@@ -641,6 +641,11 @@ file. Attempting to create a config file
+ }
+
+
++#include <pwd.h> // for get pwuid
++#include <unistd.h> // for getuid
++#include <sys/stat.h>
++#include <sys/types.h> // for mkdir,
++
+ /************************************************************
+ * Open config file, or create one
+ * - returns filepointer or NULL
+@@ -650,11 +655,6 @@ FILE* get_config_file( const char* confi
+ const char* config_file_name,
+ const char* default_config_file_text )
+ {
+-#include <pwd.h> // for get pwuid
+-#include <unistd.h> // for getuid
+-#include <sys/stat.h>
+-#include <sys/types.h> // for mkdir,
+-
+ size_t path_len;
+
+ char* config_home_path_name = "";
Modified: pkg/libhdate/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/libhdate/trunk/debian/patches/series?rev=998&op=diff
==============================================================================
--- pkg/libhdate/trunk/debian/patches/series (original)
+++ pkg/libhdate/trunk/debian/patches/series Sat Sep 21 06:02:20 2013
@@ -4,3 +4,8 @@
fix_3
time_t.patch
typo_output.patch
+cflags.patch
+duplicate_gnu_source.patch
+size_t.patch
+nested_extern.patch
+missing_format.patch
Added: pkg/libhdate/trunk/debian/patches/size_t.patch
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/libhdate/trunk/debian/patches/size_t.patch?rev=998&op=file
==============================================================================
--- pkg/libhdate/trunk/debian/patches/size_t.patch (added)
+++ pkg/libhdate/trunk/debian/patches/size_t.patch Sat Sep 21 06:02:20 2013
@@ -0,0 +1,47 @@
+Description: size_t vars need %d in printf. %*s needs int
+Author: Tzafrir Cohen <tzafrir at debian.org>
+--- a/examples/hcal/local_functions.c
++++ b/examples/hcal/local_functions.c
+@@ -247,11 +247,11 @@ void revstr( char *source, const size_t
+
+ #define DEBUG 0
+ #if DEBUG
+-printf("\nrevstr: entry: sourcelen = %d, source = %s\n",source_len, source);
++printf("\nrevstr: entry: sourcelen = %zd, source = %s\n",source_len, source);
+ #endif
+
+ if (source == NULL) {error(0,0,"revstr: source buffer pointer is NULL"); exit(0);};
+- if (source_len <= 0) {error(0,0,"revstr: source_len parameter invalid, %d",source_len); exit(0);};
++ if (source_len <= 0) {error(0,0,"revstr: source_len parameter invalid, %zd",source_len); exit(0);};
+
+ size_t i,j;
+ char *temp_buff;
+@@ -272,7 +272,7 @@ printf("\nrevstr: entry: sourcelen = %d,
+ memcpy(source, temp_buff, source_len);
+ source[source_len] = '\0';
+ #if DEBUG
+-printf("\nrevstr: before free(tempbuff): sourcelen = %d, source = %s\n",source_len, source);
++printf("\nrevstr: before free(tempbuff): sourcelen = %zd, source = %s\n",source_len, source);
+ #endif
+ free(temp_buff);
+ return;
+--- a/examples/hcal/hcal.c
++++ b/examples/hcal/hcal.c
+@@ -1135,7 +1135,7 @@ void print_week( int jd, const int month
+ // padding - FIXME - spaces are single-byte, while
+ // the Hebrew characters are two bytes
+ const int margin_max = 15;
+- printf("%*s%s", (margin_max - shabbat_name_str_len/2)," ", shabbat_name_buffer);
++ printf("%*s%s", (int) (margin_max - shabbat_name_str_len/2)," ", shabbat_name_buffer);
+
+ free(shabbat_name_buffer);
+ }
+@@ -1344,7 +1344,7 @@ int print_month ( const int month, const
+ // padding - FIXME - spaces are single-byte, while
+ // the Hebrew characters are two bytes
+ const int margin_max = 16; // 15 fails because of jabotinsky in july
+- printf("%*s%s\n", (margin_max - holiday_str_len/2)," ", holiday_buffer);
++ printf("%*s%s\n", (int) (margin_max - holiday_str_len/2)," ", holiday_buffer);
+
+ free(holiday_buffer);
+ }
More information about the Debian-hebrew-package
mailing list