[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chown before chmod in gzip.c copy_stat prevents chmod
From: |
Paul Eggert |
Subject: |
Re: chown before chmod in gzip.c copy_stat prevents chmod |
Date: |
Tue, 12 Jun 2007 15:24:36 -0700 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
"O'Connor, Russell" <address@hidden> writes:
> The CVS change log for revision 1.6 of gzip.c says "Invoke chmod before
> chown, to close a race condition." But the change actually moves chown
> before chmod.
Sorry, the change log is wrong. I'll fix it.
> With chown before chmod, if you don't own the file, you
> won't be able to change the permissions, and they will be left at 0600,
> and gzip reports "Operation not permitted". Is this intentional?
Yes. The problem is that on many hosts, if you chown a file there is
a side effect that chmods it as well. So you must chown before chmoding.
On most systems, if you have enough privileges to chown a file, you
can also chmod it afterwards, so it's not a problem.
On systems where you can give files away you will have problems,
true. The usual workaround is "Don't do that".