From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: Franz.Sirl-kernel@lauterbach.com Cc: gas2@sourceware.cygnus.com Subject: Re: strip looses original file ownership and file permissions Date: Thu, 06 May 1999 09:27:00 -0000 Message-id: <19990506162706.1409.qmail@daffy.airs.com> References: <4.2.0.37.19990506133808.0363a9f0@mail.lauterbach.com> <4.2.0.37.19990506133808.0363a9f0@mail.lauterbach.com> X-SW-Source: 1999/msg00089.html Date: Thu, 06 May 1999 13:44:47 +0200 From: Franz Sirl >I just verified that strip out of gas-990418 looses original ownership and >permissions of a file. >This is on glibc-2.1.1pre2, Linux-2.2.6 (PPC). > >Is this platform specific or does anybody else notice this? After a quick browse through the source I came up with the following untested patch. Does it look right? It doesn't look right to me. We need to rename the file FROM to TO. In the normal case of strip, FROM is a temporary file, and TO is the original file which we are stripping. However, this function is also used in other cases. If TO does not exist, we should just use rename. This is not the normal case of strip, but it happens in other cases. Your patch breaks that. That seems to be only significant change in your patch. Perhaps I am missing something. I think the only way to reliably preserve ownership is to avoid using rename. Perhaps the code should be changed to call simple_copy when the owner of the file differs from the effective uid. Ian