[PATCH/RFCv1] git-p4: handle files with shell metacharacters
- From
Luke Diamand <luke@diamand.org>
- Date
- Sep 26, 2011, 21:29 UTC
- Message-ID
- <1317072555-23438-1-git-send-email-luke@diamand.org>
git-p4 uses the shell to execute perforce and git. This leads to problems where files contain shell metacharacters or spaces. I first hit this when someone checked in files with dollars ($) in their name, but in theory you could cause complete havoc with other characters: backticks in a filename would be especially entertaining.
Make git-p4 use subprocess.Popen() and subprocess.call() instead, and pass in argv[] style arrays instead, at least for cases where filenames are involved. Add test cases.
Notes:
This patch is based on Pete Wyckoff's recent patch series for refactoring the git-p4 test harness, so it won't apply to the current next or master branches.
I tried testing it on Cygwin as well, but the test harness appears to be very broken on that platform as it is unable to start p4d.
Luke Diamand (1): git-p4: handle files with shell metacharacters
contrib/fast-import/git-p4 | 174 +++++++++++++++++++++++++--------------- t/t9800-git-p4.sh | 2 +- t/t9803-git-shell-metachars.sh | 70 ++++++++++++++++ 3 files changed, 179 insertions(+), 67 deletions(-) create mode 100755 t/t9803-git-shell-metachars.sh
-- 1.7.6.347.g4db0d