[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: rm feature: don't attempt to remove the same file twice
From: |
Ed Avis |
Subject: |
RE: rm feature: don't attempt to remove the same file twice |
Date: |
Thu, 1 Sep 2016 15:39:43 +0000 |
In fact, 'rm -f a a' still does twice the filesystem operations.
It still calls newfstatat(AT_FDCWD, "a", ...) twice and unlinkat(AT_FDCWD, "a",
0) twice, on my system.
What I am suggesting is to check for the same filename string having been seen
before and avoid touching the filesystem.
This is a small user-friendliness improvement in the mode without -f, since
"warning: file 'a' specified twice" is easier to understand
than "cannot remove 'a': No such file or directory", but it is also a
performance improvement.
Pretty marginal I admit, except perhaps for a network filesystem hosted by a
server on the other side of the planet.
--
Ed Avis <address@hidden>
This email is intended only for the person to whom it is addressed and may
contain confidential information. Any retransmission, copying, disclosure or
other use of, this information by persons other than the intended recipient is
prohibited. If you received this email in error, please contact the sender and
delete the material. This email is for information only and is not intended as
an offer or solicitation for the purchase or sale of any financial instrument.
Wadhwani Asset Management LLP is a Limited Liability Partnership registered in
England (OC303168) with registered office at 9th Floor Orion House, 5 Upper St
Martin’s Lane, London, WC2H 9EA. It is authorised and regulated by the
Financial Conduct Authority.