From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 12 20:34:54 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 4AA0F16A431 for ; Fri, 12 Aug 2005 20:34:54 +0000 (GMT) (envelope-from steve@Watt.COM) Received: from wattres.watt.com (wattres.watt.com [66.93.133.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id ECE9243D48 for ; Fri, 12 Aug 2005 20:34:53 +0000 (GMT) (envelope-from steve@Watt.COM) Received: from wattres.watt.com (localhost.watt.com [127.0.0.1]) by wattres.watt.com (8.13.3/8.13.3) with ESMTP id j7CKYp0I033830; Fri, 12 Aug 2005 13:34:51 -0700 (PDT) (envelope-from steve@wattres.watt.com) Received: (from steve@localhost) by wattres.watt.com (8.13.3/8.13.3/Submit) id j7CKYp2x033829; Fri, 12 Aug 2005 13:34:51 -0700 (PDT) (envelope-from steve) Message-Id: <200508122034.j7CKYp2x033829@wattres.watt.com> X-Newsgroups: local.freebsd-hackers In-Reply-To: <20050812194927.GA74052@doom.homeunix.org> Organization: Watt Consultants From: steve@Watt.COM (Steve Watt) Date: Fri, 12 Aug 2005 13:34:51 -0700 X-Mailer: Mail User's Shell (7.2.6 beta(5) 10/07/98) To: ip@doom.homeunix.org X-Archived: 1123878891.847274086@wattres.Watt.COM X-Virus-Scanned: ClamAV version 0.86.2, clamav-milter version 0.86 on wattres.Watt.COM X-Virus-Status: Clean Cc: hackers@freebsd.org 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:34:54 -0000 In article <20050812194927.GA74052@doom.homeunix.org> you write: >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 umask applies after the open call's permissions, and is used to remove bits from the value passed in to the open. That's the way POSIX says it works, and that's how it works on UNIX machines. Down in the guts of the open() syscall, there's a line that effectively says file_permissions = passed_in_permissions & ~umask; It's working as designed. -- Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.8" / 37N 20' 14.9" Internet: steve @ Watt.COM Whois: SW32 Free time? There's no such thing. It just comes in varying prices...