git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@debian.org>
To: git@vger.kernel.org
Subject: git shell scripts flaw wrt dirty env
Date: Fri, 3 Aug 2007 22:14:05 +0200	[thread overview]
Message-ID: <20070803201405.GB12430@artemis.corp> (raw)

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]


  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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2007-08-03 20:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-03 20:14 Pierre Habouzit [this message]
2007-08-06 14:15 ` [PATCH] git-am: initialize variable $resume on startup Gerrit Pape
2007-08-06 23:16   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070803201405.GB12430@artemis.corp \
    --to=madcoder@debian.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).