News for hackers. Stuff that matters.
Re:Fix the unit test and open a giant hole everywhere by im3w1l on Saturday December 25, 2021 @04:41AM (#29681838)

    subprocess.run([“mkdir”, “-p”, path])
This does not work for all values of path. And I'm not just referring to blorgle's complaint. I'm being deliberately vague to make you pause for a second and think.
Re:Fix the unit test and open a giant hole everywhere by ynik on Saturday December 25, 2021 @06:48AM (#29682494)
You seem to be getting downvoted for being too vague, so I will post the solution:

The snippet breaks for paths starting with a minus, as mkdir will interpret those as another option.

The solution is:

    subprocess.run(["mkdir", "-p", "--", path])
Re:Fix the unit test and open a giant hole everywhere by Kinrany on Saturday December 25, 2021 @05:40AM (#29682096)
Does `path = "$(rm -rf /)"` work in this context?
Re:Fix the unit test and open a giant hole everywhere by bstpierre on Saturday December 25, 2021 @07:24AM (#29682717)
No, because this isn’t being run through the shell, it’s directly exec’ing the program. So you’re just going to get a dir named “$(rm -rf /)”.
Re:Fix the unit test and open a giant hole everywhere by im3w1l on Saturday December 25, 2021 @07:33AM (#29682765)
It's funny how easy it is to miss characters with special meaning. In this case it's the slash. You would get a directory named "$(rm -rf " with a subdirectory named ")"