On Wednesday, May 30, 2018, Nick Coghlan wrote:
> On 30 May 2018 at 02:38, Guido van Rossum wrote:
>
>> Honestly, despite the occasional use case(1), I'm not sure that this is a
>> battery we need in the stdlib. Nobody seems too excited about writing the
>> code, and when the operation is needed
On 30 May 2018 at 02:38, Guido van Rossum wrote:
> Honestly, despite the occasional use case(1), I'm not sure that this is a
> battery we need in the stdlib. Nobody seems too excited about writing the
> code, and when the operation is needed, shelling out to the system chown is
> not too onerous.
Configuration management tools with far more code than this are regularly
run with root privileges.
OTOH, Salt and Ansible, for example, both support recursive chown and
chmod; and report what actually changed. Yum/dnf probably do, too.
Supporting recursive chmod/chown OOB may be useful. That it
On Wed, May 30, 2018 at 9:11 AM, Greg Ewing wrote:
> BTW, I wouldn't argue that Python shouldn't provide things
> that are only useful to root. While writing setuid utilities
> in Python is a bad idea for lots of reasons, I don't think
> there's anything wrong with becoming root by another means
>
BTW, I wouldn't argue that Python shouldn't provide things
that are only useful to root. While writing setuid utilities
in Python is a bad idea for lots of reasons, I don't think
there's anything wrong with becoming root by another means
and then running a Python program that you know well enough
Steven D'Aprano wrote:
Look closely at my example: the file ownership
recursively changed from steve.steve to steve.users.
You're quite right. I hadn't realised that chown can be
used to change the group as well as the user. It's permitted
to change the group to one that the user is a member of
Honestly, despite the occasional use case(1), I'm not sure that this is a
battery we need in the stdlib. Nobody seems too excited about writing the
code, and when the operation is needed, shelling out to the system chown is
not too onerous. (Ditto for chmod.)
(1) Not even sure that a use case was
On 29 May 2018 at 06:23, Giampaolo Rodola' wrote:
> ...as in (not tested):
>
> def _rchown(dir, user, group):
> for root, dirs, files in os.walk(dir, topdown=False):
> for name in files:
> chown(os.path.join(root, name), user, group)
>
> def chown(path,
On Tue, May 29, 2018 at 06:29:50PM +1200, Greg Ewing wrote:
> Steven D'Aprano wrote:
> >But it doesn't matter: regular users can call chown -R:
>
> Only if you're not actually telling it to change anything.
That's not correct. Look closely at my example: the file ownership
recursively changed fr
Steven D'Aprano wrote:
But it doesn't matter: regular users can call chown -R:
Only if you're not actually telling it to change anything.
% ls -l foo.txt
-rw-r--r-- 1 greg users 1 29 May 18:19 foo.txt
% chown greg foo.txt
% chown fred foo.txt
chown: foo.txt: Operation not permitted
So you
On Tue, May 29, 2018 at 10:11:22AM +1000, Chris Angelico wrote:
> On Tue, May 29, 2018 at 9:47 AM, Steven D'Aprano wrote:
> > Certainly not. You only have to be root to change permissions on files
> > that you otherwise wouldn't be able to change permissions on. chmod -R
> > works fine for regula
On Tue, May 29, 2018 at 9:47 AM, Steven D'Aprano wrote:
> On Mon, May 28, 2018 at 10:13:47PM +0100, Barry wrote:
>>
>> > On 28 May 2018, at 21:23, Giampaolo Rodola' wrote:
> [...]
>> > It appears like a common enough use case to me ("chown -R path").
>> > Thoughts?
>>
>> I wonder if it is very co
On Mon, May 28, 2018 at 10:13:47PM +0100, Barry wrote:
>
> > On 28 May 2018, at 21:23, Giampaolo Rodola' wrote:
[...]
> > It appears like a common enough use case to me ("chown -R path").
> > Thoughts?
>
> I wonder if it is very common.
> Don’t you have to be root or use sudo chown?
> In which
path.py Path.choen supports names in addition to the uid/gid numbers which
os.chown supports:
https://pathpy.readthedocs.io/en/stable/api.html#path.Path.chown
https://github.com/jaraco/path.py/blob/master/path.py#L1176
https://pathpy.readthedocs.io/en/stable/api.html#path.Path.walk
On Monday, M
> On 28 May 2018, at 21:23, Giampaolo Rodola' wrote:
>
> ...as in (not tested):
>
> def _rchown(dir, user, group):
> for root, dirs, files in os.walk(dir, topdown=False):
> for name in files:
> chown(os.path.join(root, name), user, group)
>
> def cho
...as in (not tested):
def _rchown(dir, user, group):
for root, dirs, files in os.walk(dir, topdown=False):
for name in files:
chown(os.path.join(root, name), user, group)
def chown(path, user=None, group=None, recursive=False):
if recursive and
16 matches
Mail list logo