<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/shell.c, branch gitk-resize-error</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=gitk-resize-error</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=gitk-resize-error'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2021-06-09T00:15:58Z</updated>
<entry>
<title>builtins + test helpers: use return instead of exit() in cmd_*</title>
<updated>2021-06-09T00:15:58Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-06-08T10:48:03Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=338abb0f045b87df5e628543800e74dec0e72cdf'/>
<id>urn:sha1:338abb0f045b87df5e628543800e74dec0e72cdf</id>
<content type='text'>
Change various cmd_* functions that claim to return an "int" to use
"return" instead of exit() to indicate an exit code. These were not
marked with NORETURN, and by directly exit()-ing we'll skip the
cleanup git.c would otherwise do (e.g. closing fd's, erroring if we
can't). See run_builtin() in git.c.

In the case of shell.c and sh-i18n--envsubst.c this was the result of
an incomplete migration to using a cmd_main() in 3f2e2297b9 (add an
extra level of indirection to main(), 2016-07-01).

This was spotted by SunCC 12.5 on Solaris 10 (gcc210 on the gccfarm).

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>interactive: refactor code asking the user for interactive input</title>
<updated>2020-04-10T17:26:31Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-04-10T11:27:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=08d383f23e80e418c844952fcc4e2e635962c292'/>
<id>urn:sha1:08d383f23e80e418c844952fcc4e2e635962c292</id>
<content type='text'>
There are quite a few code locations (e.g. `git clean --interactive`)
where Git asks the user for an answer. In preparation for fixing a bug
shared by all of them, and also to DRY up the code, let's refactor it.

Please note that most of these callers trimmed white-space both at the
beginning and at the end of the answer, instead of trimming only the
end (as the caller in `add-patch.c` does).

Therefore, technically speaking, we change behavior in this patch. At
the same time, it can be argued that this is actually a bug fix.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>shell: use skip_prefix() instead of starts_with()</title>
<updated>2019-11-27T02:18:24Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2019-11-26T15:00:43Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=ec6ee0c07a6dc93dd18003b069c78f514ccbe427'/>
<id>urn:sha1:ec6ee0c07a6dc93dd18003b069c78f514ccbe427</id>
<content type='text'>
Get rid of a magic number by using skip_prefix() instead of
starts_with().

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/command-list'</title>
<updated>2018-06-01T06:06:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-06-01T06:06:37Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=2289880f784326dc955f213072164539dcaf445e'/>
<id>urn:sha1:2289880f784326dc955f213072164539dcaf445e</id>
<content type='text'>
The list of commands with their various attributes were spread
across a few places in the build procedure, but it now is getting a
bit more consolidated to allow more automation.

* nd/command-list:
  completion: allow to customize the completable command list
  completion: add and use --list-cmds=alias
  completion: add and use --list-cmds=nohelpers
  Move declaration for alias.c to alias.h
  completion: reduce completable command list
  completion: let git provide the completable command list
  command-list.txt: documentation and guide line
  help: use command-list.txt for the source of guides
  help: add "-a --verbose" to list all commands with synopsis
  git: support --list-cmds=list-&lt;category&gt;
  completion: implement and use --list-cmds=main,others
  git --list-cmds: collect command list in a string_list
  git.c: convert --list-* to --list-cmds=*
  Remove common-cmds.h
  help: use command-list.h for common command list
  generate-cmds.sh: export all commands to command-list.h
  generate-cmds.sh: factor out synopsis extract code
</content>
</entry>
<entry>
<title>Move declaration for alias.c to alias.h</title>
<updated>2018-05-21T04:23:14Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-05-20T18:40:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=65b5f9483eafea0ccdea59884da4e00e0cfeee1f'/>
<id>urn:sha1:65b5f9483eafea0ccdea59884da4e00e0cfeee1f</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>exec_cmd: rename to use dash in file name</title>
<updated>2018-04-11T09:11:00Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-04-10T21:26:18Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d807c4a01db2b06db047fc6d5d18ac25c8f05bd7'/>
<id>urn:sha1:d807c4a01db2b06db047fc6d5d18ac25c8f05bd7</id>
<content type='text'>
This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
</content>
</entry>
<entry>
<title>shell: drop git-cvsserver support by default</title>
<updated>2017-09-12T02:05:58Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-09-11T15:27:51Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=9a42c03cb71eaa9d41ba67275de38c997a791c32'/>
<id>urn:sha1:9a42c03cb71eaa9d41ba67275de38c997a791c32</id>
<content type='text'>
The git-cvsserver script is old and largely unmaintained
these days. But git-shell allows untrusted users to run it
out of the box, significantly increasing its attack surface.

Let's drop it from git-shell's list of internal handlers so
that it cannot be run by default.  This is not backwards
compatible. But given the age and development activity on
CVS-related parts of Git, this is likely to impact very few
users, while helping many more (i.e., anybody who runs
git-shell and had no intention of supporting CVS).

There's no configuration mechanism in git-shell for us to
add a boolean and flip it to "off". But there is a mechanism
for adding custom commands, and adding CVS support here is
fairly trivial. Let's document it to give guidance to
anybody who really is still running cvsserver.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'maint-2.8' into maint-2.9</title>
<updated>2017-05-05T04:13:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-05-05T04:13:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c93ab42b7480a2c317713385f5ef3f8f2b099c2b'/>
<id>urn:sha1:c93ab42b7480a2c317713385f5ef3f8f2b099c2b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge branch 'maint-2.7' into maint-2.8</title>
<updated>2017-05-05T04:05:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-05-05T04:05:03Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a8d93d19a2fede14a35db163a1fd3bc87b6ac41d'/>
<id>urn:sha1:a8d93d19a2fede14a35db163a1fd3bc87b6ac41d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>shell: disallow repo names beginning with dash</title>
<updated>2017-05-05T03:07:27Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-04-29T12:36:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3ec804490a265f4c418a321428c12f3f18b7eff5'/>
<id>urn:sha1:3ec804490a265f4c418a321428c12f3f18b7eff5</id>
<content type='text'>
When a remote server uses git-shell, the client side will
connect to it like:

  ssh server "git-upload-pack 'foo.git'"

and we literally exec ("git-upload-pack", "foo.git"). In
early versions of upload-pack and receive-pack, we took a
repository argument and nothing else. But over time they
learned to accept dashed options. If the user passes a
repository name that starts with a dash, the results are
confusing at best (we complain of a bogus option instead of
a non-existent repository) and malicious at worst (the user
can start an interactive pager via "--help").

We could pass "--" to the sub-process to make sure the
user's argument is interpreted as a branch name. I.e.:

  git-upload-pack -- -foo.git

But adding "--" automatically would make us inconsistent
with a normal shell (i.e., when git-shell is not in use),
where "-foo.git" would still be an error. For that case, the
client would have to specify the "--", but they can't do so
reliably, as existing versions of git-shell do not allow
more than a single argument.

The simplest thing is to simply disallow "-" at the start of
the repo name argument. This hasn't worked either with or
without git-shell since version 1.0.0, and nobody has
complained.

Note that this patch just applies to do_generic_cmd(), which
runs upload-pack, receive-pack, and upload-archive. There
are two other types of commands that git-shell runs:

  - do_cvs_cmd(), but this already restricts the argument to
    be the literal string "server"

  - admin-provided commands in the git-shell-commands
    directory. We'll pass along arbitrary arguments there,
    so these commands could have similar problems. But these
    commands might actually understand dashed arguments, so
    we cannot just block them here. It's up to the writer of
    the commands to make sure they are safe. With great
    power comes great responsibility.

Reported-by: Timo Schmid &lt;tschmid@ernw.de&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
