Last active
December 15, 2015 12:19
-
-
Save matthieuprat/422df4b8be3f488570ad to your computer and use it in GitHub Desktop.
PHP's recursive mkdir() is not thread-safe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd $(mktemp -d) && echo -n 1:2 | xargs -d: -n1 -P2 php --no-php-ini -r 'mkdir(str_repeat("dir/", 100) . $argv[1], 0777, true) or exit(1);' && echo OK | |
Warning: mkdir(): File exists in Command line code on line 1 | |
$ cd $(mktemp -d) && echo -n 1:2 | xargs -d: -n1 -P2 php --no-php-ini -r 'system(sprintf("mkdir -p %s", str_repeat("dir/", 100) . $argv[1]), $r); exit($r);' && echo OK | |
OK | |
$ cd $(mktemp -d) && echo -n 1:2 | xargs -d: -n1 -P2 python -c 'import os, sys; os.makedirs('dir/' * 100 + sys.argv[1]);' && echo 'OK' | |
OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment