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

Re: [PATCH/RFC 4/4] Add interactive mode to git-shell for user-friendliness

From
Greg Brockman <gdb@mit.edu>
Date
Jul 17, 2010, 04:12 UTC
Message-ID
<AANLkTikiOgV1iE7dwPUkLpWTb_zXSFdEuOYvyqJ1eDCo@mail.gmail.com>
In-Reply-To
<AANLkTikEjMeKPkyY4RdRq-ESkmmq4PvqCFPgp8yvLVBz@mail.gmail.com>

It looks like git@ got dropped from the CC at some point, but I had written a few days ago:

>> Is there a reason that you duplicate functionality offered by run_command()?
> No--I hadn't realized that existed.  I'll switch over to that in V2 of
> this patch series.
Today, I inspected run_command() in more detail.  Unfortunately, I'm
not sure of the best way to use it in this situation.  In particular,
run_command() uses execvp, meaning that PATH is invoked.  However, the
user should only be able to run commands in the git-shell-commands
directory.   I do have a few ideas for approaches here; maybe others
see more?  Anyway:
- Set PATH to just $HOME/git-shell-commands.  But then the helper
scripts have to restore PATH to a sane value themselves, and it's not
really clear to me what that value should be.
- Under the hood, exec a different script, which processes the user's
command on its own.  (So if the user types 'help' at the git shell
prompt, actually exec 'git-shell-wrapper help'.)  The
git-shell-wrapper could be a dumb wrapper that just execs
$HOME/git-shell-commands/help or similar.
- Extend run_command to optionally use execv.  Would any other code
actually want this functionality though?  If not, it's probably an
excessively large code change for little benefit.
- Continue using the one-off run() method that I wrote here.
Do people have opinions on the most elegant way to handle this?
Thanks!
Greg
Show 34 quoted lines
> On Wed, Jul 14, 2010 at 12:07 PM, Bernhard R. Link <brlink@debian.org> wrote:
>> * Thomas Rast <trast@student.ethz.ch> [100714 17:41]:
>>> [Please don't trim the Cc list without good reason.]
>>
>> The mail I answered to had only git@vger.kernel.org in CC and some
>> syntax errors in To.
>>
>>> Bernhard R. Link wrote:
>>> > To be more specific: If NULL is (void *)0 then it does not need to be
>>> > cast. Sadly the standard allows to define it as 0, and so it is on
>>> > some systems. So to be portable it needs to be cast to be a pointer,
>>> > otherwise the varargs argument is assumed to be an int.
>>>
>>> Worse, the pointer representations need not be the same between types,
>>> even though that is a fairly exotic idea:
>>>
>>>   http://c-faq.com/null/machexamp.html
>>>
>>> So it seems execl() must always have an explicitly-cast (char*)NULL
>>> sentinel.
>>
>> There is a difference between ugly operating systems where everything
>> else works and you need to cast it and things too exotic to have any
>> chance to get the rest of the code to work without big changes.
>>
>> Machines where you do not get a NULL pointer by a memset(,0,), calloc
>> or the like will have bigger problems anyway. (have not looked at git,
>> but I'd be suprised if at every place there is an explicit assignment
>> for the pointers).
>> Note that in the other examples, char * and void * are the same anyway.
>>
>>        Bernhard R. Link
>>
>
Previous: Greg BrockmanNext: Jonathan Nieder
Message 17 of 19 in “Providing mechanism to list available repositories”
  1. 0/4 Providing mechanism to list available repositoriesGreg Brockman, Jul 14, 2010
  2. 1/4 Allow creation of arbitrary git-shell commandsGreg Brockman, Jul 14, 2010
  3. Junio C HamanoJul 14, 2010
  4. Greg BrockmanJul 14, 2010
  5. 2/4 git-shell-commands: Add a command to list bare reposGreg Brockman, Jul 14, 2010
  6. 3/4 git-shell-commands: Add a help commandGreg Brockman, Jul 14, 2010
  7. 4/4 Add interactive mode to git-shell for user-friendlinessGreg Brockman, Jul 14, 2010
  8. Ævar Arnfjörð BjarmasonJul 14, 2010
  9. Kevin P. FlemingJul 14, 2010
  10. Bernhard R. LinkJul 14, 2010
  11. Thomas RastJul 14, 2010
  12. Cast execl*() NULL sentinels to (char *)Thomas Rast, Jul 24, 2010
  13. Ævar Arnfjörð BjarmasonJul 24, 2010
  14. Johannes SixtJul 14, 2010
  15. Junio C HamanoJul 14, 2010
  16. Greg BrockmanJul 14, 2010
  17. Greg BrockmanJul 17, 2010
  18. Jonathan NiederJul 17, 2010
  19. Greg BrockmanJul 17, 2010

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.