python / python/cpython

properly define what "canonical" means in `os.path.realpath`

Offen
#134,639 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

docs
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Documentation

The documentation says:
https://github.com/python/cpython/blob/2fd09b011031f3c00c342b44e02e2817010e507c/Doc/library/os.path.rst?plain=1#L406-L409

So it merely mentions symlink resolution, but not what else it means (if anything).

It does however mention that whatever it does is OS dependent:
https://github.com/python/cpython/blob/2fd09b011031f3c00c342b44e02e2817010e507c/Doc/library/os.path.rst?plain=1#L416-L418

IMO, it should be clearly documented what it does or at least:

  • what it guarantees to the least (For example will the pathname be absolute? Will it be normalised?)
    and/or:
  • which OS function it’s identical to, like on POSIX where that would probably realpath(), and whether there are differences to that

Especially since IMO "canonical" pathname (though I think it has no formal definition, or is there anything in POSIX?) means rather just that there are no symlinks left, i.e. that the file is "reached" by its true (=canonical) name.

But that could still be a relative pathname, and perhaps even one that is not normalised.

Cheers,
Chris.

Linked PRs
  • gh-134755

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in Doc/library/os.path.rst bei den zitierten Zeilen 406-409 und 416-418 und vergleiche anschließend die im Issue verlinkte POSIX-referenz zu realpath(). Dokumentiere die Mindestgarantien von os.path.realpath sowie jegliches betriebsspezifische Verhalten oder Unterschiede, wobei die Formulierung klar machen soll, was „canonical“ bedeutet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.