Hello community,
here is the log from the commit of package the_silver_searcher for
openSUSE:Factory checked in at 2017-07-24 12:33:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/the_silver_searcher (Old)
and /work/SRC/openSUSE:Factory/.the_silver_searcher.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "the_silver_searcher"
Mon Jul 24 12:33:19 2017 rev:11 rq:512185 version:2.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/the_silver_searcher/the_silver_searcher.changes
2017-05-27 13:18:51.499320675 +0200
+++
/work/SRC/openSUSE:Factory/.the_silver_searcher.new/the_silver_searcher.changes
2017-07-24 12:33:21.781553486 +0200
@@ -1,0 +2,12 @@
+Mon Jul 24 07:37:04 UTC 2017 - [email protected]
+
+- update to 2.0.0:
+ * Added file types: Haxe (hx), JSP tag and fragment files
+ * No longer read from .agignore, .ignore is the canonical file
+ * Add --print-all-files options to print all files searched
+ * Add support for inverting ignore rules (e.g. !blah.txt)
+ * Fix heap buffer overflow when searching an absolute path
+ bsc#1050057
+ * documentation updates
+
+-------------------------------------------------------------------
Old:
----
the_silver_searcher-1.0.3.tar.gz
the_silver_searcher-1.0.3.tar.gz.asc
New:
----
the_silver_searcher-2.0.0.tar.gz
the_silver_searcher-2.0.0.tar.gz.asc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ the_silver_searcher.spec ++++++
--- /var/tmp/diff_new_pack.TBXrBA/_old 2017-07-24 12:33:22.609436620 +0200
+++ /var/tmp/diff_new_pack.TBXrBA/_new 2017-07-24 12:33:22.613436056 +0200
@@ -17,7 +17,7 @@
Name: the_silver_searcher
-Version: 1.0.3
+Version: 2.0.0
Release: 0
Summary: A code-searching tool similar to ack, but faster
License: Apache-2.0
++++++ the_silver_searcher-1.0.3.tar.gz -> the_silver_searcher-2.0.0.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/Makefile.am
new/the_silver_searcher-2.0.0/Makefile.am
--- old/the_silver_searcher-1.0.3/Makefile.am 2017-01-12 18:55:37.000000000
+0100
+++ new/the_silver_searcher-2.0.0/Makefile.am 2017-06-03 06:25:51.000000000
+0200
@@ -13,6 +13,9 @@
EXTRA_DIST = Makefile.w32 LICENSE NOTICE the_silver_searcher.spec README.md
+all:
+ @$(MAKE) ag -r
+
test: ag
cram -v tests/*.t
if HAS_CLANG_FORMAT
@@ -27,4 +30,4 @@
test_fail: ag
cram -v tests/fail/*.t
-.PHONY : all test clean
+.PHONY : all clean test test_big test_fail
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/Makefile.in
new/the_silver_searcher-2.0.0/Makefile.in
--- old/the_silver_searcher-1.0.3/Makefile.in 2017-05-03 08:34:49.000000000
+0200
+++ new/the_silver_searcher-2.0.0/Makefile.in 2017-06-04 23:28:53.000000000
+0200
@@ -948,6 +948,9 @@
.PRECIOUS: Makefile
+all:
+ @$(MAKE) ag -r
+
test: ag
cram -v tests/*.t
@HAS_CLANG_FORMAT_TRUE@ CLANG_FORMAT=${CLANG_FORMAT} ./format.sh test
@@ -959,7 +962,7 @@
test_fail: ag
cram -v tests/fail/*.t
-.PHONY : all test clean
+.PHONY : all clean test test_big test_fail
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/README.md
new/the_silver_searcher-2.0.0/README.md
--- old/the_silver_searcher-1.0.3/README.md 2017-01-12 18:55:41.000000000
+0100
+++ new/the_silver_searcher-2.0.0/README.md 2017-06-03 06:25:51.000000000
+0200
@@ -42,7 +42,7 @@
## Installing
-### MacOS
+### macOS
brew install the_silver_searcher
@@ -80,6 +80,10 @@
zypper install the_silver_searcher
+* CentOS:
+
+ yum install the_silver_searcher
+
* SUSE Linux Enterprise: Follow [these simple
instructions](https://software.opensuse.org/download.html?project=utilities&package=the_silver_searcher).
@@ -101,7 +105,7 @@
### Building master
1. Install dependencies (Automake, pkg-config, PCRE, LZMA):
- * MacOS:
+ * macOS:
brew install automake pkg-config pcre xz
or
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/configure
new/the_silver_searcher-2.0.0/configure
--- old/the_silver_searcher-1.0.3/configure 2017-05-03 08:34:48.000000000
+0200
+++ new/the_silver_searcher-2.0.0/configure 2017-06-04 23:26:10.000000000
+0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for the_silver_searcher 1.0.3.
+# Generated by GNU Autoconf 2.69 for the_silver_searcher 2.0.0.
#
# Report bugs to <https://github.com/ggreer/the_silver_searcher/issues>.
#
@@ -581,8 +581,8 @@
# Identity of this package.
PACKAGE_NAME='the_silver_searcher'
PACKAGE_TARNAME='the_silver_searcher'
-PACKAGE_VERSION='1.0.3'
-PACKAGE_STRING='the_silver_searcher 1.0.3'
+PACKAGE_VERSION='2.0.0'
+PACKAGE_STRING='the_silver_searcher 2.0.0'
PACKAGE_BUGREPORT='https://github.com/ggreer/the_silver_searcher/issues'
PACKAGE_URL='https://github.com/ggreer/the_silver_searcher'
@@ -632,7 +632,6 @@
LZMA_LIBS
LZMA_CFLAGS
EGREP
-GREP
CPP
PTHREAD_CFLAGS
PTHREAD_LIBS
@@ -651,6 +650,7 @@
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
+GREP
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
@@ -1297,7 +1297,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures the_silver_searcher 1.0.3 to adapt to many kinds of
systems.
+\`configure' configures the_silver_searcher 2.0.0 to adapt to many kinds of
systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1368,7 +1368,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of the_silver_searcher 1.0.3:";;
+ short | recursive ) echo "Configuration of the_silver_searcher 2.0.0:";;
esac
cat <<\_ACEOF
@@ -1471,7 +1471,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-the_silver_searcher configure 1.0.3
+the_silver_searcher configure 2.0.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1943,7 +1943,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by the_silver_searcher $as_me 1.0.3, which was
+It was created by the_silver_searcher $as_me 2.0.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2807,7 +2807,7 @@
# Define the identity of the package.
PACKAGE='the_silver_searcher'
- VERSION='1.0.3'
+ VERSION='2.0.0'
# Some tools Automake needs.
@@ -3933,6 +3933,69 @@
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long
lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl"
>"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in
$PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
# Check whether --enable-silent-rules was given.
if test "${enable_silent_rules+set}" = set; then :
@@ -4502,69 +4565,6 @@
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long
lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -z "$GREP"; then
- ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl"
>"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_GREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- as_fn_error $? "no acceptable grep could be found in
$PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
@@ -5216,7 +5216,12 @@
# Run CFLAGS="-pg" ./configure if you want debug symbols
-CFLAGS="$CFLAGS $PTHREAD_CFLAGS $PCRE_CFLAGS -Wall -Wextra -Wformat=2
-Wno-format-nonliteral -Wshadow -Wpointer-arith -Wcast-qual
-Wmissing-prototypes -Wno-missing-braces -std=gnu89 -D_GNU_SOURCE -O2"
+if test "`$GREP -c '\b-O' >/dev/null ; echo $?`" = "0" ; then
+ CFLAGS="$CFLAGS -O2"
+fi
+
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS $PCRE_CFLAGS -Wall -Wextra -Wformat=2
-Wno-format-nonliteral -Wshadow"
+CFLAGS="$CFLAGS -Wpointer-arith -Wcast-qual -Wmissing-prototypes
-Wno-missing-braces -std=gnu89 -D_GNU_SOURCE"
LDFLAGS="$LDFLAGS"
case $host in
@@ -6107,7 +6112,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by the_silver_searcher $as_me 1.0.3, which was
+This file was extended by the_silver_searcher $as_me 2.0.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6174,7 +6179,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //;
s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-the_silver_searcher config.status 1.0.3
+the_silver_searcher config.status 2.0.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/configure.ac
new/the_silver_searcher-2.0.0/configure.ac
--- old/the_silver_searcher-1.0.3/configure.ac 2017-05-03 08:34:34.000000000
+0200
+++ new/the_silver_searcher-2.0.0/configure.ac 2017-06-04 23:25:51.000000000
+0200
@@ -1,6 +1,6 @@
AC_INIT(
[the_silver_searcher],
- [1.0.3],
+ [2.0.0],
[https://github.com/ggreer/the_silver_searcher/issues],
[the_silver_searcher],
[https://github.com/ggreer/the_silver_searcher])
@@ -10,6 +10,7 @@
AC_PROG_CC
AM_PROG_CC_C_O
AC_PREREQ([2.59])
+AC_PROG_GREP
m4_ifdef(
[AM_SILENT_RULES],
@@ -24,7 +25,12 @@
)
# Run CFLAGS="-pg" ./configure if you want debug symbols
-CFLAGS="$CFLAGS $PTHREAD_CFLAGS $PCRE_CFLAGS -Wall -Wextra -Wformat=2
-Wno-format-nonliteral -Wshadow -Wpointer-arith -Wcast-qual
-Wmissing-prototypes -Wno-missing-braces -std=gnu89 -D_GNU_SOURCE -O2"
+if test "`$GREP -c '\b-O' >/dev/null ; echo $?`" = "0" ; then
+ CFLAGS="$CFLAGS -O2"
+fi
+
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS $PCRE_CFLAGS -Wall -Wextra -Wformat=2
-Wno-format-nonliteral -Wshadow"
+CFLAGS="$CFLAGS -Wpointer-arith -Wcast-qual -Wmissing-prototypes
-Wno-missing-braces -std=gnu89 -D_GNU_SOURCE"
LDFLAGS="$LDFLAGS"
case $host in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/ignore.c
new/the_silver_searcher-2.0.0/src/ignore.c
--- old/the_silver_searcher-1.0.3/src/ignore.c 2017-01-24 06:47:50.000000000
+0100
+++ new/the_silver_searcher-2.0.0/src/ignore.c 2017-06-04 06:59:57.000000000
+0200
@@ -30,8 +30,6 @@
/* Warning: changing the first two strings will break skip_vcs_ignores. */
const char *ignore_pattern_files[] = {
- /* Warning: .agignore will one day be removed in favor of .ignore */
- ".agignore",
".ignore",
".gitignore",
".git/info/exclude",
@@ -53,6 +51,8 @@
ig->slash_names_len = 0;
ig->regexes = NULL;
ig->regexes_len = 0;
+ ig->invert_regexes = NULL;
+ ig->invert_regexes_len = 0;
ig->slash_regexes = NULL;
ig->slash_regexes_len = 0;
ig->dirname = dirname;
@@ -86,6 +86,7 @@
free_strings(ig->names, ig->names_len);
free_strings(ig->slash_names, ig->slash_names_len);
free_strings(ig->regexes, ig->regexes_len);
+ free_strings(ig->invert_regexes, ig->invert_regexes_len);
free_strings(ig->slash_regexes, ig->slash_regexes_len);
if (ig->abs_path) {
free(ig->abs_path);
@@ -127,6 +128,11 @@
patterns_len = &(ig->slash_regexes_len);
pattern++;
pattern_len--;
+ } else if (pattern[0] == '!') {
+ patterns_p = &(ig->invert_regexes);
+ patterns_len = &(ig->invert_regexes_len);
+ pattern++;
+ pattern_len--;
} else {
patterns_p = &(ig->regexes);
patterns_len = &(ig->regexes_len);
@@ -253,6 +259,15 @@
}
}
+ for (i = 0; i < ig->invert_regexes_len; i++) {
+ if (fnmatch(ig->invert_regexes[i], filename, fnmatch_flags) == 0) {
+ log_debug("file %s not ignored because name matches regex pattern
!%s", filename, ig->invert_regexes[i]);
+ free(temp);
+ return 0;
+ }
+ log_debug("pattern !%s doesn't match file %s", ig->invert_regexes[i],
filename);
+ }
+
for (i = 0; i < ig->regexes_len; i++) {
if (fnmatch(ig->regexes[i], filename, fnmatch_flags) == 0) {
log_debug("file %s ignored because name matches regex pattern %s",
filename, ig->regexes[i]);
@@ -296,15 +311,7 @@
}
scandir_baton_t *scandir_baton = (scandir_baton_t *)baton;
- const char *base_path = scandir_baton->base_path;
- const size_t base_path_len = scandir_baton->base_path_len;
- const char *path_start = path;
-
- for (i = 0; base_path[i] == path[i] && i < base_path_len; i++) {
- /* base_path always ends with "/\0" while path doesn't, so this is
safe */
- path_start = path + i + 2;
- }
- log_debug("path_start %s filename %s", path_start, filename);
+ const char *path_start = scandir_baton->path_start;
const char *extension = strchr(filename, '.');
if (extension) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/ignore.h
new/the_silver_searcher-2.0.0/src/ignore.h
--- old/the_silver_searcher-1.0.3/src/ignore.h 2017-01-12 18:55:41.000000000
+0100
+++ new/the_silver_searcher-2.0.0/src/ignore.h 2017-06-04 02:06:15.000000000
+0200
@@ -15,6 +15,8 @@
char **regexes; /* For patterns that need fnmatch */
size_t regexes_len;
+ char **invert_regexes; /* For "!" patterns */
+ size_t invert_regexes_len;
char **slash_regexes;
size_t slash_regexes_len;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/lang.c
new/the_silver_searcher-2.0.0/src/lang.c
--- old/the_silver_searcher-1.0.3/src/lang.c 2017-05-03 08:21:18.000000000
+0200
+++ new/the_silver_searcher-2.0.0/src/lang.c 2017-06-03 06:25:51.000000000
+0200
@@ -36,6 +36,7 @@
{ "groovy", { "groovy", "gtmpl", "gpp", "grunit", "gradle" } },
{ "haml", { "haml" } },
{ "haskell", { "hs", "lhs" } },
+ { "haxe", { "hx" } },
{ "hh", { "h" } },
{ "html", { "htm", "html", "shtml", "xhtml" } },
{ "ini", { "ini" } },
@@ -43,7 +44,7 @@
{ "java", { "java", "properties" } },
{ "js", { "es6", "js", "jsx", "vue" } },
{ "json", { "json" } },
- { "jsp", { "jsp", "jspx", "jhtm", "jhtml" } },
+ { "jsp", { "jsp", "jspx", "jhtm", "jhtml", "jspf", "tag", "tagf" } },
{ "julia", { "jl" } },
{ "kotlin", { "kt" } },
{ "less", { "less" } },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/options.c
new/the_silver_searcher-2.0.0/src/options.c
--- old/the_silver_searcher-1.0.3/src/options.c 2017-05-03 08:21:18.000000000
+0200
+++ new/the_silver_searcher-2.0.0/src/options.c 2017-06-04 23:06:19.000000000
+0200
@@ -63,6 +63,8 @@
(don't print the matching lines)\n\
-L --files-without-matches\n\
Only print filenames that don't contain matches\n\
+ --print-all-files Print headings for all files searched, even those
that\n\
+ don't contain matches\n\
--[no]numbers Print line numbers. Default is to omit line
numbers\n\
when searching streams\n\
-o --only-matching Prints only the matching part of the lines\n\
@@ -158,6 +160,7 @@
opts.path_sep = '\n';
opts.print_break = TRUE;
opts.print_path = PATH_PRINT_DEFAULT;
+ opts.print_all_paths = FALSE;
opts.print_line_numbers = TRUE;
opts.recurse_dirs = TRUE;
opts.color_path = ag_strdup(color_path);
@@ -200,6 +203,7 @@
int ch;
size_t i;
int path_len = 0;
+ int base_path_len = 0;
int useless = 0;
int group = 1;
int help = 0;
@@ -304,6 +308,7 @@
{ "passthru", no_argument, &opts.passthrough, 1 },
{ "path-to-ignore", required_argument, NULL, 'p' },
{ "print0", no_argument, NULL, '0' },
+ { "print-all-files", no_argument, NULL, 0 },
{ "print-long-lines", no_argument, &opts.print_long_lines, 1 },
{ "recurse", no_argument, NULL, 'r' },
{ "search-binary", no_argument, &opts.search_binary_files, 1 },
@@ -539,6 +544,9 @@
} else if (strcmp(longopts[opt_index].name, "pager") == 0) {
opts.pager = optarg;
break;
+ } else if (strcmp(longopts[opt_index].name, "print-all-files")
== 0) {
+ opts.print_all_paths = TRUE;
+ break;
} else if (strcmp(longopts[opt_index].name, "workers") == 0) {
opts.workers = atoi(optarg);
break;
@@ -755,8 +763,13 @@
}
if (accepts_query && argc > 0) {
- // use the provided query
- opts.query = ag_strdup(argv[0]);
+ if (!needs_query && strlen(argv[0]) == 0) {
+ // use default query
+ opts.query = ag_strdup(".");
+ } else {
+ // use the provided query
+ opts.query = ag_strdup(argv[0]);
+ }
argc--;
argv++;
} else if (!needs_query) {
@@ -777,6 +790,7 @@
}
char *path = NULL;
+ char *base_path = NULL;
#ifdef PATH_MAX
char *tmp = NULL;
#endif
@@ -794,10 +808,20 @@
(*paths)[i] = path;
#ifdef PATH_MAX
tmp = ag_malloc(PATH_MAX);
- (*base_paths)[i] = realpath(path, tmp);
+ base_path = realpath(path, tmp);
#else
- (*base_paths)[i] = realpath(path, NULL);
+ base_path = realpath(path, NULL);
#endif
+ if (base_path) {
+ base_path_len = strlen(base_path);
+ /* add trailing slash */
+ if (base_path_len > 1 && base_path[base_path_len - 1] != '/') {
+ base_path = ag_realloc(base_path, base_path_len + 2);
+ base_path[base_path_len] = '/';
+ base_path[base_path_len + 1] = '\0';
+ }
+ }
+ (*base_paths)[i] = base_path;
}
/* Make sure we search these paths instead of stdin. */
opts.search_stream = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/options.h
new/the_silver_searcher-2.0.0/src/options.h
--- old/the_silver_searcher-1.0.3/src/options.h 2017-01-12 18:55:34.000000000
+0100
+++ new/the_silver_searcher-2.0.0/src/options.h 2017-06-04 23:06:19.000000000
+0200
@@ -61,6 +61,7 @@
int print_count;
int print_filename_only;
int print_path;
+ int print_all_paths;
int print_line_numbers;
int print_long_lines; /* TODO: support this in print.c */
int passthrough;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/print.c
new/the_silver_searcher-2.0.0/src/print.c
--- old/the_silver_searcher-1.0.3/src/print.c 2017-01-12 18:55:35.000000000
+0100
+++ new/the_silver_searcher-2.0.0/src/print.c 2017-05-28 08:07:40.000000000
+0200
@@ -26,6 +26,7 @@
size_t prev_line;
size_t last_prev_line;
size_t prev_line_offset;
+ size_t line_preceding_current_match_offset;
size_t lines_since_last_match;
size_t last_printed_match;
int in_a_match;
@@ -41,6 +42,7 @@
print_context.prev_line = 0;
print_context.last_prev_line = 0;
print_context.prev_line_offset = 0;
+ print_context.line_preceding_current_match_offset = 0;
print_context.lines_since_last_match = INT_MAX;
print_context.last_printed_match = 0;
print_context.in_a_match = FALSE;
@@ -222,14 +224,10 @@
/* print headers for ackmate to parse */
print_line_number(print_context.line, ';');
for (; print_context.last_printed_match < cur_match;
print_context.last_printed_match++) {
- /* Don't print negative offsets. This isn't quite
right, but not many people use --ackmate */
- long start =
(long)(matches[print_context.last_printed_match].start -
print_context.prev_line_offset);
- if (start < 0) {
- start = 0;
- }
- fprintf(out_fd, "%li %li",
+ size_t start =
matches[print_context.last_printed_match].start -
print_context.line_preceding_current_match_offset;
+ fprintf(out_fd, "%lu %lu",
start,
-
(long)(matches[print_context.last_printed_match].end -
matches[print_context.last_printed_match].start));
+ matches[print_context.last_printed_match].end
- matches[print_context.last_printed_match].start);
print_context.last_printed_match == cur_match - 1 ?
fputc(':', out_fd) : fputc(',', out_fd);
}
print_line(buf, i, print_context.prev_line_offset);
@@ -316,6 +314,9 @@
print_trailing_context(path, &buf[print_context.prev_line_offset],
i - print_context.prev_line_offset);
print_context.prev_line_offset = i + 1; /* skip the newline */
+ if (!print_context.in_a_match) {
+ print_context.line_preceding_current_match_offset = i + 1;
+ }
/* File doesn't end with a newline. Print one so the output is
pretty. */
if (i == buf_len && buf[i - 1] != '\n') {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/scandir.h
new/the_silver_searcher-2.0.0/src/scandir.h
--- old/the_silver_searcher-1.0.3/src/scandir.h 2017-01-12 18:55:40.000000000
+0100
+++ new/the_silver_searcher-2.0.0/src/scandir.h 2017-06-04 06:59:57.000000000
+0200
@@ -7,6 +7,7 @@
const ignores *ig;
const char *base_path;
size_t base_path_len;
+ const char *path_start;
} scandir_baton_t;
typedef int (*filter_fp)(const char *path, const struct dirent *, void *);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/search.c
new/the_silver_searcher-2.0.0/src/search.c
--- old/the_silver_searcher-1.0.3/src/search.c 2017-05-03 08:34:17.000000000
+0200
+++ new/the_silver_searcher-2.0.0/src/search.c 2017-06-04 23:06:19.000000000
+0200
@@ -174,7 +174,7 @@
pthread_mutex_unlock(&stats_mtx);
}
- if (matches_len > 0) {
+ if (matches_len > 0 || opts.print_all_paths) {
if (binary == -1 && !opts.print_filename_only) {
binary = is_binary((const void *)buf, buf_len);
}
@@ -484,6 +484,8 @@
struct dirent *dir = NULL;
scandir_baton_t scandir_baton;
int results = 0;
+ size_t base_path_len = 0;
+ const char *path_start = path;
char *dir_full_path = NULL;
const char *ignore_file = NULL;
@@ -499,7 +501,7 @@
}
/* find .*ignore files to load ignore patterns from */
- for (i = 0; opts.skip_vcs_ignores ? (i <= 1) : (ignore_pattern_files[i] !=
NULL); i++) {
+ for (i = 0; opts.skip_vcs_ignores ? (i == 0) : (ignore_pattern_files[i] !=
NULL); i++) {
ignore_file = ignore_pattern_files[i];
ag_asprintf(&dir_full_path, "%s/%s", path, ignore_file);
load_ignore_patterns(ig, dir_full_path);
@@ -507,9 +509,20 @@
dir_full_path = NULL;
}
+ /* path_start is the part of path that isn't in base_path
+ * base_path will have a trailing '/' because we put it there in
parse_options
+ */
+ base_path_len = base_path ? strlen(base_path) : 0;
+ for (i = 0; ((size_t)i < base_path_len) && (path[i]) && (base_path[i] ==
path[i]); i++) {
+ path_start = path + i + 1;
+ }
+ log_debug("search_dir: path is '%s', base_path is '%s', path_start is
'%s'", path, base_path, path_start);
+
scandir_baton.ig = ig;
scandir_baton.base_path = base_path;
- scandir_baton.base_path_len = base_path ? strlen(base_path) : 0;
+ scandir_baton.base_path_len = base_path_len;
+ scandir_baton.path_start = path_start;
+
results = ag_scandir(path, &dir_list, &filename_filter, &scandir_baton);
if (results == 0) {
log_debug("No results found in directory %s", path);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/util.c
new/the_silver_searcher-2.0.0/src/util.c
--- old/the_silver_searcher-1.0.3/src/util.c 2017-05-03 08:29:10.000000000
+0200
+++ new/the_silver_searcher-2.0.0/src/util.c 2017-06-04 06:56:18.000000000
+0200
@@ -192,7 +192,9 @@
return NULL;
}
-const char *hash_strnstr(const char *s, const char *find, const size_t s_len,
const size_t f_len, uint8_t *h_table, const int case_sensitive) {
+// Clang's -fsanitize=alignment (included in -fsanitize=undefined) will flag
+// the intentional unaligned access here, so suppress it for this function
+NO_SANITIZE_ALIGNMENT const char *hash_strnstr(const char *s, const char
*find, const size_t s_len, const size_t f_len, uint8_t *h_table, const int
case_sensitive) {
if (s_len < f_len)
return NULL;
@@ -519,7 +521,11 @@
return FALSE;
}
free(full_path);
- return S_ISFIFO(s.st_mode) || S_ISSOCK(s.st_mode);
+ return S_ISFIFO(s.st_mode)
+#ifdef S_ISSOCK
+ || S_ISSOCK(s.st_mode)
+#endif
+ ;
}
void ag_asprintf(char **ret, const char *fmt, ...) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/src/util.h
new/the_silver_searcher-2.0.0/src/util.h
--- old/the_silver_searcher-1.0.3/src/util.h 2017-05-03 08:29:10.000000000
+0200
+++ new/the_silver_searcher-2.0.0/src/util.h 2017-06-04 06:57:14.000000000
+0200
@@ -24,6 +24,12 @@
#define H_SIZE (64 * 1024)
+#ifdef __clang__
+#define NO_SANITIZE_ALIGNMENT __attribute__((no_sanitize("alignment")))
+#else
+#define NO_SANITIZE_ALIGNMENT
+#endif
+
void *ag_malloc(size_t size);
void *ag_realloc(void *ptr, size_t size);
void *ag_calloc(size_t nelem, size_t elsize);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/the_silver_searcher-1.0.3/the_silver_searcher.spec
new/the_silver_searcher-2.0.0/the_silver_searcher.spec
--- old/the_silver_searcher-1.0.3/the_silver_searcher.spec 2017-05-03
08:34:57.000000000 +0200
+++ new/the_silver_searcher-2.0.0/the_silver_searcher.spec 2017-06-04
23:29:05.000000000 +0200
@@ -2,7 +2,7 @@
Name: the_silver_searcher
-Version: 1.0.3
+Version: 2.0.0
Release: 1%{?dist}
Summary: A code-searching tool similar to ack, but faster