bug-coreutils
[Top][All Lists]
Advanced

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

bug#7008: On "touch" command


From: Eric Blake
Subject: bug#7008: On "touch" command
Date: Fri, 10 Sep 2010 09:32:20 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2

On 09/10/2010 08:47 AM, Eric Blake wrote:
On 09/10/2010 03:30 AM, Dibyajyoti Ghosh wrote:
Hi,
I needed to change the timestamp of a directory structure of very high
depth. and in each level there are lots of files and folders.
So I expected a recursive operation of "touch" (like -R in chmod or in
chown
etc.).

Thanks for the report. However, we are reluctant to bloat any more tools
with recursive traversal than absolutely necessary - the whole Unix
philosophy is that each tool should do one thing well, rather than
making every tool copy common actions from other tools.

For the record, on of the reasons that ls and du must support recursion is that they must list totals, where the use of find|xargs might cause multiple tool invocations which end up breaking reporting of totals. Tools like chmod, chown, rm, and mv must support recursion because there are some particular end-result ownership and permissions which require intermediate settings to still allow safe recursion, but there is no way to express temporary ownerships needed only for the duration of the recursion when using find|xargs. Besides, all of the above-named tools have recursion required by POSIX.

But for touch, which neither outputs a total message, nor changes file meta-data in a manner that would affect recursion, nor has a POSIX mandate to support recursion, the use of find -exec touch (or find|xargs) is preferable.

And for other tools that must report totals, like wc, we still don't want to add recursion - it is easier to have wc support arbitrarily long lists of safe file names via 'find -print0 | wc --files0-from=-' than to make wc recursive.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org





reply via email to

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