Package list libhdate / 96abbf9
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.' Tzafrir Cohen 7 years ago
7 changed file(s) with 243 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
77 * A symbols file for libhdate1.
88 * typo_output.patch: fix a typo "ouput" (Lintian).
99 * Bump standards version: 3.9.4.
10 * cflags.patch: pass along build-flags set by deb-helpers.
11 * As a result of building with warnings and hardening, several other
12 fixes:
13 - missing_format.patch - missing a format string for fprintf.
14 - duplicate_gnu_source.patch - _GNU_SOURCE was set both in autoconf
15 and in files.
16 - nested_extern.patch - Don't #include files inside a function.
17 - size_t.patch - int vs. size_t issues.
1018
1119 -- Tzafrir Cohen <tzafrir@debian.org> Thu, 01 Nov 2012 16:53:34 +0200
1220
0 Description: Pass variables set by Debian build system
1 Author: Tzafrir Cohen <tzafrir@debian.org>
2
3 The Debian build system sets several variables (LDFLAGS, CFLAGS,
4 CPPFLAGS).
5
6 * CFLAGS was overriden by the configure script.
7 * The perl and python bindings were not using the values of those
8 variables.
9
10 --- a/configure.in
11 +++ b/configure.in
12 @@ -33,7 +33,6 @@ AC_C_CONST
13 AC_CONFIG_MACRO_DIR([m4])
14 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
15
16 -CFLAGS=
17 LIBS=-lm
18
19 dnl =======================================================================================
20 --- a/configure
21 +++ b/configure
22 @@ -12466,7 +12466,6 @@ fi
23
24
25
26 -CFLAGS=
27 LIBS=-lm
28
29
30 --- a/bindings/perl/Makefile.am
31 +++ b/bindings/perl/Makefile.am
32 @@ -11,8 +11,8 @@ all-am: hdate.so
33
34
35 hdate.so: hdate_wrap.cxx
36 - g++ -fpic -c hdate_wrap.cxx $(PE_CFLAGS) -I$(top_srcdir)/src
37 - g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so
38 + g++ -fpic -c hdate_wrap.cxx $(CFLAGS) $(CPPFLAGS) $(PE_CFLAGS) -I$(top_srcdir)/src
39 + g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so $(LDFLAGS)
40
41 hdate_wrap.cxx: hdate.i
42 swig -perl -c++ hdate.i
43 --- a/bindings/perl/Makefile.in
44 +++ b/bindings/perl/Makefile.in
45 @@ -402,8 +402,8 @@ uninstall-am:
46 @WITH_PERL_TRUE@all-am: hdate.so
47
48 @WITH_PERL_TRUE@hdate.so: hdate_wrap.cxx
49 -@WITH_PERL_TRUE@ g++ -fpic -c hdate_wrap.cxx $(PE_CFLAGS) -I$(top_srcdir)/src
50 -@WITH_PERL_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so
51 +@WITH_PERL_TRUE@ g++ -fpic -c hdate_wrap.cxx $(CFLAGS) $(CPPFLAGS) $(PE_CFLAGS) -I$(top_srcdir)/src
52 +@WITH_PERL_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so $(LDFLAGS)
53
54 @WITH_PERL_TRUE@hdate_wrap.cxx: hdate.i
55 @WITH_PERL_TRUE@ swig -perl -c++ hdate.i
56 --- a/bindings/python/Makefile.am
57 +++ b/bindings/python/Makefile.am
58 @@ -11,8 +11,8 @@ all-am: _hdate.so
59
60
61 _hdate.so: hdate_wrap.cxx
62 - g++ -fpic -c hdate_wrap.cxx $(PY_CFLAGS) -I$(top_srcdir)/src
63 - g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so
64 + g++ -fpic -c hdate_wrap.cxx $(CPPFLAGS) $(CFLAGS) $(PY_CFLAGS) -I$(top_srcdir)/src
65 + g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so $(LDFLAGS)
66
67 hdate_wrap.cxx: hdate.i
68 swig -python -c++ hdate.i
69 --- a/bindings/python/Makefile.in
70 +++ b/bindings/python/Makefile.in
71 @@ -402,8 +402,8 @@ uninstall-am:
72 @WITH_PYTHON_TRUE@all-am: _hdate.so
73
74 @WITH_PYTHON_TRUE@_hdate.so: hdate_wrap.cxx
75 -@WITH_PYTHON_TRUE@ g++ -fpic -c hdate_wrap.cxx $(PY_CFLAGS) -I$(top_srcdir)/src
76 -@WITH_PYTHON_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so
77 +@WITH_PYTHON_TRUE@ g++ -fpic -c hdate_wrap.cxx $(CPPFLAGS) $(CFLAGS) $(PY_CFLAGS) -I$(top_srcdir)/src
78 +@WITH_PYTHON_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so $(LDFLAGS)
79
80 @WITH_PYTHON_TRUE@hdate_wrap.cxx: hdate.i
81 @WITH_PYTHON_TRUE@ swig -python -c++ hdate.i
0 Description: _GNU_SOURCE is already set in autoconf.
1 Author: Tzafrir Cohen <Tzafrir@debian.org>
2
3 --- a/examples/hcal/hdate.c
4 +++ b/examples/hcal/hdate.c
5 @@ -20,7 +20,6 @@
6 * along with this program. If not, see <http://www.gnu.org/licenses/>.
7 */
8
9 -#define _GNU_SOURCE // For mempcpy, asprintf
10 #include <hdate.h> // For hebrew date
11 //#include "../../src/hdate.h"
12 #include <stdlib.h> // For atoi, getenv, setenv
13 --- a/examples/hcal/local_functions.c
14 +++ b/examples/hcal/local_functions.c
15 @@ -25,7 +25,6 @@
16 /**************************************************
17 * functions to support hcal and hdate
18 **************************************************/
19 -#define _GNU_SOURCE // For mempcpy, asprintf
20
21 #include <hdate.h> // For hebrew date
22 //include "../../src/hdate.h"
23 --- a/examples/hcal/hcal.c
24 +++ b/examples/hcal/hcal.c
25 @@ -20,7 +20,6 @@
26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29 -#define _GNU_SOURCE // for mempcpy
30 #include <stdio.h> // For printf
31 #include <hdate.h> // For hebrew date
32 //#include "../../src/hdate.h"
33 --- a/src/deprecated.c
34 +++ b/src/deprecated.c
35 @@ -16,7 +16,6 @@
36 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37 */
38
39 -#define _GNU_SOURCE
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
43 --- a/src/hdate_strings.c
44 +++ b/src/hdate_strings.c
45 @@ -18,7 +18,6 @@
46 * along with this program. If not, see <http://www.gnu.org/licenses/>.
47 */
48
49 -#define _GNU_SOURCE
50 #include <stdio.h>
51 #include <stdlib.h>
52 #include <string.h>
0 Description: Use an explicit format string when printing config file
1 Author: Tzafrir Cohen <tzafrir@debian.org>
2
3 The call to print the default configuration text to the configuration file
4 should use an explicit "%s". However the text comes from the code and does
5 not happen to contain any '%' sign, so it is not explitable.
6 --- a/examples/hcal/local_functions.c
7 +++ b/examples/hcal/local_functions.c
8 @@ -676,7 +676,7 @@ FILE* get_config_file( const char* confi
9 error(0, errno, "%s: %s", N_("failure attempting to create config file"), config_file_path);
10 return;
11 }
12 - fprintf(config_file, default_config_file_text);
13 + fprintf(config_file, "%s", default_config_file_text);
14 error(0,0,"%s: %s",N_("config file created"), config_file_path);
15 if (fclose(config_file) != 0) error(0,errno,"%s %s",N_("failure closing"),config_file_name);
16 }
0 Description: Do not include headers inside a function.
1 Author: Tzafrir Cohen <tzafrir@debian.org>
2
3 If you #include unistd.h inside a function, the declerations made in it
4 can be considered nested functions.
5 --- a/examples/hcal/local_functions.c
6 +++ b/examples/hcal/local_functions.c
7 @@ -641,6 +641,11 @@ file. Attempting to create a config file
8 }
9
10
11 +#include <pwd.h> // for get pwuid
12 +#include <unistd.h> // for getuid
13 +#include <sys/stat.h>
14 +#include <sys/types.h> // for mkdir,
15 +
16 /************************************************************
17 * Open config file, or create one
18 * - returns filepointer or NULL
19 @@ -650,11 +655,6 @@ FILE* get_config_file( const char* confi
20 const char* config_file_name,
21 const char* default_config_file_text )
22 {
23 -#include <pwd.h> // for get pwuid
24 -#include <unistd.h> // for getuid
25 -#include <sys/stat.h>
26 -#include <sys/types.h> // for mkdir,
27 -
28 size_t path_len;
29
30 char* config_home_path_name = "";
33 fix_3
44 time_t.patch
55 typo_output.patch
6 cflags.patch
7 duplicate_gnu_source.patch
8 size_t.patch
9 nested_extern.patch
10 missing_format.patch
0 Description: size_t vars need %d in printf. %*s needs int
1 Author: Tzafrir Cohen <tzafrir@debian.org>
2 --- a/examples/hcal/local_functions.c
3 +++ b/examples/hcal/local_functions.c
4 @@ -247,11 +247,11 @@ void revstr( char *source, const size_t
5
6 #define DEBUG 0
7 #if DEBUG
8 -printf("\nrevstr: entry: sourcelen = %d, source = %s\n",source_len, source);
9 +printf("\nrevstr: entry: sourcelen = %zd, source = %s\n",source_len, source);
10 #endif
11
12 if (source == NULL) {error(0,0,"revstr: source buffer pointer is NULL"); exit(0);};
13 - if (source_len <= 0) {error(0,0,"revstr: source_len parameter invalid, %d",source_len); exit(0);};
14 + if (source_len <= 0) {error(0,0,"revstr: source_len parameter invalid, %zd",source_len); exit(0);};
15
16 size_t i,j;
17 char *temp_buff;
18 @@ -272,7 +272,7 @@ printf("\nrevstr: entry: sourcelen = %d,
19 memcpy(source, temp_buff, source_len);
20 source[source_len] = '\0';
21 #if DEBUG
22 -printf("\nrevstr: before free(tempbuff): sourcelen = %d, source = %s\n",source_len, source);
23 +printf("\nrevstr: before free(tempbuff): sourcelen = %zd, source = %s\n",source_len, source);
24 #endif
25 free(temp_buff);
26 return;
27 --- a/examples/hcal/hcal.c
28 +++ b/examples/hcal/hcal.c
29 @@ -1135,7 +1135,7 @@ void print_week( int jd, const int month
30 // padding - FIXME - spaces are single-byte, while
31 // the Hebrew characters are two bytes
32 const int margin_max = 15;
33 - printf("%*s%s", (margin_max - shabbat_name_str_len/2)," ", shabbat_name_buffer);
34 + printf("%*s%s", (int) (margin_max - shabbat_name_str_len/2)," ", shabbat_name_buffer);
35
36 free(shabbat_name_buffer);
37 }
38 @@ -1344,7 +1344,7 @@ int print_month ( const int month, const
39 // padding - FIXME - spaces are single-byte, while
40 // the Hebrew characters are two bytes
41 const int margin_max = 16; // 15 fails because of jabotinsky in july
42 - printf("%*s%s\n", (margin_max - holiday_str_len/2)," ", holiday_buffer);
43 + printf("%*s%s\n", (int) (margin_max - holiday_str_len/2)," ", holiday_buffer);
44
45 free(holiday_buffer);
46 }