From 5d8a21904d04574221a2f2ebc3373440f7c67b87 Mon Sep 17 00:00:00 2001
From: James Youngman <jay@gnu.org>
Date: Sun, 27 Dec 2015 20:11:27 +0000
Subject: [PATCH 1/3] Remove support for installing oldfind.
To: findutils-patches@gnu.org

* NEWS: Mention this change.
* m4/withfts.m4 (FIND_WITH_FTS): --with-fts is the only supported
choice.  The configure script now fails if run using --without-fts
or --with-fts=no.
* find/Makefile.am (noinst_PROGRAMS): Never install oldfind.
Delete the oldfind.1 and ftsfind.1 manpages, leaving only find.1.
Fix a typo and remove some commented-out lines.
* find/find.c (main): add a comment pointing out that this is not
the main() function of th binary that actually gets installed.
* find/ftsfind.1: delete.
* find/oldfind.1: delete.
---
 NEWS             |  8 ++++++++
 find/Makefile.am | 34 +++++++++-------------------------
 find/find.c      |  3 ++-
 find/ftsfind.1   | 31 -------------------------------
 find/oldfind.1   | 31 -------------------------------
 m4/withfts.m4    |  9 +++++----
 6 files changed, 24 insertions(+), 92 deletions(-)
 delete mode 100644 find/ftsfind.1
 delete mode 100644 find/oldfind.1

diff --git a/NEWS b/NEWS
index fc1eb92..07d4e70 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,14 @@ GNU findutils NEWS - User visible changes.      -*- outline -*- (allout)
 
 * Major changes in release 4.5.18-git, 2015-12-DD
 
+** Changes to find
+
+Only the ftsfind binary will be installed, as "find".  Installing
+oldfind, under any name, is no longer supported.  The configure option
+--with-fts is still allowed, but trying to use it to enable the
+installation of oldfind (for example by using --with-fts=no) results
+in configure stopping with an error message.
+
 ** Translations
 
 Updated the Slovenian translation.
diff --git a/find/Makefile.am b/find/Makefile.am
index 30eba1d..67cfdfe 100644
--- a/find/Makefile.am
+++ b/find/Makefile.am
@@ -1,47 +1,31 @@
 AUTOMAKE_OPTIONS = std-options
 AM_CFLAGS = $(WARN_CFLAGS)
 localedir = $(datadir)/locale
-# noinst_PROGRAMS = regexprops
-# regexprops_SOURCES = regexprops.c
 
 noinst_LIBRARIES = libfindtools.a
 libfindtools_a_SOURCES = finddata.c fstype.c parser.c pred.c exec.c tree.c util.c sharefile.c print.c
 
-# We always build two versions of find, one with fts, one without.
-# Their names depend on whether the user specified --with-fts.
-#
-# --with-fts            find            extra binary
-#       yes             with fts        'oldfind', without fts
-#        no             without fts     'ftsfind', with fts
-#
-if WITH_FTS
-bin_PROGRAMS     = find oldfind
+# We always build two versions of find, one with fts (called "find"),
+# one without (called "oldfind").  The oldfind binary is no longer
+# installed.
+bin_PROGRAMS     = find
+noinst_PROGRAMS = oldfind
 find_SOURCES     = ftsfind.c
 oldfind_SOURCES  = find.c
-man_MANS         = find.1 oldfind.1
-else
-bin_PROGRAMS      = find ftsfind
-find_SOURCES      = find.c
-ftsfind_SOURCES   = ftsfind.c
-man_MANS          = find.1 ftsfind.1
-endif
-
-# We don't just include man_MANS in EXTRA_DIST because while the value of
-# man_MANS is not always the same, we want to distribute all of those files.
-EXTRA_DIST = defs.h sharefile.h print.h find.1 ftsfind.1 oldfind.1
+man_MANS         = find.1
+
+EXTRA_DIST = defs.h sharefile.h print.h $(man_MANS)
 AM_CPPFLAGS = -I../gl/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gl/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
 LDADD = ./libfindtools.a ../lib/libfind.a ../gl/lib/libgnulib.a $(LIBINTL) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX) $(LIB_CLOSE) $(MODF_LIBM) $(FINDLIBS) $(GETHOSTNAME_LIB) $(LIB_EACCESS)
 # gnulib advises we link against <first> because we use <second>:
 # $(GETHOSTNAME_LIB)            uname
-# $(LIB_CLOCK_GETTIME)          (some inditrect dependency)
+# $(LIB_CLOCK_GETTIME)          (some indirect dependency)
 # $(LIB_EACCESS)                faccessat
 # $(LIB_SELINUX)                selinux-h
 # $(MODF_LIBM)                  modf
 
 SUBDIRS = . testsuite
 
-#$(PROGRAMS): ../lib/libfind.a
-
 dist-hook: findutils-check-manpages
 
 # Clean coverage files generated by running binaries built with
diff --git a/find/find.c b/find/find.c
index a5530ba..c32cbc5 100644
--- a/find/find.c
+++ b/find/find.c
@@ -173,7 +173,8 @@ get_current_dirfd (void)
   return AT_FDCWD;
 }
 
-
+/* CAUTION: this is the entry point for the oldfind executable, which is not the binary that
+ * will actually get installed.   See ftsfind.c. */
 int
 main (int argc, char **argv)
 {
diff --git a/find/ftsfind.1 b/find/ftsfind.1
deleted file mode 100644
index 08a2c54..0000000
--- a/find/ftsfind.1
+++ /dev/null
@@ -1,31 +0,0 @@
-.TH FTSFIND 1 \" -*- nroff -*-
-.SH NAME
-ftsfind \- search for files in a directory hierarchy
-.SH SYNOPSIS
-.B ftsfind
-[\-H] [\-L] [\-P] [\-D debugopts] [\-Olevel] [path...] [expression]
-.SH DESCRIPTION
-The
-.B ftsfind
-and
-.B find
-programs are functionally identical.  The only difference between them
-is the implementation internals of how the filesystem is searched.
-The
-.B find
-binary has a recursive implementation while
-.B ftsfind
-uses
-.BR fts (3).
-The fts-based implementation will replace the recursive implementation
-but for the moment both implementations are installed.
-.P
-The implementation which is installed as
-.B find
-on this system is the recursive implementation, since the
-.B \-\-without\-fts
-option was passed to the
-.B configure
-script when findutils was built.
-.SH "SEE ALSO"
-\fBfind\fP(1), \fBfts\fP(3), \fBFinding Files\fP (on-line in Info, or printed).
diff --git a/find/oldfind.1 b/find/oldfind.1
deleted file mode 100644
index 2c31921..0000000
--- a/find/oldfind.1
+++ /dev/null
@@ -1,31 +0,0 @@
-.TH OLDFIND 1 \" -*- nroff -*-
-.SH NAME
-oldfind \- search for files in a directory hierarchy
-.SH SYNOPSIS
-.B oldfind
-[\-H] [\-L] [\-P] [\-D debugopts] [\-Olevel] [path...] [expression]
-.SH DESCRIPTION
-The
-.B oldfind
-and
-.B find
-programs are functionally identical.  The only difference between them
-is the implementation internals of how the filesystem is searched.
-The
-.B oldfind
-binary has a recursive implementation while
-.B find
-uses
-.BR fts (3).
-The fts-based implementation will replace the recursive implementation
-but for the moment both implementations are installed.
-.P
-The implementation which is installed as
-.B find
-on this system is the fts-based implementation, since the
-.B \-\-without\-fts
-option was not passed to the
-.B configure
-script when findutils was built.
-.SH "SEE ALSO"
-\fBfind\fP(1), \fBfts\fP(3), \fBFinding Files\fP (on-line in Info, or printed).
diff --git a/m4/withfts.m4 b/m4/withfts.m4
index 173ccf1..8fb91e3 100644
--- a/m4/withfts.m4
+++ b/m4/withfts.m4
@@ -1,13 +1,14 @@
+dnl This macro is being phased out; --with-fts is now mandatory.  The
+dnl oldfind binary is no longer installed.
 AC_DEFUN([FIND_WITH_FTS],
 [AC_ARG_WITH([fts],
 [  --without-fts           Use an older mechanism for searching the filesystem, instead of using fts()],[with_fts=$withval],[])
   case $with_fts in
-        yes|no) ;;
+        yes) ;;
         '')     with_fts=yes ;;
+	 no)	AC_MSG_ERROR([Using --without-fts is not longer supported]) ;;
         *) AC_MSG_ERROR([Invalid value for --with-fts: $with_fts])
   esac
   AM_CONDITIONAL(WITH_FTS, [[test x"${with_fts-no}" != xno]])
-  if test x"${with_fts-no}" != xno ; then
-        AC_DEFINE([WITH_FTS], 1, [Define if you want to use fts() to do the filesystem search.])
-  fi
+  AC_DEFINE([WITH_FTS], 1, [Define if you want to use fts() to do the filesystem search.])
 ])
-- 
2.1.4

