From owner-freebsd-stable@FreeBSD.ORG Fri Dec 15 09:31:40 2006 Return-Path: X-Original-To: freebsd-stable@FreeBSD.ORG Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66ED816A40F for ; Fri, 15 Dec 2006 09:31:40 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 39DDF43CB5 for ; Fri, 15 Dec 2006 09:29:56 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (pszcds@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id kBF9VTFH077239; Fri, 15 Dec 2006 10:31:34 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id kBF9VT4u077238; Fri, 15 Dec 2006 10:31:29 +0100 (CET) (envelope-from olli) Date: Fri, 15 Dec 2006 10:31:29 +0100 (CET) Message-Id: <200612150931.kBF9VT4u077238@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG, om-lists-bsd@omx.ch In-Reply-To: <03050A19-BA59-4874-9F1B-BC9302C0C7FC@omx.ch> X-Newsgroups: list.freebsd-stable User-Agent: tin/1.8.2-20060425 ("Shillay") (UNIX) (FreeBSD/4.11-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 15 Dec 2006 10:31:35 +0100 (CET) Cc: Subject: Re: p5-Quota issues X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-stable@FreeBSD.ORG, om-lists-bsd@omx.ch List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Dec 2006 09:31:40 -0000 Olivier Mueller wrote: > Le 15 déc. 06 à 00:57, Oliver Fromme a écrit : > > Olivier Mueller wrote: > > > I'm trying to get a script working with the p5-Quota module, but no > > > way... : > > > - quota correctely working for the /home partition > > > - tested with edquota/repquota, etc. > > > > > > But when trying to retrieve information or setup quota information > > > from > > > a perl script, I get: Quota::sync: error #45 > > > > I guess that's an errno number, and in that case 45 is > > EOPNOTSUPP (Operation not supported). It is a bug that > > the errno number is not printed as a human-readable > > string. > > > > Did you try to use Quota::query? Does it work? > > Tried yes, work: no. Which means, exactly? Same error message? Are you sure that you specify the file system correctly? Is your kernel compiled with "options QUOTA"? > > > But what bothers me more is that exactely the same script (with the > > > same module) is working fine under linux... > > > > According to the p5-Quota documentation, the Quota::sync > > function is not supported on all platforms, so it's > > perfectly possible that the p5-Quota code supports it > > on Linux, but not on FreeBSD. > > Well, in this case, why would there be a freebsd port for this > module? :-) The sync function is optional and not necessarily required for the rest of the module to be useful. (Although it _should_ work on FreeBSD.) Of course, if the query function doesn't work either, then there really is something wrong. > I'll continue my tests... And if it doesn't work, I'll simply use the > system commands That's how I do it in a Python program. Since I'm not querying quotas ten times per second or so, calling the system commands isn't really a problem. > instead of the perl module, but then I would have to rewrite some > part of my scripts. Well, should be just three or four lines. In my Python program I'm doing it's the following code (this won't help you, I'm afraid, but I'm quoting it so someone who searches the archives might find it helpful): quotas = dict([ (user, qinfo.split()) for line in getoutput("repquota -a /home").splitlines()[2:] for user, qinfo in [line.split(None,1)] ]) That creates a dictionary (Perl calls it a "hash") with the user names as keys and their quota information as values (a list with 9 string elements, corresponding to the columns in repquota output). E.g. quotas["joe"][2] will give the soft blocks limit of user joe. If quotas are disabled, the dictionary is empty, so you can simply write "if quotas: ..." or "if not quotas: ..." to check whether quotas are enabled at all. I'm sure you can do it similarly in Perl. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind." -- Alan Kay, OOPSLA '97