From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6614 invoked from network); 16 Dec 2005 15:49:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Dec 2005 15:49:23 -0000 Received: (qmail 67780 invoked from network); 16 Dec 2005 15:49:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Dec 2005 15:49:08 -0000 Received: (qmail 1133 invoked by alias); 16 Dec 2005 15:49:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22089 Received: (qmail 1124 invoked from network); 16 Dec 2005 15:49:05 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 16 Dec 2005 15:49:05 -0000 Received: (qmail 67545 invoked from network); 16 Dec 2005 15:49:05 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 16 Dec 2005 15:49:03 -0000 Received: from candle.brasslantern.com ([71.116.81.225]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IRL00MYUL9OWIP0@vms042.mailsrvcs.net> for zsh-workers@sunsite.dk; Fri, 16 Dec 2005 09:49:00 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id jBGFmwCb010163 for ; Fri, 16 Dec 2005 07:48:58 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id jBGFmwb9010162 for zsh-workers@sunsite.dk; Fri, 16 Dec 2005 07:48:58 -0800 Date: Fri, 16 Dec 2005 15:48:57 +0000 From: Bart Schaefer Subject: Re: [PATCH]: restore permissions and mode on HISTFILE when renaming it In-reply-to: <200512160942.30494.arekm@pld-linux.org> To: zsh-workers@sunsite.dk Message-id: <1051216154857.ZM10161@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <200512160942.30494.arekm@pld-linux.org> Comments: In reply to Arkadiusz Miskiewicz "[PATCH]: restore permissions and mode on HISTFILE when renaming it" (Dec 16, 9:42am) On Dec 16, 9:42am, Arkadiusz Miskiewicz wrote: } } Exaple, I'm working as user arekm and .historyz has arekm:users } user/group but if I do sudo zsh; ls; exit then it's renamed and I end } up with .historyz being root:root Ick. I don't think it's appropriate for root's history to get written into some other user's SAVEHIST file. A better solution to this would probably be to skip writing the history entirely if the file owner is not the same as the current EUID. } Attached patch makes zsh restore original permissions/owner/group of } HISTFILE after sucessful rename. It's against HEAD (4.3) cvs version. Even if that approach is chosen, the race conditions you mentioned could be avoided by changing the file attributes *before* renaming it.