[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9170: [PATCH] cp "restores" permissions it never set
From: |
Eric Lammerts |
Subject: |
bug#9170: [PATCH] cp "restores" permissions it never set |
Date: |
Mon, 25 Jul 2011 14:50:50 -0400 (EDT) |
Hi,
I'm seeing the following strange behavior:
$ umask
0002
$ rm -rf /tmp/src /tmp/dst
$ mkdir -m775 /tmp/src /tmp/src/foo
$ mkdir -m700 /tmp/dst /tmp/dst/foo
$ ls -ld /tmp/dst/foo
drwx------ 2 eric eric 4096 Jul 25 13:40 /tmp/dst/foo
$ cp -r /tmp/src/. /tmp/dst/
$ ls -ld /tmp/dst/foo
drwx-w---- 2 eric eric 4096 Jul 25 13:40 /tmp/dst/foo
Patch below fixes this.
cheers,
Eric
diff --git a/src/copy.c b/src/copy.c
index 65566a0..b9c0ccf 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -2197,6 +2197,8 @@ copy_internal (char const *src_name, char const *dst_name,
if (x->verbose)
emit_verbose (src_name, dst_name, NULL);
}
+ else
+ omitted_permissions = 0;
/* Decide whether to copy the contents of the directory. */
if (x->one_file_system && device != 0 && device != src_sb.st_dev)
- bug#9170: [PATCH] cp "restores" permissions it never set,
Eric Lammerts <=