summaryrefslogtreecommitdiff
path: root/doc/development/shell_commands.md
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-10-02 18:27:18 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-10-02 18:27:18 +0200
commit97c5d38097a6308c31e0e5f9afaef719d5080b5f (patch)
tree003b04a3f077915087d09aa5134d08994ab8c7c6 /doc/development/shell_commands.md
parent71fce0b2f82fa4c6dea4fef4c0672514a00ec72c (diff)
downloadgitlab-ce-97c5d38097a6308c31e0e5f9afaef719d5080b5f.tar.gz
Add a counterexample to 'do it in Ruby'
Diffstat (limited to 'doc/development/shell_commands.md')
-rw-r--r--doc/development/shell_commands.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md
index 1f3908f4e27..23c8365c340 100644
--- a/doc/development/shell_commands.md
+++ b/doc/development/shell_commands.md
@@ -22,6 +22,12 @@ FileUtils.mkdir_p "tmp/special/directory"
contents = `cat #{filename}`
# Correct
contents = File.read(filename)
+
+# Sometimes a shell command is just the best solution. The example below has no
+# user input, and is hard to implement correctly in Ruby: delete all files and
+# directories older than 120 minutes under /some/path, but not /some/path
+# itself.
+Gitlab::Popen.popen(%W(find /some/path -not -path /some/path -mmin +120 -delete))
```
This coding style could have prevented CVE-2013-4490.