Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-15 Thread Pádraig Brady
Ondřej Vašík wrote: > Thanks for word tweaks and other patch-amending. I spotted one error - > initial value of access_changed was not changed to false when you > changed the name and logic from access_unchanged thanks Ondřej

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-15 Thread Jim Meyering
Ondřej Vašík wrote: > Jim Meyering wrote: >> Ondřej Vašík wrote: >> > Pádraig Brady wrote: >> >> Yes I agree that the change is required. >> >> I've tweaked it so that the geteuid() syscall is only called >> >> if readonly files. Also I removed the error message on chmod failure >> >> as the user

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-15 Thread Ondřej Vašík
Jim Meyering wrote: > Ondřej Vašík wrote: > > Pádraig Brady wrote: > >> Yes I agree that the change is required. > >> I've tweaked it so that the geteuid() syscall is only called > >> if readonly files. Also I removed the error message on chmod failure > >> as the user will still get an error messa

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-15 Thread Jim Meyering
Ondřej Vašík wrote: > Pádraig Brady wrote: >> Yes I agree that the change is required. >> I've tweaked it so that the geteuid() syscall is only called >> if readonly files. Also I removed the error message on chmod failure >> as the user will still get an error message _if_ the copy_xattr fails. >>

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-15 Thread Ondřej Vašík
Pádraig Brady wrote: > Yes I agree that the change is required. > I've tweaked it so that the geteuid() syscall is only called > if readonly files. Also I removed the error message on chmod failure > as the user will still get an error message _if_ the copy_xattr fails. > Also I ran it through inde

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-14 Thread Jim Meyering
Pádraig Brady wrote: > Ondřej Vašík wrote: >> Pádraig Brady wrote: >>> Since we're only doing u+rw, and we've already stat'd it's >>> probably better to just (sb.mode & S_IWUSR) rather than access(...). >>> Also a couple of the if statements are indented too far. >> >> Hopefully ok with the attach

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-14 Thread Pádraig Brady
Ondřej Vašík wrote: > Pádraig Brady wrote: >> Since we're only doing u+rw, and we've already stat'd it's >> probably better to just (sb.mode & S_IWUSR) rather than access(...). >> Also a couple of the if statements are indented too far. > > Hopefully ok with the attached patch. > >> This should

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-14 Thread Ondřej Vašík
0 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Thu, 3 Sep 2009 16:10:21 +0200 Subject: [PATCH] cp,mv: do preserve extended attributes even for read-only source files * src/copy.c (copy_reg): Set mode on file descriptor to 0600 for copying extended attributes to prevent failures w

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-07 Thread Pádraig Brady
Ondřej Vašík wrote: > Pádraig Brady wrote: >> Ondřej Vašík wrote: >>> Pádraig Brady wrote: To minimize side affects perhaps we should only do the chmod(600) if (geteuid () != 0 && !access (src_name, W_OK)) ? >>> Good idea, it would reduce possibility of security leak, playing with >>> acc

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-07 Thread Ondřej Vašík
Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Thu, 3 Sep 2009 16:10:21 +0200 Subject: [PATCH] cp,mv: do preserve extended attributes even for read-only source files * src/copy.c (copy_reg): Set mode on file descriptor to 0600 for copying extended attributes to pre

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-07 Thread Pádraig Brady
Ondřej Vašík wrote: > Pádraig Brady wrote: >> To minimize side affects perhaps we should only do the chmod(600) >> if (geteuid () != 0 && !access (src_name, W_OK)) ? > > Good idea, it would reduce possibility of security leak, playing with > access rights is always a bit dangerous (although here w

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-07 Thread Ondřej Vašík
Pádraig Brady wrote: > Ondřej Vašík wrote: > > Ah, I knew I forgot to do something :). Thanks for spotting this. > > > > Restoring to dest_mode & ~omitted_permissions done in attached patch, > > dropped redirections from the test as well. Additionally - I modified > > the copy.c patch a bit - fail

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-07 Thread Jim Meyering
Ondřej Vašík wrote: > Ah, I knew I forgot to do something :). Thanks for spotting this. > > Restoring to dest_mode & ~omitted_permissions done in attached patch, > dropped redirections from the test as well. Additionally - I modified > the copy.c patch a bit - failure of mode change now doesn't mea

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-07 Thread Pádraig Brady
Ondřej Vašík wrote: > Ah, I knew I forgot to do something :). Thanks for spotting this. > > Restoring to dest_mode & ~omitted_permissions done in attached patch, > dropped redirections from the test as well. Additionally - I modified > the copy.c patch a bit - failure of mode change now doesn't me

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-07 Thread Ondřej Vašík
y of solution will be found. Ok with passing to 7.7, although with such small impact and relatively low danger, it could maybe included to 7.6 (if more snapshots will be before real release). Greetings, Ondřej From 5fca1fbaf2e7594496c854f4c3eef60bd3013697 Mon Sep 17 00:00:00 2001 From: =?utf-8?

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-05 Thread Jim Meyering
Pádraig Brady wrote: > Ondřej Vašík wrote: >> As reported in >> http://lists.gnu.org/archive/html/bug-coreutils/2009-08/msg00342.html by >> Ernest N. Mamikonyan, cp/mv fails to preserve extended attributes for >> read-only source files. >> Following patch fixes the issue for me, although maybe it's

Re: [PATCH] cp, mv: do preserve extended attributes even for read-only source files

2009-09-04 Thread Pádraig Brady
Ondřej Vašík wrote: > As reported in > http://lists.gnu.org/archive/html/bug-coreutils/2009-08/msg00342.html by > Ernest N. Mamikonyan, cp/mv fails to preserve extended attributes for > read-only source files. > Following patch fixes the issue for me, although maybe it's not perfect > solution. But

[PATCH] cp,mv: do preserve extended attributes even for read-only source files

2009-09-03 Thread Ondřej Vašík
better one at the moment. Test included... Greetings, Ondřej Vašík From cae691907fe50e2ab05198a7c647fe4140e3669e Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Thu, 3 Sep 2009 16:10:21 +0200 Subject: [PATCH] cp,mv: do preserve extended attributes even for