Issue 20779: Add pathlib.chown method (original) (raw)

Created on 2014-02-26 09:51 by vajrasky, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
add_chown_to_pathlib.patch vajrasky,2014-02-26 09:51 review
Pull Requests
URL Status Linked Edit
PR 31212 open y0urself,2022-02-08 11:17
Messages (7)
msg212245 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2014-02-26 09:51
For pragmatic and philosophical reasons, I would argue that we should add chown to pathlib library.
msg212378 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-27 19:28
I don't know about philosophical reasons ;-), but I don't think chown is very often used. Do you know of a context where it is?
msg212411 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2014-02-28 07:48
Pragmatic reasons: I use chown moderately often. Usually as root, I want to change the uid of the files after generating a bunch of files. But I almost never changed gid. I am in two mind whether I should add lchown as well or not (just like lchmod) and make the signature of pathlib.chown same as os.chown (with third parameter, follow_symbolic_links). If you close this as won't fix, I will not hold grudge against you, though. ;)
msg212425 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-28 12:34
Well, I don't know yet, but if we ever want chown() in pathlib, I think it should be higher-level and accept symbolic uids as well.
msg396629 - (view) Author: Tom Cook (Tom Cook) Date: 2021-06-28 10:15
+1 this. I have a program that opens a UNIX socket as root for other processes to communicate with it. I need to set the permissions to 0o775 and set the owner gid to a specific group so that members of that group can communicate with the process. It's annoying to have to drop back to `os.chown(str(path), ...)` for this.
msg398695 - (view) Author: Emmanuel Arias (eamanu) * Date: 2021-08-01 12:13
Hello! I also use it frequently, but looking this issue I can agree with pitrou that there aren't lot of people that use chown. If I'm not wrong, there's a trend to move os to pathlib, perhaps chown should be in pathlib too :) I can work on this.
msg412787 - (view) Author: Jaspar S. (y0urself) * Date: 2022-02-07 19:42
I would love to use chown for a pathlib Path, too. It may not be used often, but if anyone want's to change all the os references from a file, it would be cool to have it on pathlib!
History
Date User Action Args
2022-04-11 14:57:59 admin set github: 64978
2022-02-08 11:17:25 y0urself set stage: patch reviewpull_requests: + <pull%5Frequest29382>
2022-02-07 19:42:07 y0urself set nosy: + y0urselfmessages: +
2021-08-27 16:22:46 sedrubal set nosy: + sedrubal
2021-08-01 12:55:36 eamanu set versions: + Python 3.11, - Python 3.5
2021-08-01 12:13:39 eamanu set nosy: + eamanumessages: +
2021-06-28 10:15:57 Tom Cook set nosy: + Tom Cookmessages: +
2014-08-15 22:32:16 cvrebert set nosy: + cvrebert
2014-02-28 12:34:05 pitrou set nosy: + neologixmessages: +
2014-02-28 07:48:23 vajrasky set messages: +
2014-02-27 19:28:57 pitrou set messages: +
2014-02-26 09:51:50 vajrasky create