Codebase list ohcount / 039afe7
refresh of the patches Sylvestre Ledru 6 years ago
8 changed file(s) with 96 addition(s) and 158 deletion(s). Raw diff Collapse all Expand all
0 Index: ohcount/build
1 ===================================================================
2 --- ohcount.orig/build
3 +++ ohcount/build
4 @@ -1,4 +1,5 @@
5 -#!/usr/bin/env bash
6 +#!/usr/bin/env bash
7 +set -v
8 # Build script for Ohcount.
9 # Written by Mitchell Foral. mitchell<att>caladbolg.net.
10
11 @@ -117,14 +118,18 @@ run_test_suite()
12 RUBY_HEADER_DIR=`ruby -rmkmf -e 'print RbConfig::expand(CONFIG["rubyhdrdir"])'`
13 rbconfig_arch=`ruby -rmkmf -e 'print RbConfig::expand(CONFIG["arch"])'`
14 RUBY_CONFIG_DIR="$RUBY_HEADER_DIR/$rbconfig_arch"
15 +RUBY_VERSION=`ruby -rmkmf -e 'print RbConfig::expand(CONFIG["ruby_version"])'`
16
17 build_ruby_bindings()
18 {
19 echo "Generating Ruby bindings for $arch"
20 sh -c "swig -ruby -o ruby/ohcount_wrap.c ruby/ohcount.i" || exit 1
21 mkdir -p ruby/$arch
22 + echo $cc $RB_SHARED ruby/ohcount_wrap.c $files -o ruby/$arch/$RB_SHARED_NAME \
23 + -I$RUBY_HEADER_DIR -I$RUBY_CONFIG_DIR -I/usr/include/$rbconfig_arch/ruby-$RUBY_VERSION \
24 + -lpcre -lmagic
25 sh -c "$cc $RB_SHARED ruby/ohcount_wrap.c $files -o ruby/$arch/$RB_SHARED_NAME \
26 - -I$RUBY_HEADER_DIR -I$RUBY_CONFIG_DIR \
27 + -I$RUBY_HEADER_DIR -I$RUBY_CONFIG_DIR -I/usr/include/$rbconfig_arch/ruby-$RUBY_VERSION \
28 -lpcre -lmagic" || exit 1
29 sh -c "cd test/unit/ruby && ruby ruby_test.rb" || exit 1
30 }
0 From d844bfeac7d885c45754649a8108adf58f8d0e4b Mon Sep 17 00:00:00 2001
1 From: Adrian Cornish <acornish@spotxchange.com>
2 Date: Tue, 5 Sep 2017 15:04:53 -0600
3 Subject: [PATCH] Some fixes for building on Fedora
4
5 ---
6 ruby/print_arch | 6 +++---
7 src/languages.h | 2 +-
8 src/parser.c | 2 +-
9 3 files changed, 5 insertions(+), 5 deletions(-)
10
11 Index: ohcount/ruby/print_arch
12 ===================================================================
13 --- ohcount.orig/ruby/print_arch
14 +++ ohcount/ruby/print_arch
15 @@ -3,13 +3,13 @@ require 'mkmf'
16
17 arch = RbConfig::expand(CONFIG["arch"])
18
19 -distro = if File.exist?("/etc/issue")
20 +distro = if File.exist?("/etc/os-release")
21 # this is "", "CentOS" or "Ubuntu"
22 - `cat /etc/issue`.split.first.downcase
23 + `egrep "^ID=.*" /etc/os-release`.split("=")[1].downcase
24 end
25
26 unless ["centos", nil, "ubuntu"].include? distro
27 - STDERR.puts "unhandled /etc/issue result: #{distro}"
28 + STDERR.puts "unhandled /etc/os-release result: #{distro}"
29 end
30
31 # either <arch> or <arch>_<distro> if distro is non-null
32 Index: ohcount/src/languages.h
33 ===================================================================
34 --- ohcount.orig/src/languages.h
35 +++ ohcount/src/languages.h
36 @@ -120,6 +120,6 @@
37
38 // For gperf.
39 struct LanguageMap { const char *key; const char *name; const char *nice_name; int category; };
40 -struct LanguageMap *ohcount_hash_language_from_name(register const char *str, register unsigned int len);
41 +struct LanguageMap *ohcount_hash_language_from_name(register const char *str, register size_t len);
42
43 #endif
44 Index: ohcount/src/parser.c
45 ===================================================================
46 --- ohcount.orig/src/parser.c
47 +++ ohcount/src/parser.c
48 @@ -7,7 +7,7 @@
49 #include "log.h"
50 #include "hash/parser_hash.h"
51
52 -struct ParserMap * ohcount_hash_parser_from_language (register const char *str, register unsigned int len);
53 +struct ParserMap * ohcount_hash_parser_from_language (register const char *str, register size_t len);
54
55 int ohcount_parse(SourceFile *sourcefile, int count,
56 void (*callback) (const char *, const char *, int, int,
11 Author: Jonas Genannt <jonas.genannt@capi2name.de>
22 Forwarded: not-needed
33
4 --- a/build
5 +++ b/build
6 @@ -109,7 +109,7 @@ build_test_suite()
4 Index: ohcount/build
5 ===================================================================
6 --- ohcount.orig/build
7 +++ ohcount/build
8 @@ -111,7 +111,7 @@ build_test_suite()
79 run_test_suite()
810 {
911 echo "Running test suite"
1113 + echo "disabled test suite, does not work"
1214 }
1315
14 build_ruby_bindings()
16 RUBY_HEADER_DIR=`ruby -rmkmf -e 'print RbConfig::expand(CONFIG["rubyhdrdir"])'`
+0
-58
debian/patches/fix_null_dereference.patch less more
0 From a6783afcf61f18e9f1aef3e2655b30af7501c902 Mon Sep 17 00:00:00 2001
1 From: Robin Luckey <robin@ohloh.net>
2 Date: Thu, 1 Oct 2009 14:32:16 -0700
3 Subject: [PATCH] [FIX] Avoid null dereference in disambiguate_inc()
4
5 ---
6 src/detector.c | 18 ++++++++++--------
7 test/unit/detector_test.h | 1 +
8 2 files changed, 11 insertions(+), 8 deletions(-)
9 create mode 100644 test/detect_files/empty.inc
10
11 diff --git a/src/detector.c b/src/detector.c
12 index 4d0e1f4..9b4d8d2 100644
13 --- a/src/detector.c
14 +++ b/src/detector.c
15 @@ -452,14 +452,16 @@ const char *disambiguate_in(SourceFile *sourcefile) {
16
17 const char *disambiguate_inc(SourceFile *sourcefile) {
18 char *p = ohcount_sourcefile_get_contents(sourcefile);
19 - char *eof = p + strlen(p);
20 - while (p < eof) {
21 - if (*p == '\0')
22 - return BINARY;
23 - else if (*p == '?' && strncmp(p + 1, "php", 3) == 0)
24 - return LANG_PHP;
25 - p++;
26 - }
27 + if (p) {
28 + char *eof = p + strlen(p);
29 + while (p < eof) {
30 + if (*p == '\0')
31 + return BINARY;
32 + else if (*p == '?' && strncmp(p + 1, "php", 3) == 0)
33 + return LANG_PHP;
34 + p++;
35 + }
36 + }
37 return NULL;
38 }
39
40 diff --git a/test/detect_files/empty.inc b/test/detect_files/empty.inc
41 new file mode 100644
42 index 0000000..e69de29
43 diff --git a/test/unit/detector_test.h b/test/unit/detector_test.h
44 index cd36b6d..628b6cc 100644
45 --- a/test/unit/detector_test.h
46 +++ b/test/unit/detector_test.h
47 @@ -77,6 +77,7 @@ void test_detector_detect_polyglot() {
48 ASSERT_DETECT(LANG_IDL_PVWAVE, "foo.pro");
49 ASSERT_DETECT(LANG_ASSEMBLER, "foo.z80");
50 ASSERT_DETECT(LANG_PHP, "php.inc");
51 + ASSERT_NODETECT("empty.inc");
52 ASSERT_DETECT(LANG_FSHARP, "fs1.fs");
53 }
54
55 --
56 1.7.0.1
57
+0
-53
debian/patches/fix_null_dereference_2.patch less more
0 From c0b28d67f27f6e954c93dabd71d098854896d679 Mon Sep 17 00:00:00 2001
1 From: Robin Luckey <robin@ohloh.net>
2 Date: Thu, 1 Oct 2009 15:43:42 -0700
3 Subject: [PATCH] [FIX] Null dereference error in disambiguate_in()
4
5 ---
6 src/detector.c | 3 +++
7 test/unit/detector_test.h | 4 ++++
8 2 files changed, 7 insertions(+), 0 deletions(-)
9 create mode 100644 test/detect_files/empty.in
10
11 diff --git a/src/detector.c b/src/detector.c
12 index 9b4d8d2..863b379 100644
13 --- a/src/detector.c
14 +++ b/src/detector.c
15 @@ -437,6 +437,9 @@ const char *disambiguate_in(SourceFile *sourcefile) {
16 buf[length] = '\0';
17 SourceFile *undecorated = ohcount_sourcefile_new(buf);
18 p = ohcount_sourcefile_get_contents(sourcefile);
19 + if (!p) {
20 + return NULL;
21 + }
22 // The filepath without the '.in' extension does not exist on disk. The
23 // sourcefile->diskpath field must be set incase the detector needs to run
24 // 'file -b' on the file.
25 diff --git a/test/detect_files/empty.in b/test/detect_files/empty.in
26 new file mode 100644
27 index 0000000..e69de29
28 diff --git a/test/unit/detector_test.h b/test/unit/detector_test.h
29 index 628b6cc..a26adaa 100644
30 --- a/test/unit/detector_test.h
31 +++ b/test/unit/detector_test.h
32 @@ -36,6 +36,9 @@ void test_detector_disambiguate_m() {
33 ASSERT_DETECT(LANG_OCTAVE, "foo_octave.m");
34 }
35
36 +void test_detector_disambiguate_in() {
37 + ASSERT_NODETECT("empty.in");
38 +}
39 void test_detector_disambiguate_pro() {
40 ASSERT_DETECT(LANG_IDL_PVWAVE, "foo.pro");
41 ASSERT_DETECT(LANG_MAKE, "qmake.pro");
42 @@ -119,6 +122,7 @@ void test_detector_xml_with_custom_extension() {
43 void all_detector_tests() {
44 test_detector_smalltalk();
45 test_detector_disambiguate_m();
46 + test_detector_disambiguate_in();
47 test_detector_disambiguate_pro();
48 test_detector_fortran_fixedfree();
49 test_detector_detect_polyglot();
50 --
51 1.7.0.1
52
+0
-28
debian/patches/rbconfig.patch less more
0 Index: ohcount-3.0.0/build
1 ===================================================================
2 --- ohcount-3.0.0.orig/build
3 +++ ohcount-3.0.0/build
4 @@ -114,12 +114,12 @@ run_test_suite()
5
6 build_ruby_bindings()
7 {
8 - arch=`ruby -rmkmf -e 'print Config::expand(CONFIG["arch"])'`
9 + arch=`ruby -rmkmf -e 'print RbConfig::expand(RbConfig::CONFIG["arch"])'`
10 echo "Generating Ruby bindings for $arch"
11 sh -c "swig -ruby -o ruby/ohcount_wrap.c ruby/ohcount.i" || exit 1
12 mkdir -p ruby/$arch
13 sh -c "$cc $RB_SHARED ruby/ohcount_wrap.c $files -o ruby/$arch/$RB_SHARED_NAME \
14 - -I`ruby -rmkmf -e 'print Config::expand(CONFIG["archdir"])'` \
15 + -I`ruby -rmkmf -e 'print RbConfig::expand(RbConfig::CONFIG["archdir"])'` \
16 -lpcre" || exit 1
17 sh -c "cd test/unit/ruby && ruby ruby_test.rb" || exit 1
18 }
19 @@ -156,7 +156,7 @@ then
20 rm -f src/hash/*.c
21 rm -f src/$SHARED_NAME
22 rm -f ruby/$RB_SHARED_NAME
23 - rm -rf ruby/`ruby -rmkmf -e 'print Config::expand(CONFIG["arch"])'`/*
24 + rm -rf ruby/`ruby -rmkmf -e 'print RbConfig::expand(RbConfig::CONFIG["arch"])'`/*
25 else
26 echo "Usage: build [all|ohcount|shared|tests|ruby|clean]"
27 fi
0 fix_null_dereference_2.patch
1 fix_null_dereference.patch
2 txx_support.patch
30 disabled_test_suite.patch
41 rbconfig.patch
2 conflicting-type.diff
3 build-cflags.diff
+0
-12
debian/patches/txx_support.patch less more
0 diff -Naur ohcount-3.0.0/src/hash/extensions.gperf ohcount-3.0.1/src/hash/extensions.gperf
1 --- ohcount-3.0.0/src/hash/extensions.gperf 2009-09-30 17:30:19.000000000 +0000
2 +++ ohcount-3.0.1/src/hash/extensions.gperf 2011-09-26 09:32:34.000000000 +0000
3 @@ -161,6 +161,7 @@
4 tif, BINARY
5 tiff, BINARY
6 tpl, LANG_HTML
7 +txx, LANG_CPP
8 vala, LANG_VALA
9 vb, LANG_VISUALBASIC
10 vba, LANG_VISUALBASIC
11