Merge pull request #35849 from theredcat/fix_file_makedirs_infinite_loop

Fix potential infinite loop with no error when using recursive makedirs
This commit is contained in:
Mike Place 2016-08-29 20:37:19 +09:00 committed by GitHub
commit dc705ff675

View file

@ -4609,8 +4609,15 @@ def makedirs_(path,
break
directories_to_create.append(dirname)
current_dirname = dirname
dirname = os.path.dirname(dirname)
if current_dirname == dirname:
raise SaltInvocationError(
'Recursive creation for path \'{0}\' would result in an '
'infinite loop. Please use an absolute path.'.format(dirname)
)
# create parent directories from the topmost to the most deeply nested one
directories_to_create.reverse()
for directory_to_create in directories_to_create: