bug-fileutils
[Top][All Lists]
Advanced

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

Re: Patch to 'mv' - suppress chmod/chown


From: Alain Williams
Subject: Re: Patch to 'mv' - suppress chmod/chown
Date: Tue, 25 Mar 2003 09:51:43 +0000
User-agent: Mutt/1.2.5.1i

On Mon, Mar 24, 2003 at 08:43:58PM +0100, Jim Meyering wrote:
> Thank you for the patch.
> This will be fixed pretty soon by making the existing
> --no-preserve=ATTR_LIST option (currently only accepted by cp)
> do what you want.  This is in the TODO file:
> 
>   cp --no-preserve=X should not attempt to preserve attribute X
>     reported by Andreas Schwab
> 
> However, I'm not sure it's worth adding an option to mv to support that.

I am trying to do a clean daily move of large archive files over the network.
I want the archived files to be cleanly removed once copied and my script
replaces the moved directories with a symlink to the new location.

> An alternative is to use a wrapper to filter out just those messages.
> (replacing regex-for-offending-diagnostic with something useful)
> Here's a little one I wrote:
> ...

That sort of thing just adds complication & a sense of when this happened
is lost because of the delays imposed by the pipe (I have had some 'mv's
run for several hours moving log files to archive on a not-very-fast san).

Also: the exit code that the shell sees is of 'grep', not 'mv'.
I go to lengths to detect errors - which is why I am trying to preserve
'meaningful' errors (and loose irrelevant ones).

> # Filter stderr of the given command without affecting stdout,
> # and leave any unfiltered content on stderr.
> exec 3>&1; ("$@" | sed 's/[^0-9].*//') 2>&1 >&3 \
>   | grep -E -v 'regex-for-offending-diagnostic' 1>&2
> 
> Then, you can use it like this:
> 
>   filter-stderr mv your-files dir-on-losing-filesystem

Cheers

-- 
Alain Williams

#include <std_disclaimer.h>




reply via email to

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