All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Cc: Duy Nguyen <pclouds@gmail.com>
Subject: [PATCH 1/2] builtins: do not commit pager choice early
Date: Thu, 25 Mar 2010 20:38:14 +0700	[thread overview]
Message-ID: <1269524295-24569-1-git-send-email-pclouds@gmail.com> (raw)

From: Duy Nguyen <pclouds@gmail.com>

Committing pager choice may require setting up the pager, which
will need access to repository.

At the time after handle_options() is called, the repository has not
been found yet. As a result, unallowed access to repository may
happen.

There are several possible code path after
handle_options()/commit_pager_choice() is called:

1. list_common_cmds_help()
2. run_argv()
3. help_unknown_cmd()

Case 2. will have commit_pager_choice() called inside run_builtin() if
a command is found. Case 1. and 3. won't need a pager, it's short
printout and should be fitted within a screen. So, removing
commit_pager_choice() call after handle_options() is safe.

Signed-off-by: Duy Nguyen <pclouds@gmail.com>
---
 On top of nd/setup. This may help fix the breakage in t7006. And forget t9100
 breakage I mentioned elsewhere. My system is broken, git-svn dies when it "exit 0;"
 and even git one year ago does not fix it.

 git.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/git.c b/git.c
index 3798791..bd1d4bb 100644
--- a/git.c
+++ b/git.c
@@ -514,7 +514,6 @@ int main(int argc, const char **argv)
 	argv++;
 	argc--;
 	handle_options(&argv, &argc, NULL);
-	commit_pager_choice();
 	if (argc > 0) {
 		if (!prefixcmp(argv[0], "--"))
 			argv[0] += 2;
-- 
1.7.0.rc1.541.g2da82.dirty

             reply	other threads:[~2010-03-25 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 13:38 Nguyễn Thái Ngọc Duy [this message]
2010-03-25 13:38 ` [PATCH 2/2] builtins: setup repository before print unknown command error Nguyễn Thái Ngọc Duy
2010-03-26 20:58   ` Jonathan Nieder
2010-03-26 20:03 ` [PATCH 1/2] builtins: do not commit pager choice early Jonathan Nieder

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=1269524295-24569-1-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.