mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
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:
commit
dc705ff675
1 changed files with 7 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue