`os.removedirs()` should define whether it follows symlinks
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem Abschnitt „Files and Directories“ der Python-Dokumentation und den Einträgen zu os.removedirs() und os.rmdir(). Dokumentiere, ob os.removedirs() symbolischen Links für die letzte und die dazwischenliegenden Pfadkomponenten folgt, damit das im Issue beschriebene Verhalten explizit und mit der dokumentierten Semantik konsistent ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 40/100