From 7874cdf52adcfb3fef0a528c893fe38d7054c197 Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Wed, 15 Jan 2014 15:36:50 +0100 Subject: [PATCH 1/6] Replace size_t with unsigned long. size_t is not compatible type for `%lu`. --- fish_tests.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fish_tests.cpp b/fish_tests.cpp index 6c536bca3..b7f6535b3 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -2322,14 +2322,14 @@ static void test_new_parser_fuzzing(void) double start = timef(); bool log_it = true; - size_t max_len = 5; - for (size_t len = 0; len < max_len; len++) + unsigned long max_len = 5; + for (unsigned long len = 0; len < max_len; len++) { if (log_it) fprintf(stderr, "%lu / %lu...", len, max_len); /* We wish to look at all permutations of 4 elements of 'fuzzes' (with replacement). Construct an int and keep incrementing it. */ - size_t permutation = 0; + unsigned long permutation = 0; while (string_for_permutation(fuzzes, sizeof fuzzes / sizeof *fuzzes, len, permutation++, &src)) { parse_tree_from_string(src, parse_flag_continue_after_error, &node_tree, &errors); From 3106cffb6508884058f418ef39d47356b09f50f7 Mon Sep 17 00:00:00 2001 From: David Adam Date: Mon, 13 Jan 2014 17:14:24 +0800 Subject: [PATCH 2/6] Makefile/tests: use return values to communicate errors --- Makefile.in | 3 ++- tests/test.fish | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index 31b23d5ef..50b73522b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -302,7 +302,8 @@ doc/refman.pdf: doc # test: $(PROGRAMS) fish_tests - ./fish_tests; cd tests; ../fish Date: Mon, 13 Jan 2014 22:35:38 +0800 Subject: [PATCH 3/6] fish_tests.cpp: set return value if tests fail --- fish_tests.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fish_tests.cpp b/fish_tests.cpp index b7f6535b3..8b08365b9 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -2815,4 +2815,7 @@ int main(int argc, char **argv) event_destroy(); proc_destroy(); + if(err_count != 0) { + return(1); + } } From bd313b0b3d6ea2eb3af532eace358d06d8f44f0d Mon Sep 17 00:00:00 2001 From: David Adam Date: Wed, 15 Jan 2014 16:18:12 +0800 Subject: [PATCH 4/6] configure/Makefile: remove unused variables and unneeded declarations --- Makefile.in | 3 --- configure.ac | 38 -------------------------------------- 2 files changed, 41 deletions(-) diff --git a/Makefile.in b/Makefile.in index 50b73522b..c016d9f7a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,7 +47,6 @@ mandir = @mandir@ sysconfdir = @sysconfdir@ docdir = @docdir@ localedir = @localedir@ -optbindirs = @optbindirs@ # # Various flags @@ -377,8 +376,6 @@ doc.h: $(HDR_FILES) -e "s,@docdir\@,$(docdir),g" \ -e "s|@configure_input\@|$@, generated from $@.in by the Makefile. DO NOT MANUALLY EDIT THIS FILE!|g" \ -e "s,@prefix\@,$(prefix),g" \ - -e "s,@optbindirs\@,$(optbindirs),g" -#-e "s,@\@,$()," # diff --git a/configure.ac b/configure.ac index 5cc31af61..9eda25a6b 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,6 @@ conf_arg=$@ # List of output variables produced by this configure script # -AC_SUBST(docdir) AC_SUBST(HAVE_GETTEXT) AC_SUBST(HAVE_DOXYGEN) AC_SUBST(LDFLAGS_FISH) @@ -30,9 +29,6 @@ AC_SUBST(LIBS_FISH_INDENT) AC_SUBST(LIBS_FISH_PAGER) AC_SUBST(LIBS_FISHD) AC_SUBST(LIBS_MIMEDB) -AC_SUBST(localedir) -AC_SUBST(optbindirs) -AC_SUBST(prefix) # @@ -381,40 +377,6 @@ case $target_os in esac -# -# Set up PREFIX and related preprocessor symbols. Fish needs to know -# where it will be installed. One of the reasons for this is so that -# it can make sure the fish installation directory is in the path -# during startup. -# - -if [[ "$prefix" = NONE ]]; then - prefix=/usr/local -fi - - -# -# Set up the directory where the documentation files should be -# installed -# - -AC_ARG_VAR( [docdir], [Documentation directory] ) - -if test -z $docdir; then - docdir=$datadir/doc/fish -else - docdir=$docdir -fi - - -# -# Set up locale directory. This is where the .po files will be -# installed. -# - -localedir=$datadir/locale - - # # See if Linux procfs is present. This is used to get extra # information about running processes. From 8e77aca854f3b4aa28fbd5c6a190988a35c8918a Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 15 Jan 2014 23:33:34 -0800 Subject: [PATCH 5/6] Fix for recent issue where random text might appear underlined. --- highlight.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highlight.cpp b/highlight.cpp index a988ad9fe..4fe2a5ba9 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -359,7 +359,7 @@ rgb_color_t highlight_get_color(highlight_spec_t highlight, bool is_background) size_t idx = highlight_get_primary(highlight); if (idx >= VAR_COUNT) { - idx = 0; + return rgb_color_t::normal(); } env_var_t val_wstr = env_get_string(highlight_var[idx]); From b758c0c335ad9d504d7a76baa5a331e9abf0ede5 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 17 Jan 2014 14:18:45 -0800 Subject: [PATCH 6/6] Relax the requirement that we find a working 'doc' directory in order for fish to be relocatable. Instead we only look for data and configuration path --- fish.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fish.cpp b/fish.cpp index 57d268d72..77686195a 100644 --- a/fish.cpp +++ b/fish.cpp @@ -187,11 +187,16 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0) paths.sysconf = base_path + L"/etc/fish"; paths.doc = base_path + L"/share/doc/fish"; paths.bin = base_path + L"/bin"; - + + /* Check only that the data and sysconf directories exist. Handle the doc directories separately */ struct stat buf; - if (0 == wstat(paths.data, &buf) && 0 == wstat(paths.sysconf, &buf) && - 0 == wstat(paths.doc, &buf)) + if (0 == wstat(paths.data, &buf) && 0 == wstat(paths.sysconf, &buf)) { + /* The docs dir may not exist; in that case fall back to the compiled in path */ + if (0 != wstat(paths.doc, &buf)) + { + paths.doc = L"" DOCDIR; + } done = true; } }