Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extending os.walk to support following symlinks #42306

Closed
idadesub mannequin opened this issue Aug 26, 2005 · 11 comments
Closed

extending os.walk to support following symlinks #42306

idadesub mannequin opened this issue Aug 26, 2005 · 11 comments

Comments

@idadesub
Copy link
Mannequin

idadesub mannequin commented Aug 26, 2005

BPO 1273829
Nosy @loewis, @birkenfeld, @birkenfeld
Files
  • os.py.diff: patch against the cvs version of os.py
  • test_os.diff: test_os windows fix against trunk revision 54670
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2007-04-09.16:07:57.000>
    created_at = <Date 2005-08-26.07:21:24.000>
    labels = []
    title = 'extending os.walk to support following symlinks'
    updated_at = <Date 2007-04-09.16:07:57.000>
    user = 'https://bugs.python.org/idadesub'

    bugs.python.org fields:

    activity = <Date 2007-04-09.16:07:57.000>
    actor = 'tmick'
    assignee = 'zseil'
    closed = True
    closed_date = None
    closer = None
    components = ['None']
    creation = <Date 2005-08-26.07:21:24.000>
    creator = 'idadesub'
    dependencies = []
    files = ['6761', '6762']
    hgrepos = []
    issue_num = 1273829
    keywords = ['patch']
    message_count = 11.0
    messages = ['48670', '48671', '48672', '48673', '48674', '48675', '48676', '48677', '48678', '48679', '48680']
    nosy_count = 7.0
    nosy_names = ['loewis', 'tmick', 'georg.brandl', 'georg.brandl', 'zseil', 'aptshansen', 'idadesub']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1273829'
    versions = []

    @idadesub
    Copy link
    Mannequin Author

    idadesub mannequin commented Aug 26, 2005

    this is a very simple extension to os.walk to optionally walk down
    into symlink directories, when it is supported by the operating
    system. This patch keeps a compatible interface by having this
    option disabled.

    @idadesub idadesub mannequin closed this as completed Aug 26, 2005
    @idadesub idadesub mannequin assigned zseil Aug 26, 2005
    @idadesub idadesub mannequin closed this as completed Aug 26, 2005
    @idadesub idadesub mannequin assigned zseil Aug 26, 2005
    @birkenfeld
    Copy link
    Member

    Logged In: YES
    user_id=1188172

    The docs to os.walk say:
    """
    Note: On systems that support symbolic links, links to
    subdirectories appear in dirnames lists, but walk() will not
    visit them (infinite loops are hard to avoid when following
    symbolic links). To visit linked directories, you can
    identify them with os.path.islink(path), and invoke
    walk(path) on each directly.
    """

    Nevertheless, we could offer this option with a caution message.

    @aptshansen
    Copy link
    Mannequin

    aptshansen mannequin commented Mar 16, 2007

    I'm not sure if this is a good idea; although I am certain it would be useful at times. Dangerous! But if its documented, ... and there's our problem :)

    Patch applies cleanly to the HEAD, but needs documentation.

    @birkenfeld
    Copy link
    Member

    Added docs and tests and committed in rev. 54407.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Mar 23, 2007

    The test suite patch (54482) broke the windows build. The assertion

    self.assertEqual(len(all), 4)

    fails because it finds 5 directories (link is a directory), then the rest of the
    code is not executed. In turn, the tear-down code is not run, leaving the directories
    behind. This causes subsequent tests to fail.

    When fixing the code, I recommend to move the tear-down code into the tearDown
    method of the test, to make sure it is always run.

    @zseil
    Copy link
    Mannequin

    zseil mannequin commented Apr 3, 2007

    Here is a patch that fixes test_os.WalkTests on Windows.

    I also added a tearDown method to WalkTests and removed
    Collin's changes to MakedirTests, because they are not
    needed anymore.

    File Added: test_os.diff

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 4, 2007

    The patch is fine; please apply.

    @zseil
    Copy link
    Mannequin

    zseil mannequin commented Apr 4, 2007

    Commited as revision 54689.

    @tmick
    Copy link
    Mannequin

    tmick mannequin commented Apr 4, 2007

    Is there a separate bug for doc updates for this?

    @zseil
    Copy link
    Mannequin

    zseil mannequin commented Apr 7, 2007

    Hi Trent,

    There is no separate issue yet. What is missing in
    the docs? Georg updated the docs when he checked
    in this patch.

    @tmick
    Copy link
    Mannequin

    tmick mannequin commented Apr 9, 2007

    Ziga,
    My mistake: I failed to notice the change to Doc/lib/libos.tex.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant