Martin,

Has this change been checked in? Not see it from the trunk.

Eric

On Mon, Dec 28, 2009 at 5:55 PM, Martin Bligh <[email protected]> wrote:

> Whether you use scp -p or not, scp'ing a file with read-only permissions
> seems to preserve them, hence a second scp will fail when trying to
> overwrite.
>
> In order to fix this, we really need to change the general send/get
> file routines
> to fix permissions whilst copying, but for now the main culprit is
> sysinfo. We can
> fix this very easily by not making those file copies readonly in the
> first place,
> until we fix the main send/get routines.
>
> We're using shutil.copy in here, which is defined as:
>
> def copy(src, dst):
>    """Copy data and mode bits ("cp src dst").
>
>    The destination may be a directory.
>
>    """
>    if os.path.isdir(dst):
>        dst = os.path.join(dst, os.path.basename(src))
>    copyfile(src, dst)
>    copymode(src, dst)
>
> We already know the destination is a directory, so we don't need that bit.
> A straight substitution of copyfile for copy will work fine here.
>
> Tested, and verified to fix the issue.
>
> Signed-off-by: Martin J. Bligh <[email protected]>
>
>
> Index: client/bin/base_sysinfo.py
> ===================================================================
> --- client/bin/base_sysinfo.py  (revision 4056)
> +++ client/bin/base_sysinfo.py  (working copy)
> @@ -75,7 +75,7 @@
>
>     def run(self, logdir):
>         if os.path.exists(self.path):
> -            shutil.copy(self.path, os.path.join(logdir, self.logf))
> +            shutil.copyfile(self.path, os.path.join(logdir, self.logf))
>
>
>  class command(loggable):
>



-- 
Eric Li
李咏竹
Google Kirkland
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to