Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

os.removedirs() should define whether it follows symlinks #134161

Open
Labels
3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesdocsDocumentation in the Doc dir
@calestyo

Description

@calestyo

Documentation

Many functions inos do not properly specify whether or not they follow symlinks. TheFiles and Directories even slightly implies that the default is more to follow symlinks (and only withfollow_symlinks=False not).

For some functions (likeos.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 isnot following symlinks) might just be some implementation detail.

Foros.removedirs() there are even two interesting cases in e.g.os.removedirs("a/b/c/d"):

  • ifd (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.b is a symlink to a directory, which contains onlyc/d, thenbis followed whenrmdiringa/b/c/d anda/b/c but isnot followed whenrmdiringa/b (and the target ofb isn’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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesdocsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp