`os.removedirs()` should define whether it follows symlinks
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 77.2k
- Forks
- 35.9k
- Métriques de merge des PR
- Métriques de PR en attente
Description
Documentation
Many functions in os do not properly specify whether or not they follow symlinks. The Files and Directories even slightly implies that the default is more to follow symlinks (and only with follow_symlinks=False not).
For some functions (like os.rmdir() one might argue this is not important because they're the counterparts of well-known POSIX/C functions and for them it's well-defined.
But e.g. os.removedirs() seem to have no such counterpart and since the documentation doesn't mention anything, the current behaviour (which AFAICS is not following symlinks) might just be some implementation detail.
For os.removedirs() there are even two interesting cases in e.g. os.removedirs("a/b/c/d"):
- if
d(i.e. the final pathname component) is a symlink to a directory the referred directory is not removed (at least not in the current code, which usesos.rmdir()on the pathname) - if e.g.
bis a symlink to a directory, which contains onlyc/d, thenbis followed whenrmdiringa/b/c/danda/b/cbut is not followed whenrmdiringa/b(and the target ofbisn’t removed).
All this kinda follows the spirit of POSIX' pathname resolution, but still it would IMO be nice to have it clearly defined.
Cheers,
Chris.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par la section « Files and Directories » de la documentation Python et par les entrées relatives à os.removedirs() et os.rmdir(). Documentez si os.removedirs() suit les liens symboliques pour les composants final et intermédiaires du chemin, afin que le comportement décrit dans l’issue soit explicite et cohérent avec la sémantique documentée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- documentation
- Type d'issue
- Documentation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 40/100