git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Next: Luke Diamand
Message 1 of 8 in “git-p4: handle files with shell metacharacters”
  1. git-p4: handle files with shell metacharactersLuke Diamand, Sep 26, 2011
  2. git-p4: handle files with shell metacharactersLuke Diamand, Sep 26, 2011
  3. Pete WyckoffSep 26, 2011
  4. [RFC/PATCHv2] git-p4: handle files with shell metacharactersLuke Diamand, Sep 27, 2011
  5. [RFC/PATCHv2] git-p4: handle files with shell metacharactersLuke Diamand, Sep 27, 2011
  6. Luke DiamandSep 27, 2011
  7. Pete WyckoffSep 27, 2011
  8. Luke DiamandSep 30, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.