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

git shell scripts flaw wrt dirty env

From
Pierre Habouzit <madcoder@debian.org>
Date
Aug 3, 2007, 20:14 UTC
Message-ID
<20070803201405.GB12430@artemis.corp>
  I recently had an issue with git-rebase, and actually git-am, kind of
hard to track down. After some hassle to understand what was going on,
it happened that for an idiotic reason (me trying a fancy new login
manager for X that didn't cleansed environment before staring X) made
all my env dirty. In particular it had $resume (in small letters) set to
/dev/sda5, and git-am happens to use the very same variable, without
cleansing the environment.
  I'm maybe completely out of luck, and that's the sole unsafe use of
variables in git shell scripts, but I don't think so, and maybe some
kind of failsafe could be used. A crude way is to call:
  unset `env | cut -d= -f1 | grep -v [A-Z]`
  at the beginning of every script, so that every lowercase-only
variables are unset, hence can be safely used. But it's completely
tasteless. Though, as it can really lead to _very_ odd bugs, well, I
just wanted to share the issue. For the curious, you can read on [0]
what the issue looked like for me...
  [0] http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=38;bug=435807#38
Cheers,
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Next: Gerrit Pape
Message 1 of 3 in “git shell scripts flaw wrt dirty env”
  1. Pierre HabouzitAug 3, 2007
  2. git-am: initialize variable $resume on startupGerrit Pape, Aug 6, 2007
  3. Junio C HamanoAug 6, 2007

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.