Debian Bug report logs - #548944
/usr/bin/find: exedir does not run from the subdirectory containing the matched file.

version graph

Package: findutils; Maintainer for findutils is Andreas Metzler <ametzler@debian.org>; Source for findutils is src:findutils (PTS, buildd, popcon).

Reported by: Jim Lebeau <jiml@ladsnet.com>

Date: Tue, 29 Sep 2009 19:12:02 UTC

Severity: normal

Tags: fixed-upstream

Found in version findutils/4.4.0-2

Fixed in version 4.5.9-1

Done: Andreas Metzler <ametzler@downhill.at.eu.org>

Bug is archived. No further changes may be made.

Forwarded to http://savannah.gnu.org/bugs/?27563

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, jiml@ladsnet.com, Andreas Metzler <ametzler@debian.org>:
Bug#548944; Package findutils. (Tue, 29 Sep 2009 19:12:05 GMT) (full text, mbox, link).


Acknowledgement sent to Jim Lebeau <jiml@ladsnet.com>:
New Bug report received and forwarded. Copy sent to jiml@ladsnet.com, Andreas Metzler <ametzler@debian.org>. (Tue, 29 Sep 2009 19:12:05 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Jim Lebeau <jiml@ladsnet.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: /usr/bin/find: exedir does not run from the subdirectory containing the matched file.
Date: Tue, 29 Sep 2009 14:08:48 -0500
Package: findutils
Version: 4.4.0-2
Severity: normal
File: /usr/bin/find



-- System Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages findutils depends on:
ii  libc6                         2.7-18     GNU C Library: Shared libraries

findutils recommends no packages.

Versions of packages findutils suggests:
ii  mlocate                       0.21.1-1   quickly find files on the filesyst

-- no debconf information

>From the manpage:
       -execdir command ;
              Like -exec, but the specified command is run from the subdirectory containing the matched file, which is not no

Debian Example
poe@lenore:/var$ find -L . -name dreary.html -exec ls {} \;
../dreary.example.com/html/dreary.html
poe@lenore:/var$ find -L . -name dreary.html -execdir ls {} \;
.././dreary.example.com/html/dreary.html
poe@lenore:/var$ find -L . -name dreary.html -exec ls  \;
dreary.example.com	   americanmouse.example.com	cbs.example.com       common	       example.zip  nowmouse.example.com	   scripts	       sdsgl.example.com
admin.example.com  best.example.com		citymice.example.com  dan.example.com  mkstops	    riveroaksmouses.example.com  sdindy.example.com  supershot.example.com
poe@lenore:/var$ find -L . -name dreary.html -execdir ls  \;
dreary.example.com	   americanmouse.example.com	cbs.example.com       common	       example.zip  nowmouse.example.com	   scripts	       sdsgl.example.com
admin.example.com  best.example.com		citymice.example.com  dan.example.com  mkstops	    riveroaksmouses.example.com  sdindy.example.com  supershot.example.com
poe@lenore:/var$ 

Centos Example
[root@lion apache-tomcat]# find -name catalina.out.1 -exec ls {} \;
../apache-tomcat-5.5.7/logs/catalina.out.1
[root@lion apache-tomcat]# find -name catalina.out.1 -execdir ls {} \;
../catalina.out.1
[root@lion apache-tomcat]# find -name catalina.out.1 -exec ls \;
apache-tomcat-5.5.7  current
[root@lion apache-tomcat]# find -name catalina.out.1 -execdir ls \;
catalina.out	    catalina.out.11.gz	catalina.out.14.gz  catalina.out.17.gz	catalina.out.20.gz  catalina.out.2.gz  catalina.out.5.gz  catalina.out.8.gz
catalina.out.1	    catalina.out.12.gz	catalina.out.15.gz  catalina.out.18.gz	catalina.out.21.gz  catalina.out.3.gz  catalina.out.6.gz  catalina.out.9.gz
catalina.out.10.gz  catalina.out.13.gz	catalina.out.16.gz  catalina.out.19.gz	catalina.out.22.gz  catalina.out.4.gz  catalina.out.7.gz

[root@lion apache-tomcat]# uname -a
Linux lion.example.com 2.6.18-92.1.22.el5PAE #1 SMP Tue Dec 16 12:36:25 EST 2008 i686 i686 i386 GNU/Linux




Information forwarded to debian-bugs-dist@lists.debian.org, Andreas Metzler <ametzler@debian.org>:
Bug#548944; Package findutils. (Wed, 30 Sep 2009 17:45:04 GMT) (full text, mbox, link).


Acknowledgement sent to Andreas Metzler <ametzler@downhill.at.eu.org>:
Extra info received and forwarded to list. Copy sent to Andreas Metzler <ametzler@debian.org>. (Wed, 30 Sep 2009 17:45:05 GMT) (full text, mbox, link).


Message #10 received at 548944@bugs.debian.org (full text, mbox, reply):

From: Andreas Metzler <ametzler@downhill.at.eu.org>
To: Jim Lebeau <jiml@ladsnet.com>, 548944@bugs.debian.org
Subject: Re: Bug#548944: /usr/bin/find: exedir does not run from the subdirectory containing the matched file.
Date: Wed, 30 Sep 2009 19:26:21 +0200
On 2009-09-29 Jim Lebeau <jiml@ladsnet.com> wrote:
> Package: findutils
> Version: 4.4.0-2
> Severity: normal
> File: /usr/bin/find


> >From the manpage:
>        -execdir command ;
>               Like -exec, but the specified command is run from the
>               subdirectory containing the matched file, which is not
>               no

> Debian Example
> poe@lenore:/var$ find -L . -name dreary.html -exec ls {} \;
> ../dreary.example.com/html/dreary.html
> poe@lenore:/var$ find -L . -name dreary.html -execdir ls {} \;
> .././dreary.example.com/html/dreary.html
[...]
> Centos Example
> [root@lion apache-tomcat]# find -name catalina.out.1 -exec ls {} \;
> ../apache-tomcat-5.5.7/logs/catalina.out.1
> [root@lion apache-tomcat]# find -name catalina.out.1 -execdir ls {} \;
> ../catalina.out.1
[...]

Hello,
thank you for the report. I have forwarded the issue upstream.

The major difference between the two examples seems to be the presence
of the -L switch and not the underlying OS. ;-)

cu andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'




Set Bug forwarded-to-address to 'http://savannah.gnu.org/bugs/?27563'. Request was from Andreas Metzler <ametzler@downhill.at.eu.org> to control@bugs.debian.org. (Wed, 30 Sep 2009 17:45:08 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Andreas Metzler <ametzler@debian.org>:
Bug#548944; Package findutils. (Sun, 11 Apr 2010 16:09:03 GMT) (full text, mbox, link).


Acknowledgement sent to James Youngman <jay@gnu.org>:
Extra info received and forwarded to list. Copy sent to Andreas Metzler <ametzler@debian.org>. (Sun, 11 Apr 2010 16:09:03 GMT) (full text, mbox, link).


Message #17 received at 548944@bugs.debian.org (full text, mbox, reply):

From: James Youngman <jay@gnu.org>
To: bug-findutils@gnu.org, findutils-patches@gnu.org
Cc: 548944@bugs.debian.org, James Youngman <jay@gnu.org>
Subject: Re: [PATCH 1/2] Fix Savannah bug 27563 (-L breaks -execdir).
Date: Sun, 11 Apr 2010 17:06:09 +0100
This patch should be applied on top of my earlier patch fixing bug
#19593 (which is still waiting for code review, I won't be applying it
until tomorrow).




Information forwarded to debian-bugs-dist@lists.debian.org, Andreas Metzler <ametzler@debian.org>:
Bug#548944; Package findutils. (Sun, 11 Apr 2010 16:18:06 GMT) (full text, mbox, link).


Acknowledgement sent to James Youngman <jay@gnu.org>:
Extra info received and forwarded to list. Copy sent to Andreas Metzler <ametzler@debian.org>. (Sun, 11 Apr 2010 16:18:06 GMT) (full text, mbox, link).


Message #22 received at 548944@bugs.debian.org (full text, mbox, reply):

From: James Youngman <jay@gnu.org>
To: bug-findutils@gnu.org
Cc: findutils-patches@gnu.org, 548944@bugs.debian.org, James Youngman <jay@gnu.org>
Subject: [PATCH 1/2] Fix Savannah bug 27563 (-L breaks -execdir).
Date: Sun, 11 Apr 2010 17:05:20 +0100
* find/pred.c (initialise_wd_for_exec): New function, factoring
out part of the body of record_exec_dir.
(record_exec_dir): If state.rel_pathname contains a /, extract the
directory part and initialise execp->wd_for_exec to point at that
directory.
(impl_pred_exec): Rename new_impl_pred_exec to impl_pred_exec.
Drop the prefix and pfxlen parameters.  Compute the base name of
the target and pass that to the bc_push_arg function instead of
state.rel_pathname.  Deal with state.rel_pathname being an
absolute path (e.g. find / -execdir...).  Introduce a new
variable, result, allowing us to free the buffer used for the base
name in the return path.
(pred_exec): Don't pass the prefix and the prefix length any more.
(pred_execdir): Likewise.
(pred_ok): Likewise.
(pred_okdir): Likewise.

Signed-off-by: James Youngman <jay@gnu.org>
---
 ChangeLog   |   20 +++++++++++
 find/pred.c |  108 +++++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 99 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b19dcfa..28cab09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2010-04-11  James Youngman  <jay@gnu.org>
+
+	Fix Savannah bug #27563, -L breaks -execdir.
+	* find/pred.c (initialise_wd_for_exec): New function, factoring
+	out part of the body of record_exec_dir.
+	(record_exec_dir): If state.rel_pathname contains a /, extract the
+	directory part and initialise execp->wd_for_exec to point at that
+	directory.
+	(impl_pred_exec): Rename new_impl_pred_exec to impl_pred_exec.
+	Drop the prefix and pfxlen parameters.  Compute the base name of
+	the target and pass that to the bc_push_arg function instead of
+	state.rel_pathname.  Deal with state.rel_pathname being an
+	absolute path (e.g. find / -execdir...).  Introduce a new
+	variable, result, allowing us to free the buffer used for the base
+	name in the return path.
+	(pred_exec): Don't pass the prefix and the prefix length any more.
+	(pred_execdir): Likewise.
+	(pred_ok): Likewise.
+	(pred_okdir): Likewise.
+
 2010-04-10  James Youngman  <jay@gnu.org>
 
 	Fix Savannah bug #19593, -execdir .... {} + has suboptimal performance
diff --git a/find/pred.c b/find/pred.c
index e2e8dfb..3173398 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -507,6 +507,24 @@ pred_empty (const char *pathname, struct stat *stat_buf, struct predicate *pred_
 }
 
 
+/* Initialise exec->wd_for_exec.
+
+   We save in exec->wd_for_exec the directory whose path relative to
+   cwd_df is dir.
+ */
+static bool
+initialise_wd_for_exec (struct exec_val *execp, int cwd_fd, const char *dir)
+{
+  execp->wd_for_exec = xmalloc (sizeof (*execp->wd_for_exec));
+  execp->wd_for_exec->name = NULL;
+  execp->wd_for_exec->desc = openat (cwd_fd, dir, O_RDONLY);
+  if (execp->wd_for_exec->desc < 0)
+    return false;
+  set_cloexec_flag (execp->wd_for_exec->desc, true);
+  return true;
+}
+
+
 static bool
 record_exec_dir (struct exec_val *execp)
 {
@@ -517,30 +535,45 @@ record_exec_dir (struct exec_val *execp)
 	 be -execdir foo {} \; (i.e. not multiple).  */
       assert (!execp->state.todo);
 
-      /* Record the WD. */
-      execp->wd_for_exec = xmalloc (sizeof (*execp->wd_for_exec));
-      execp->wd_for_exec->name = NULL;
-      execp->wd_for_exec->desc = openat (state.cwd_dir_fd, ".", O_RDONLY);
-      if (execp->wd_for_exec->desc < 0)
-	return false;
-      set_cloexec_flag (execp->wd_for_exec->desc, true);
+      /* Record the WD. If we're using -L or fts chooses to do so for
+	 any other reason, state.cwd_dir_fd may in fact not be the
+	 directory containing the target file.  When this happens,
+	 rel_path will contain directory components (since it is the
+	 path from state.cwd_dir_fd to the target file).
+
+	 We deal with this by extracting any directory part and using
+	 that to adjust what goes into execp->wd_for_exec.
+      */
+      if (strchr (state.rel_pathname, '/'))
+	{
+	  char *dir = mdir_name (state.rel_pathname);
+	  bool result = initialise_wd_for_exec (execp, state.cwd_dir_fd, dir);
+	  free (dir);
+	  return result;
+	}
+      else
+	{
+	  return initialise_wd_for_exec (execp, state.cwd_dir_fd, ".");
+	}
     }
   return true;
 }
 
 
 static bool
-new_impl_pred_exec (const char *pathname,
-		    struct stat *stat_buf,
-		    struct predicate *pred_ptr,
-		    const char *prefix, size_t pfxlen)
+impl_pred_exec (const char *pathname,
+		struct stat *stat_buf,
+		struct predicate *pred_ptr)
 {
   struct exec_val *execp = &pred_ptr->args.exec_vec;
-  size_t len = strlen (pathname);
+  char *target;
+  bool result;
+  const bool local = is_exec_in_local_dir (pred_ptr->pred_func);
+  char *prefix;
+  size_t pfxlen;
 
   (void) stat_buf;
-
-  if (is_exec_in_local_dir (pred_ptr->pred_func))
+  if (local)
     {
       /* For -execdir/-okdir predicates, the parser did not fill in
 	 the wd_for_exec member of sturct exec_val.  So for those
@@ -554,15 +587,30 @@ new_impl_pred_exec (const char *pathname,
 		 safely_quote_err_filename (0, pathname));
 	  /*NOTREACHED*/
 	}
+      target = base_name (state.rel_pathname);
+      if ('/' == target[0])
+	{
+	  /* find / execdir ls -d {} \; */
+	  prefix = NULL;
+	  pfxlen = 0;
+	}
+      else
+	{
+	  prefix = "./";
+	  pfxlen = 2u;
+	}
     }
   else
     {
-      /* For the others (-exec, -ok), the parder should
+      /* For the others (-exec, -ok), the parser should
 	 have set wd_for_exec to initial_wd, indicating
 	 that the exec should take place from find's initial
 	 working directory.
       */
       assert (execp->wd_for_exec == initial_wd);
+      target = pathname;
+      prefix = NULL;
+      pfxlen = 0u;
     }
 
   if (execp->multiple)
@@ -573,7 +621,7 @@ new_impl_pred_exec (const char *pathname,
        */
       bc_push_arg (&execp->ctl,
 		   &execp->state,
-		   pathname, len+1,
+		   target, strlen (target)+1,
 		   prefix, pfxlen,
 		   0);
 
@@ -583,7 +631,7 @@ new_impl_pred_exec (const char *pathname,
       /* POSIX: If the primary expression is punctuated by a plus
        * sign, the primary shall always evaluate as true
        */
-      return true;
+      result = true;
     }
   else
     {
@@ -596,7 +644,7 @@ new_impl_pred_exec (const char *pathname,
 			execp->replace_vec[i],
 			strlen (execp->replace_vec[i]),
 			prefix, pfxlen,
-			pathname, len,
+			target, strlen (target),
 			0);
 	}
 
@@ -605,31 +653,35 @@ new_impl_pred_exec (const char *pathname,
       if (WIFEXITED(execp->last_child_status))
 	{
 	  if (0 == WEXITSTATUS(execp->last_child_status))
-	    return true;	/* The child succeeded. */
+	    result = true;	/* The child succeeded. */
 	  else
-	    return false;
+	    result = false;
 	}
       else
 	{
-	  return false;
+	  result = false;
 	}
     }
+  if (target != pathname)
+    {
+      assert (local);
+      free (target);
+    }
+  return result;
 }
 
 
 bool
 pred_exec (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
-  return new_impl_pred_exec (pathname, stat_buf, pred_ptr, NULL, 0);
+  return impl_pred_exec (pathname, stat_buf, pred_ptr);
 }
 
 bool
 pred_execdir (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
-   const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./";
    (void) &pathname;
-   return new_impl_pred_exec (state.rel_pathname, stat_buf, pred_ptr,
-			      prefix, (prefix ? 2 : 0));
+   return impl_pred_exec (state.rel_pathname, stat_buf, pred_ptr);
 }
 
 bool
@@ -1530,7 +1582,7 @@ bool
 pred_ok (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
   if (is_ok (pred_ptr->args.exec_vec.replace_vec[0], pathname))
-    return new_impl_pred_exec (pathname, stat_buf, pred_ptr, NULL, 0);
+    return impl_pred_exec (pathname, stat_buf, pred_ptr);
   else
     return false;
 }
@@ -1538,10 +1590,8 @@ pred_ok (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr
 bool
 pred_okdir (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
-  const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./";
   if (is_ok (pred_ptr->args.exec_vec.replace_vec[0], pathname))
-    return new_impl_pred_exec (state.rel_pathname, stat_buf, pred_ptr,
-			       prefix, (prefix ? 2 : 0));
+    return impl_pred_exec (state.rel_pathname, stat_buf, pred_ptr);
   else
     return false;
 }
-- 
1.7.0





Information forwarded to debian-bugs-dist@lists.debian.org, Andreas Metzler <ametzler@debian.org>:
Bug#548944; Package findutils. (Sun, 11 Apr 2010 16:18:08 GMT) (full text, mbox, link).


Acknowledgement sent to James Youngman <jay@gnu.org>:
Extra info received and forwarded to list. Copy sent to Andreas Metzler <ametzler@debian.org>. (Sun, 11 Apr 2010 16:18:08 GMT) (full text, mbox, link).


Message #27 received at 548944@bugs.debian.org (full text, mbox, reply):

From: James Youngman <jay@gnu.org>
To: bug-findutils@gnu.org
Cc: findutils-patches@gnu.org, 548944@bugs.debian.org, James Youngman <jay@gnu.org>
Subject: [PATCH 2/2] Add a test case for Savannah bug 27563 (-L breaks -execdir).
Date: Sun, 11 Apr 2010 17:05:21 +0100
* find/testsuite/Makefile.am (EXTRA_DIST_EXP): Add
find.gnu/sv-bug-27563-execdir.exp and
find.posix/sv-bug-27563-exec.exp.
(EXTRA_DIST_XO): Add find.gnu/sv-bug-27563-execdir.xo and
find.posix/sv-bug-27563-exec.xo.
* find/testsuite/find.gnu/sv-bug-27563-execdir.exp: New test.
* find/testsuite/find.posix/sv-bug-27563-exec.exp: New test.
* find/testsuite/find.gnu/sv-bug-27563-execdir.xo: Expected output.
* find/testsuite/find.posix/sv-bug-27563-exec.xo: Expected output.

Signed-off-by: James Youngman <jay@gnu.org>
---
 ChangeLog                                        |   13 +++++++++++++
 find/testsuite/Makefile.am                       |    4 ++++
 find/testsuite/find.gnu/sv-bug-27563-execdir.exp |    6 ++++++
 find/testsuite/find.gnu/sv-bug-27563-execdir.xo  |    1 +
 find/testsuite/find.posix/sv-bug-27563-exec.exp  |    6 ++++++
 find/testsuite/find.posix/sv-bug-27563-exec.xo   |    1 +
 6 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 find/testsuite/find.gnu/sv-bug-27563-execdir.exp
 create mode 100644 find/testsuite/find.gnu/sv-bug-27563-execdir.xo
 create mode 100644 find/testsuite/find.posix/sv-bug-27563-exec.exp
 create mode 100644 find/testsuite/find.posix/sv-bug-27563-exec.xo

diff --git a/ChangeLog b/ChangeLog
index 28cab09..8002e17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2010-04-11  James Youngman  <jay@gnu.org>
 
+	Add a test case for Savannah bug 27563 (-L breaks -execdir).
+	* find/testsuite/Makefile.am (EXTRA_DIST_EXP): Add
+	find.gnu/sv-bug-27563-execdir.exp and
+	find.posix/sv-bug-27563-exec.exp.
+	(EXTRA_DIST_XO): Add find.gnu/sv-bug-27563-execdir.xo and
+	find.posix/sv-bug-27563-exec.xo.
+	* find/testsuite/find.gnu/sv-bug-27563-execdir.exp: New test.
+	* find/testsuite/find.posix/sv-bug-27563-exec.exp: New test.
+	* find/testsuite/find.gnu/sv-bug-27563-execdir.xo: Expected output.
+	* find/testsuite/find.posix/sv-bug-27563-exec.xo: Expected output.
+
+2010-04-11  James Youngman  <jay@gnu.org>
+
 	Fix Savannah bug #27563, -L breaks -execdir.
 	* find/pred.c (initialise_wd_for_exec): New function, factoring
 	out part of the body of record_exec_dir.
diff --git a/find/testsuite/Makefile.am b/find/testsuite/Makefile.am
index f069727..646c143 100644
--- a/find/testsuite/Makefile.am
+++ b/find/testsuite/Makefile.am
@@ -65,6 +65,7 @@ find.gnu/samefile-same.xo \
 find.gnu/samefile-symlink.xo \
 find.gnu/sv-bug-17782.xo \
 find.gnu/sv-bug-18222.xo \
+find.gnu/sv-bug-27563-execdir.xo \
 find.gnu/true.xo \
 find.gnu/wholename.xo \
 find.gnu/xtype-symlink.xo \
@@ -82,6 +83,7 @@ find.posix/links.xo \
 find.posix/sv-bug-11175.xo \
 find.posix/sv-bug-12181.xo \
 find.posix/sv-bug-25359.xo \
+find.posix/sv-bug-27563-exec.xo \
 find.posix/depth1.xo \
 find.posix/mtime0.xo \
 find.posix/sizes.xo \
@@ -186,6 +188,7 @@ find.gnu/sv-bug-17490.exp \
 find.gnu/sv-bug-17782.exp \
 find.gnu/sv-bug-18222.exp \
 find.gnu/sv-bug-24169.exp \
+find.gnu/sv-bug-25359-execdir.exp \
 find.gnu/quit.exp \
 find.gnu/used-invarg.exp \
 find.gnu/used-missing.exp \
@@ -208,6 +211,7 @@ find.posix/mtime0.exp \
 find.posix/sv-bug-11175.exp \
 find.posix/sv-bug-12181.exp \
 find.posix/sv-bug-25359.exp \
+find.posix/sv-bug-25359-exec.exp \
 find.posix/depth1.exp \
 find.posix/sizes.exp \
 find.posix/name.exp \
diff --git a/find/testsuite/find.gnu/sv-bug-27563-execdir.exp b/find/testsuite/find.gnu/sv-bug-27563-execdir.exp
new file mode 100644
index 0000000..c67fc88
--- /dev/null
+++ b/find/testsuite/find.gnu/sv-bug-27563-execdir.exp
@@ -0,0 +1,6 @@
+# tests for Savannah bug 27563 (result of find -L -exec ls {} \;)
+exec rm -rf tmp
+exec mkdir tmp
+exec touch tmp/yyyy
+find_start p {-L tmp -name yyyy -execdir ls \{\} \; }
+exec rm -rf tmp
diff --git a/find/testsuite/find.gnu/sv-bug-27563-execdir.xo b/find/testsuite/find.gnu/sv-bug-27563-execdir.xo
new file mode 100644
index 0000000..285260b
--- /dev/null
+++ b/find/testsuite/find.gnu/sv-bug-27563-execdir.xo
@@ -0,0 +1 @@
+./yyyy
diff --git a/find/testsuite/find.posix/sv-bug-27563-exec.exp b/find/testsuite/find.posix/sv-bug-27563-exec.exp
new file mode 100644
index 0000000..d18b0c1
--- /dev/null
+++ b/find/testsuite/find.posix/sv-bug-27563-exec.exp
@@ -0,0 +1,6 @@
+# tests for Savannah bug 27563 (result of find -L -exec ls {} \;)
+exec rm -rf tmp
+exec mkdir tmp
+exec touch tmp/yyyy
+find_start p {-L tmp -name yyyy -exec ls \{\} \; }
+exec rm -rf tmp
diff --git a/find/testsuite/find.posix/sv-bug-27563-exec.xo b/find/testsuite/find.posix/sv-bug-27563-exec.xo
new file mode 100644
index 0000000..cd491dd
--- /dev/null
+++ b/find/testsuite/find.posix/sv-bug-27563-exec.xo
@@ -0,0 +1 @@
+tmp/yyyy
-- 
1.7.0





Added tag(s) fixed-upstream. Request was from bts-link-upstream@lists.alioth.debian.org to control@bugs.debian.org. (Thu, 12 May 2011 16:39:13 GMT) (full text, mbox, link).


Reply sent to Andreas Metzler <ametzler@downhill.at.eu.org>:
You have taken responsibility. (Sat, 14 May 2011 13:51:03 GMT) (full text, mbox, link).


Notification sent to Jim Lebeau <jiml@ladsnet.com>:
Bug acknowledged by developer. (Sat, 14 May 2011 13:51:03 GMT) (full text, mbox, link).


Message #34 received at 548944-done@bugs.debian.org (full text, mbox, reply):

From: Andreas Metzler <ametzler@downhill.at.eu.org>
To: 548944-done@bugs.debian.org
Subject: Re: Bug#548944: /usr/bin/find: exedir does not run from the subdirectory containing the matched file.
Date: Sat, 14 May 2011 15:49:54 +0200
Version: 4.5.9-1

On 2009-09-30 Andreas Metzler <ametzler@downhill.at.eu.org> wrote:
> On 2009-09-29 Jim Lebeau <jiml@ladsnet.com> wrote:
> > Package: findutils
> > Version: 4.4.0-2
[...]
> > poe@lenore:/var$ find -L . -name dreary.html -execdir ls {} \;
> > .././dreary.example.com/html/dreary.html
[...]
> > [root@lion apache-tomcat]# find -name catalina.out.1 -execdir ls {} \;
> > ../catalina.out.1
[...]

> The major difference between the two examples seems to be the presence
> of the -L switch and not the underlying OS. ;-)

This is fixed in experimental.

--------------------
* Major changes in release 4.5.9, 2010-04-29
[...]
** Bug Fixes
[...]
#27563: -L breaks -execdir
--------------------


cu andreas




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Thu, 30 Jun 2016 07:30:51 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Dec 23 16:20:37 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.