From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: Re: [gentoo-portage-dev] [PATCH 2/4] sync: allow overriding sync-user for the repository
Date: Sat, 06 Dec 2014 23:02:00 -0800 [thread overview]
Message-ID: <5483FB68.7070107@gentoo.org> (raw)
In-Reply-To: <1417824216-7990-3-git-send-email-mgorny@gentoo.org>
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 "<stdin>", line 1, in <module>
ValueError: need more than 0 values to unpack
Otherwise, LGTM.
--
Thanks,
Zac
next prev parent reply other threads:[~2014-12-07 7:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-06 0:03 [gentoo-portage-dev] [PATCH 0/4] sync: sync-umask and sync-user support Michał Górny
2014-12-06 0:03 ` [gentoo-portage-dev] [PATCH 1/4] sync: allow overriding sync-umask for the repository Michał Górny
2014-12-07 6:46 ` Zac Medico
2014-12-07 9:00 ` [gentoo-portage-dev] [PATCH] " Michał Górny
2014-12-06 0:03 ` [gentoo-portage-dev] [PATCH 2/4] sync: allow overriding sync-user " Michał Górny
2014-12-07 7:02 ` Zac Medico [this message]
2014-12-07 9:01 ` [gentoo-portage-dev] [PATCH] " Michał Górny
2014-12-07 9:07 ` Michał Górny
2014-12-07 18:32 ` Zac Medico
2014-12-08 6:53 ` Arfrever Frehtes Taifersar Arahesis
2014-12-06 0:03 ` [gentoo-portage-dev] [PATCH 3/4] sync: ensure sync_{umask,user} is respected when creating repo Michał Górny
2014-12-07 7:10 ` Zac Medico
2014-12-06 0:03 ` [gentoo-portage-dev] [PATCH 4/4] sync: Add backwards compat with SYNC_{UMASK,USER} variables Michał Górny
2014-12-07 7:15 ` Zac Medico
2014-12-07 8:22 ` Michał Górny
2014-12-07 9:04 ` Zac Medico
2014-12-07 9:06 ` Michał Górny
2014-12-07 18:33 ` Zac Medico
2014-12-07 18:39 ` Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5483FB68.7070107@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
--cc=mgorny@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox