bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find -ok ... and reading from stdin


From: Russell Shaw
Subject: Re: find -ok ... and reading from stdin
Date: Mon, 18 Jul 2005 11:37:19 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1

James Youngman wrote:
The "-ok command ... {} \;" action of find asks the user if they want
to run the command, but it otherwise almost exactly like -exec.  When
the command is run, should its standard input be attached to the same
file as find's standard input (e.g. the input file or pipe from 'yes'
for example) or should it just have its input pointed at /dev/null?

Advantages of leaving it as-is
        - ability to launch an interactive program with -ok.

Advantages of redictecting stdin from /dev/null
- the executed program can't steal input that the user might have expected to be read by the "-ok" action.

See also http://savannah.gnu.org/bugs/?func=detailitem&item_id=13650

Preferences?  Comments?

Regards,
James.

I haven't used the -ok feature, so this is only my guess of what should happen.

If find is fed with a pipe for stdin, questions asked by -ok should open a new
file descriptor for the controlling tty. If the process group is in a session
that has no controlling tty, then find should block or exit on a TTIN/TTOU 
signal.

It would save scripts being accidently run by batch jobs that would normally
ask questions about doing large deletions. If the user intended that, they
should edit out the -ok command. The other way is to have an extra option
that tells find to assume yes or no for -ok when run without access to a
controlling tty. Maybe -nok for assume "no" and -yok to assume "yes".

My 2c.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]