Re: (Query): Changing the Functionality of rm Command

Brian Dessent <[email protected]> Wed, 17 Aug 2005 18:24:25 -0700
Newsgroups gmane.comp.gnu.core-utils.bugs,gmane.comp.gnu.fileutils.bugs
Organization My own little world...
Message-ID <[email protected]>
"Chawla, Sumit" wrote:

>   I need to change the functionality of one of the existing binaries of=

> Linux. For example that of command 'rm'. Please guide how to proceed in=
 that
> case. I need to perform some pre-deletion and post =96deletion task . F=
or that
> I need to either design a hookup function or / to replace the existing =
rm
> binary with some new binary having the same name. Can u please guide in=
 this
> regard.

If you want to patch 'rm' then patch 'rm'.  I don't really understand
the question.  If you want to know where to get the source code or how
to build it, then ask that.  (But this is documented elsewhere, so you
should read the INSTALL and README files first.)

But it seems like you may be under the impression that patching 'rm'
will have a system-wide effect.  It won't.  It will only affect commands
or processes that use /bin/rm to delete files.  But rm is just a wrapper
around system calls (unlink and rmdir) and most applications that delete
files use these syscalls directly.

In other words, what you are asking sounds somewhat misguided, so you
might consider detailing what you are actually trying to achieve, rather
that the particular method you are trying to use.

Brian