From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 12 20:31:44 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6153116A41F; Fri, 12 Aug 2005 20:31:44 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6A9043D45; Fri, 12 Aug 2005 20:31:43 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.40.201] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Fri, 12 Aug 2005 16:46:35 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 12 Aug 2005 16:32:12 -0400 User-Agent: KMail/1.8 References: <20050812194927.GA74052@doom.homeunix.org> In-Reply-To: <20050812194927.GA74052@doom.homeunix.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508121632.13436.jhb@FreeBSD.org> Cc: hackers@freebsd.org, Igor Pokrovsky Subject: Re: perl's tie problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2005 20:31:44 -0000 On Friday 12 August 2005 03:49 pm, Igor Pokrovsky wrote: > Hi all, > > Consider the following except from a perl program: > > tie(%foodb, 'MLDBM', $BAR_FILE, O_CREAT | O_RDWR, 0666) > or die("Cannot open $BAR_FILE: $!\n"); > > I expect it to create a new $BAR_FILE, if none existed, with 0666 > permissions. But it doesn't. It creates a file with default umask > specified permissions - 0644. So I have to manually do chmod on that > file afterwards. Is there anything I don't understand? > > %uname -a > FreeBSD doom.homeunix.org 4.11-STABLE FreeBSD 4.11-STABLE #0: > Tue Jul 5 21:05:20 MSD 2005 [...] i386 > > Perl version is 5.8.7 > > Thanks, > > -ip I think this is expected behavior. Your umask setting affects all calls to open(2) with O_CREAT to create a file, and from tie()'s arguments it seems that it uses open(2) to create the destination file. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org