[node-patches] Change in ovirt-node[master]: ovirtfunctions: Prevent recursion in safe_delete
danken at redhat.com
danken at redhat.com
Mon May 19 13:50:24 UTC 2014
Dan Kenigsberg has posted comments on this change.
Change subject: ovirtfunctions: Prevent recursion in safe_delete
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
http://gerrit.ovirt.org/#/c/27476/1/src/ovirtnode/ovirtfunctions.py
File src/ovirtnode/ovirtfunctions.py:
Line 1090: if os.path.isdir(filename):
Line 1091: ls_cmd = subprocess_closefds("ls -d '%s'" % filename, shell=True, stdout=PIPE, stderr=STDOUT)
Line 1092: output, err = ls_cmd.communicate()
Line 1093: for child in output:
Line 1094: if os.path.realpath(filename) == os.path.realpath(child):
this solves only a case of immediate recursion, where child==parents. It does not avoid grandchild == granddad (or a distant uncle).
The reasonable solution (taken by rm -fr dir) is not to follow symbolic links.
Line 1095: # Child == Parent - Don't recurse
Line 1096: pass
Line 1097: else:
Line 1098: ovirt_safe_delete_config(child)
--
To view, visit http://gerrit.ovirt.org/27476
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic2e89492f4c18c1afd41e399e854fc9be4f091eb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the node-patches
mailing list