From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6F1FC1389E2 for ; Sun, 7 Dec 2014 07:02:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A092EE0916; Sun, 7 Dec 2014 07:02:05 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2CCB7E0916 for ; Sun, 7 Dec 2014 07:02:05 +0000 (UTC) Received: from [192.168.1.4] (ip70-181-96-121.oc.oc.cox.net [70.181.96.121]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 6C3003403F9; Sun, 7 Dec 2014 07:02:04 +0000 (UTC) Message-ID: <5483FB68.7070107@gentoo.org> Date: Sat, 06 Dec 2014 23:02:00 -0800 From: Zac Medico User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.8.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-portage-dev@lists.gentoo.org CC: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= Subject: Re: [gentoo-portage-dev] [PATCH 2/4] sync: allow overriding sync-user for the repository References: <1417824216-7990-1-git-send-email-mgorny@gentoo.org> <1417824216-7990-3-git-send-email-mgorny@gentoo.org> In-Reply-To: <1417824216-7990-3-git-send-email-mgorny@gentoo.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 5137e27f-ca9f-42e7-9520-abbe1c749606 X-Archives-Hash: 273b2e52eb9285739b8ff7c52b595bc9 On 12/05/2014 04:03 PM, Michał Górny wrote: > + if len(spl) > 1: > + group = spl[1] > + try: > + try: > + # maybe it's a gid? > + gid = int(group) > + except ValueError: > + gp = grp.getgrnam(group) > + else: > + pw = grp.getgrgid(gid) Does this behave the same as other tools (like chown) for strings like "12345" ? I vaguely recall someone saying that chown tries a string lookup first, and if that fails then it tries an integer lookup. > + except KeyError: > + writemsg("!!! Group '%s' invalid or does not exist\n" > + % group, noiselevel=-1) > + return () > + > + gr = gp.gr_gid > + else: > + gr = pw.pw_gid > + > + return (pw.pw_uid, gr, pw.pw_dir) > + > + # user or user:group > + (uid, gid, home) = get_sync_user_data(repo.sync_user) If it returns () above, this will raise a ValueError, right? >>> (x, y, z) = () Traceback (most recent call last): File "", line 1, in ValueError: need more than 0 values to unpack Otherwise, LGTM. -- Thanks, Zac