import cscope-15.9-15.el9

This commit is contained in:
CentOS Sources 2022-11-15 01:35:03 -05:00 committed by Stepan Oksanichenko
parent 6cef0ed293
commit a901a228b5
5 changed files with 520 additions and 33 deletions

View File

@ -0,0 +1,26 @@
diff -up ./src/egrep.c.coverity2 ./src/egrep.c
--- ./src/egrep.c.coverity2 2018-10-11 15:22:40.481384312 -0400
+++ ./src/egrep.c 2018-10-11 15:23:31.152211589 -0400
@@ -1205,6 +1205,7 @@ yyparse (void)
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
+ /* coverity[leaked_storage] */
}
# endif
#endif /* no yyoverflow */
diff -up ./src/logdir.c.coverity2 ./src/logdir.c
--- ./src/logdir.c.coverity2 2018-10-11 15:23:50.009147309 -0400
+++ ./src/logdir.c 2018-10-11 15:24:26.279023664 -0400
@@ -79,8 +79,10 @@ logdir(char *name)
if (line[j] == '\n')
break;
/* return a null pointer if the whole file has been read */
- if (j >= i)
+ if (j >= i) {
+ (void) close(pwf);
return(0);
+ }
line[++j] = 0; /* terminate the line */
(void) lseek(pwf, (long) (j - i), 1); /* point at the next line */
p = nextfield(line); /* get the logname */

View File

@ -0,0 +1,52 @@
diff -up ./contrib/xcscope/cscope-indexer.help ./contrib/xcscope/cscope-indexer
--- ./contrib/xcscope/cscope-indexer.help 2017-12-07 10:45:07.000000000 -0500
+++ ./contrib/xcscope/cscope-indexer 2019-06-24 15:46:31.484852474 -0400
@@ -80,6 +80,37 @@ RECURSE=
VERBOSE=
export DIR RECURSE # Need to pass these to subprocesses
+show_usage() {
+
+cat << EOF
+
+ cscope-indexer [ -v ] [-f database_file ] [-i list_file ] [ -l ] [ -r ]
+
+ where:
+
+ -f database_file
+ Specifies the cscope database file (default: cscope.out).
+
+ -i list_file
+ Specifies the name of the file into which the list of files
+ to index is placed (default: cscope.files).
+
+ -l
+ Suppress the generation/updating of the cscope database
+ file. Only a list of files is generated.
+
+ -r
+ Recurse into subdirectories to locate files to index.
+ Without this option, only the current directory is
+ searched.
+
+ -v
+ Be verbose. Output simple progress messages.
+
+EOF
+
+}
+
while [ -n "$1" ]
do
case "$1" in
@@ -110,6 +141,10 @@ do
-v)
VERBOSE=1
;;
+ -h|--help)
+ show_usage
+ exit 0
+ ;;
*)
DIR="$1"
;;

View File

@ -0,0 +1,385 @@
commit efc92106173b5130e32587f6c788f19f2477051d
Author: Neil Horman <nhorman@tuxdriver.com>
Date: Fri Jul 27 15:52:49 2018 -0400
Add make check test harness
Start adding tests to self test cscope in travis ci
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
diff --git a/Makefile.am b/Makefile.am
index ae0fc53..d79d44e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = doc src contrib
+SUBDIRS = doc src contrib tests
EXTRA_DIST = INSTALL.gnu packages
diff --git a/configure.in b/configure.in
index c51887d..e0a8b1f 100644
--- a/configure.in
+++ b/configure.in
@@ -415,5 +415,5 @@ case "$host_os" in
;;
esac
-AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile])
+AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile tests/Makefile])
AC_OUTPUT
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..2278a71
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,7 @@
+check_SCRIPTS = check0.sh check1.sh check2.sh \
+ check3.sh check4.sh check6.sh \
+ check7.sh check8.sh check9.sh
+
+TESTS = check0.sh check1.sh check2.sh \
+ check3.sh check4.sh check6.sh \
+ check7.sh check8.sh check9.sh
diff --git a/tests/check0.sh b/tests/check0.sh
new file mode 100755
index 0000000..6c6883b
--- /dev/null
+++ b/tests/check0.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+EXPECT=4
+SINDEX=0
+STERM=main
+STYPE="find C symbol"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+#Count the number of instances of the string 'Copyright'
+#We expect 178 currently
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check1.sh b/tests/check1.sh
new file mode 100755
index 0000000..78ffe21
--- /dev/null
+++ b/tests/check1.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+EXPECT=3
+SINDEX=1
+STERM=main
+STYPE="symbol definition"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+#Count the number of instances of the string 'Copyright'
+#We expect 178 currently
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check2.sh b/tests/check2.sh
new file mode 100755
index 0000000..414430a
--- /dev/null
+++ b/tests/check2.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+EXPECT=96
+SINDEX=2
+STERM=build
+STYPE="functions called by"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check3.sh b/tests/check3.sh
new file mode 100755
index 0000000..a6b2c7e
--- /dev/null
+++ b/tests/check3.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+EXPECT=35
+SINDEX=3
+STERM=printf
+STYPE="functions calling"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+#We expect 178 currently
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check4.sh b/tests/check4.sh
new file mode 100755
index 0000000..dd2c98c
--- /dev/null
+++ b/tests/check4.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+EXPECT=3
+SINDEX=4
+STERM=oldsigquit
+STYPE="regular text string"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check6.sh b/tests/check6.sh
new file mode 100755
index 0000000..c664960
--- /dev/null
+++ b/tests/check6.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+EXPECT=1
+SINDEX=6
+STERM=msg.*what
+STYPE="egrep string"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+#Count the number of instances of the string 'Copyright'
+#We expect 178 currently
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check7.sh b/tests/check7.sh
new file mode 100755
index 0000000..5ac965c
--- /dev/null
+++ b/tests/check7.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+EXPECT=1
+SINDEX=7
+STERM=main.c
+STYPE="file named"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+#Count the number of instances of the string 'Copyright'
+#We expect 178 currently
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check8.sh b/tests/check8.sh
new file mode 100755
index 0000000..72cb946
--- /dev/null
+++ b/tests/check8.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+EXPECT=8
+SINDEX=8
+STERM=unistd.h
+STYPE="files including this file"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+#Count the number of instances of the string 'Copyright'
+#We expect 178 currently
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
diff --git a/tests/check9.sh b/tests/check9.sh
new file mode 100755
index 0000000..a728a32
--- /dev/null
+++ b/tests/check9.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+EXPECT=2
+SINDEX=9
+STERM=reftime
+STYPE="assignments to symbol"
+
+if [ -z "$CSCOPE_BINARY" ]
+then
+ CSCOPE_BINARY=./src/cscope
+fi
+
+echo "Searching item $SINDEX, '$STYPE', '$STERM'"
+
+#Get to the top level directory
+cd ..
+
+#Remove any previous databases from testing
+rm -f cscope.out
+
+#Count the number of instances of the string 'Copyright'
+#We expect 178 currently
+COUNT=$($CSCOPE_BINARY -R -L -k -$SINDEX$STERM | wc -l)
+
+if [ $COUNT -ne $EXPECT ]
+then
+ echo "Expected $EXPECT instances of $STYPE $STERM but found $COUNT"
+ exit 1
+fi
+
+exit 0
+
--
2.35.1

View File

@ -0,0 +1,16 @@
diff --git a/contrib/ocs b/contrib/ocs
index e924f4f..bd556b4 100755
--- a/contrib/ocs
+++ b/contrib/ocs
@@ -210,7 +210,7 @@ exp_inc()
then
for i in `cat ${theInc}`
do
- printf "-I $i "
+ printf -- "-I $i "
done
fi
}
--
2.26.2

View File

@ -1,20 +1,18 @@
Summary: C source code tree search and browse tool
Summary: C source code tree search and browse tool
Name: cscope
Version: 15.9
Release: 12%{?dist}
Release: 15%{?dist}
Source0: https://downloads.sourceforge.net/project/%{name}/%{name}/v%{version}/%{name}-%{version}.tar.gz
URL: http://cscope.sourceforge.net
License: BSD and GPLv2+
BuildRequires: gcc
BuildRequires: pkgconfig ncurses-devel flex bison m4
BuildRequires: autoconf automake
BuildRequires: make
Requires: emacs-filesystem coreutils
Requires: ed
%if !0%{?rhel}
BuildRequires: pkgconf-pkg-config ncurses-devel gcc flex bison m4
BuildRequires: autoconf automake make
Requires: emacs-filesystem coreutils ed
%if !0%{?rhel} && 0%{?fedora} < 36
Requires: xemacs-filesystem
%endif
# upstream commits from https://sourceforge.net/p/cscope/cscope/commit_browser
Patch1: cscope-1-modified-from-patch-81-Fix-reading-include-files-in-.patch
Patch2: cscope-2-Cull-extraneous-declaration.patch
Patch3: cscope-3-Avoid-putting-directories-found-during-header-search.patch
@ -23,40 +21,42 @@ Patch5: cscope-5-contrib-ocs-Fix-bashims-Closes-480591.patch
Patch6: cscope-6-doc-cscope.1-Fix-hyphens.patch
Patch7: cscope-7-fscanner-swallow-function-as-parameters.patch
Patch8: cscope-8-emacs-plugin-fixup-GNU-Emacs-27.1-removes-function-p.patch
# distrubution patches which were not upstreamed
Patch9: dist-1-coverity-fixes.patch
Patch10: dist-2-cscope-indexer-help.patch
Patch11: dist-3-add-selftests.patch
Patch12: dist-4-fix-printf.patch
%define cscope_share_path %{_datadir}/cscope
%if !0%{?rhel} && 0%{?fedora} < 36
%define xemacs_lisp_path %{_datadir}/xemacs/site-packages/lisp
%else
%define xemacs_lisp_path %nil
%endif
%define emacs_lisp_path %{_datadir}/emacs/site-lisp
%define vim_plugin_path %{_datadir}/vim/vimfiles/plugin
%description
cscope is a mature, ncurses based, C source code tree browsing tool. It
cscope is a mature, ncurses based, C source code tree browsing tool. It
allows users to search large source code bases for variables, functions,
macros, etc, as well as perform general regex and plain text searches.
Results are returned in lists, from which the user can select individual
macros, etc, as well as perform general regex and plain text searches.
Results are returned in lists, from which the user can select individual
matches for use in file editing.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
autoreconf
%autosetup -p1
%build
aclocal
autoheader
autoconf
automake --add-missing
%configure
make
%install
rm -rf $RPM_BUILD_ROOT %{name}-%{version}.files
make DESTDIR=$RPM_BUILD_ROOT install
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT/var/lib/cs
mkdir -p $RPM_BUILD_ROOT%{cscope_share_path}
cp -a contrib/xcscope/xcscope.el $RPM_BUILD_ROOT%{cscope_share_path}
@ -69,7 +69,8 @@ for dir in %{xemacs_lisp_path} %{emacs_lisp_path} ; do
echo "%ghost $dir/xcscope.el*" >> %{name}-%{version}.files
done
%check
make check
%files -f %{name}-%{version}.files
%{_bindir}/*
@ -79,7 +80,7 @@ done
%dir /var/lib/cs
%doc AUTHORS COPYING ChangeLog README TODO contrib/cctree.txt
%if !0%{?rhel}
%if !0%{?rhel} && 0%{?fedora} < 36
%triggerin -- xemacs
ln -sf %{cscope_share_path}/xcscope.el %{xemacs_lisp_path}/xcscope.el
%endif
@ -90,7 +91,7 @@ ln -sf %{cscope_share_path}/xcscope.el %{emacs_lisp_path}/xcscope.el
%triggerin -- vim-filesystem
ln -sf %{cscope_share_path}/cctree.vim %{vim_plugin_path}/cctree.vim
%if !0%{?rhel}
%if !0%{?rhel} && 0%{?fedora} < 36
%triggerun -- xemacs
[ $2 -gt 0 ] && exit 0
rm -f %{xemacs_lisp_path}/xcscope.el
@ -105,6 +106,14 @@ rm -f %{emacs_lisp_path}/xcscope.el
rm -f %{vim_plugin_path}/cctree.vim
%changelog
* Fri Apr 22 2022 Vladis Dronov <vdronov@redhat.com> - 15.9-11
- Add another small distrubution patch (bz 2072635)
* Mon Apr 11 2022 Vladis Dronov <vdronov@redhat.com> - 15.9-14
- Add distrubution patches which were not upstreamed (bz 2072635)
- Add self-tests
- Add OSCI harness
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 15.9-12
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
@ -171,8 +180,7 @@ rm -f %{vim_plugin_path}/cctree.vim
* Wed Aug 05 2015 Neil Horman <nhorman@redhat.com> - 15.8b-1
- Update to latest upstream
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> -
* 15.8-12
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 15.8-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue Sep 30 2014 Neil Horman <nhorman@redhat.com> - 15.8-11
@ -242,7 +250,7 @@ rm -f %{vim_plugin_path}/cctree.vim
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 15.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Fri Jun 12 2009 Neil Horman <nhorman@redhat.com>
* Fri Jun 12 2009 Neil Horman <nhorman@redhat.com> - 15.6-4
- Fix some buffer overflows (bz 505605)
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 15.6-3
@ -308,7 +316,7 @@ rm -f %{vim_plugin_path}/cctree.vim
* Tue Sep 28 2004 Neil Horman <nhorman@redhat.com>
- fixed inverted index bug (bz 133942)
* Mon Sep 13 2004 Frank Ch. Eigler <fche@redhat.com>
- bumped release number to a plain "1"
@ -322,7 +330,7 @@ rm -f %{vim_plugin_path}/cctree.vim
- Added upstream ocs fix
- Added feature to find symbol assignments
- Changed default SYSDIR directory to /var/lib/cs
- Incoproated M. Schwendt's fix for ocs -s
- Incoproated M. Schwendt's fix for ocs -s
* Fri Jun 18 2004 Neil Horman <nhorman@redhat.com>
- built the package