LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-25-2011, 05:37 AM   #1
doru
Member
 
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 89

Rep: Reputation: 16
"info find" troubleshooting


Please help me with a few problems which I have in reading info find:

At the end of the node "Adding Tests" there is this example:
Code:
     find /usr/local -type f -perm /a=x \
       \( -execdir unstripped '{}' \; -fprint ubins -o -fprint sbins \)
unstripped is a simple script:

Code:
     #! /bin/sh
     file "$1" | grep -q "not stripped"
It seems to me that the two round brakets which I made bold are redundant. I also used a simplified example to verify my opinion. Please confirm this.

At the end of the node "Race Conditions with -exec" there is this paragraph:

Quote:
The `-execdir' action refuses to do anything if the current
directory is included in the $PATH environment variable. This is
necessary because `-execdir' runs programs in the same directory in
which it finds files - in general, such a directory might be writable
by untrusted users. For similar reasons, `-execdir' does not allow
`{}' to appear in the name of the command to be run.
Both statements do not make any sense to me, and in fact I verified that they are false. In my home bin directory, which is in PATH, I ran:
Code:
find . -name somename\* -exec echo '{}' \;
whithout any problem. When '{}' is part of the command (!?) I get an error that there is no such file.

Another small problem which I have is that I can't open info find directly in "Adding Tests", because "Adding Tests" is not a subnode of the default "Invoking `find'" node. Do you know how to open info find directly in "Adding Tests"?

Thank you for you time.
 
Old 10-25-2011, 08:00 AM   #2
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
It does look as though the parentheses in your first example aren't necessary. In fact man find has a couple of examples using parentheses where it explicitly says the parentheses are only there for clarity.

In your second example, you use -exec not -execdir. Did you mean that? However it looks like you are right. -execdir happily runs in my bin directory.
 
Old 10-25-2011, 08:03 AM   #3
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Ah. Maybe it just means that -execdir will fail to run if '.' is present in your $PATH.

Yes:
Code:
$ export PATH=.:$PATH
[joe@swelter: ~/bin] Tue Oct 25 15:02:42
$ echo $PATH
.:/home/joe/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
[joe@swelter: ~/bin] Tue Oct 25 15:02:45
$ find /home/joe/bin -name 'word*' -execdir echo '{}' \;
find: The current directory is included in the PATH environment variable, which is insecure in combination with the -execdir action of find.  Please remove the current directory from your $PATH (that is, remove "." or leading or trailing colons)
 
1 members found this post helpful.
Old 10-25-2011, 08:25 AM   #4
doru
Member
 
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 89

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by SecretCode View Post
It does look as though the parentheses in your first example aren't necessary. In fact man find has a couple of examples using parentheses where it explicitly says the parentheses are only there for clarity.

In your second example, you use -exec not -execdir. Did you mean that? However it looks like you are right. -execdir happily runs in my bin directory.
Thank you for your answer.

Well, this clarity did make me waste some time.

You are right, I should have used -execdir. Still, with -execdir find has the same behaviour, which is also a common sense behaviour: it works.
 
Old 10-25-2011, 08:27 AM   #5
doru
Member
 
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 89

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by SecretCode View Post
Ah. Maybe it just means that -execdir will fail to run if '.' is present in your $PATH.
What you say makes sense, but the formulation in the manual still does not make sense to me. So, I thank you for your answer.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add the "More Apps" and "Find Files" buttons to the 11.10 Launcher Larry James Ubuntu 0 10-19-2011 12:42 AM
BASH:find out if volume "foo"/folder "goo" can be written to SilversleevesX Programming 2 08-28-2010 10:03 AM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
info problem "info: dir: No such file or directory" EAD Linux - Software 0 03-22-2006 02:16 PM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration