Commit graph

42704 commits

Author SHA1 Message Date
Nguyễn Thái Ngọc Duy af92a645d3 pack-objects: do not truncate result in-pack object size on 32-bit systems
A typical diff will not show what's going on and you need to see full
functions. The core code is like this, at the end of of write_one()

	e->idx.offset = *offset;
	size = write_object(f, e, *offset);
	if (!size) {
		e->idx.offset = recursing;
		return WRITE_ONE_BREAK;
	}
	written_list[nr_written++] = &e->idx;

	/* make sure off_t is sufficiently large not to wrap */
	if (signed_add_overflows(*offset, size))
		die("pack too large for current definition of off_t");
	*offset += size;

Here we can see that the in-pack object size is returned by
write_object (or indirectly by write_reuse_object). And it's used to
calculate object offsets, which end up in the pack index file,
generated at the end.

If "size" overflows (on 32-bit sytems, unsigned long is 32-bit while
off_t can be 64-bit), we got wrong offsets and produce incorrect .idx
file, which may make it look like the .pack file is corrupted.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-13 09:15:17 -07:00
Nguyễn Thái Ngọc Duy da49a7da3a index-pack: correct "offset" type in unpack_entry_data()
unpack_entry_data() receives an off_t value from unpack_raw_entry(),
which could be larger than unsigned long on 32-bit systems with large
file support. Correct the type so truncation does not happen. This
only affects bad object reporting though.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-13 09:15:08 -07:00
Nguyễn Thái Ngọc Duy fd3e67474c index-pack: report correct bad object offsets even if they are large
Use the right type for offsets in this case, off_t, which makes a
difference on 32-bit systems with large file support, and change
formatting code accordingly.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-13 09:14:47 -07:00
Nguyễn Thái Ngọc Duy 7171a0b0cf index-pack: correct "len" type in unpack_data()
On 32-bit systems with large file support, one entry could be larger
than 4GB and overflow "len". Correct it so we can unpack a full entry.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-13 09:14:38 -07:00
Nguyễn Thái Ngọc Duy 166df26f28 sha1_file.c: use type off_t* for object_info->disk_sizep
This field, filled by sha1_object_info() contains the on-disk size of
an object, which could go over 4GB limit of unsigned long on 32-bit
systems. Use off_t for it instead and update all callers.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-13 09:14:20 -07:00
Nguyễn Thái Ngọc Duy 211c61c6cf pack-objects: pass length to check_pack_crc() without truncation
On 32 bit systems with large file support, unsigned long is 32-bit
while the two offsets in the subtraction expression (pack-objects has
the exact same expression as in sha1_file.c but not shown in diff) are
in 64-bit. If an in-pack object is larger than 2^32 len/datalen is
truncated and we get a misleading "error: bad packed object CRC for
..." as a result.

Use off_t for len and datalen. check_pack_crc() already accepts this
argument as off_t and can deal with 4+ GB.

Noticed-by: Christoph Michelbach <michelbach94@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-12 10:14:29 -07:00
Junio C Hamano 0b65a8dbdb Git 2.8.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-06 14:29:32 -07:00
Junio C Hamano 1676827c85 Merge branch 'kb/msys2-tty' into maint
The "are we talking with TTY, doing an interactive session?"
detection has been updated to work better for "Git for Windows".

* kb/msys2-tty:
  mingw: make isatty() recognize MSYS2's pseudo terminals (/dev/pty*)
2016-06-06 14:27:38 -07:00
Junio C Hamano 389c3289cf Merge branch 'da/difftool' into maint
"git difftool" learned to handle unmerged paths correctly in
dir-diff mode.

* da/difftool:
  difftool: handle unmerged files in dir-diff mode
  difftool: initialize variables for readability
2016-06-06 14:27:37 -07:00
Junio C Hamano 7dcbf891d9 Merge branch 'tb/core-eol-fix' into maint
A couple of bugs around core.autocrlf have been fixed.

* tb/core-eol-fix:
  convert.c: ident + core.autocrlf didn't work
  t0027: test cases for combined attributes
  convert: allow core.autocrlf=input and core.eol=crlf
  t0027: make commit_chk_wrnNNO() reliable
2016-06-06 14:27:36 -07:00
Junio C Hamano 05781d37fa Merge branch 'ar/diff-args-osx-precompose' into maint
Many commands normalize command line arguments from NFD to NFC
variant of UTF-8 on OSX, but commands in the "diff" family did
not, causing "git diff $path" to complain that no such path is
known to Git.  They have been taught to do the normalization.

* ar/diff-args-osx-precompose:
  diff: run arguments through precompose_argv
2016-06-06 14:27:35 -07:00
Junio C Hamano 4b0891ffe4 More topics for 2.8.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-31 14:11:38 -07:00
Junio C Hamano 3296e1a93a Merge branch 'sb/submodule-deinit-all' into maint
Correct faulty recommendation to use "git submodule deinit ." when
de-initialising all submodules, which would result in a strange
error message in a pathological corner case.

* sb/submodule-deinit-all:
  submodule deinit: require '--all' instead of '.' for all submodules
2016-05-31 14:09:46 -07:00
Junio C Hamano e646a82ce2 Merge branch 'bn/http-cookiefile-config' into maint
"http.cookieFile" configuration variable clearly wants a pathname,
but we forgot to treat it as such by e.g. applying tilde expansion.

* bn/http-cookiefile-config:
  http: expand http.cookieFile as a path
  Documentation: config: improve word ordering for http.cookieFile
2016-05-31 14:08:28 -07:00
Junio C Hamano 68a6e976a8 Merge branch 'jk/test-send-sh-x-trace-elsewhere' into maint
Running tests with '-x' option to trace the individual command
executions is a useful way to debug test scripts, but some tests
that capture the standard error stream and check what the command
said can be broken with the trace output mixed in.  When running
our tests under "bash", however, we can redirect the trace output
to another file descriptor to keep the standard error of programs
being tested intact.

* jk/test-send-sh-x-trace-elsewhere:
  test-lib: set BASH_XTRACEFD automatically
2016-05-31 14:08:27 -07:00
Junio C Hamano 9ee8f9409c Merge branch 'js/name-rev-use-oldest-ref' into maint
"git describe --contains" often made a hard-to-justify choice of
tag to give name to a given commit, because it tried to come up
with a name with smallest number of hops from a tag, causing an old
commit whose close descendant that is recently tagged were not
described with respect to an old tag but with a newer tag.  It did
not help that its computation of "hop" count was further tweaked to
penalize being on a side branch of a merge.  The logic has been
updated to favor using the tag with the oldest tagger date, which
is a lot easier to explain to the end users: "We describe a commit
in terms of the (chronologically) oldest tag that contains the
commit."

* js/name-rev-use-oldest-ref:
  name-rev: include taggerdate in considering the best name
2016-05-31 14:08:26 -07:00
Junio C Hamano b051c59a00 Start preparing for 2.8.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-26 13:21:00 -07:00
Junio C Hamano 6396212d1c Merge branch 'jc/linkgit-fix' into maint
Many 'linkgit:<git documentation page>' references were broken,
which are all fixed with this.

* jc/linkgit-fix:
  Documentation: fix linkgit references
2016-05-26 13:17:26 -07:00
Junio C Hamano 5deca53908 Merge branch 'ls/travis-build-doc' into maint
CI test was taught to build documentation pages.

* ls/travis-build-doc:
  travis-ci: build documentation
2016-05-26 13:17:25 -07:00
Junio C Hamano f14acabf3a Merge branch 'jc/fsck-nul-in-commit' into maint
"git fsck" learned to catch NUL byte in a commit object as
potential error and warn.

* jc/fsck-nul-in-commit:
  fsck: detect and warn a commit with embedded NUL
  fsck_commit_buffer(): do not special case the last validation
2016-05-26 13:17:24 -07:00
Junio C Hamano cca92531e3 Merge branch 'jk/rebase-interative-eval-fix' into maint
Portability enhancement for "rebase -i" to help platforms whose
shell does not like "for i in <empty>" (which is not POSIX-kosher).

* jk/rebase-interative-eval-fix:
  rebase--interactive: avoid empty list in shell for-loop
2016-05-26 13:17:24 -07:00
Junio C Hamano e29300d69f Merge branch 'js/windows-dotgit' into maint
On Windows, .git and optionally any files whose name starts with a
dot are now marked as hidden, with a core.hideDotFiles knob to
customize this behaviour.

* js/windows-dotgit:
  mingw: remove unnecessary definition
  mingw: introduce the 'core.hideDotFiles' setting
2016-05-26 13:17:23 -07:00
Junio C Hamano 968004c39c Merge branch 'kf/gpg-sig-verification-doc' into maint
Documentation for "git merge --verify-signatures" has been updated
to clarify that the signature of only the commit at the tip is
verified.  Also the phrasing used for signature and key validity is
adjusted to align with that used by OpenPGP.

* kf/gpg-sig-verification-doc:
  Documentation: clarify signature verification
2016-05-26 13:17:22 -07:00
Junio C Hamano d07211b5fa Merge branch 'lp/typofixes' into maint
Typofixes.

* lp/typofixes:
  typofix: assorted typofixes in comments, documentation and messages
2016-05-26 13:17:21 -07:00
Junio C Hamano 1f62b9256d Merge branch 'sb/z-is-gnutar-ism' into maint
Test fix.

* sb/z-is-gnutar-ism:
  t6041: do not compress backup tar file
  t3513: do not compress backup tar file
2016-05-26 13:17:21 -07:00
Junio C Hamano b262b8f889 Merge branch 'va/i18n-misc-updates' into maint
Mark several messages for translation.

* va/i18n-misc-updates:
  i18n: unpack-trees: avoid substituting only a verb in sentences
  i18n: builtin/pull.c: split strings marked for translation
  i18n: builtin/pull.c: mark placeholders for translation
  i18n: git-parse-remote.sh: mark strings for translation
  i18n: branch: move comment for translators
  i18n: branch: unmark string for translation
  i18n: builtin/rm.c: remove a comma ',' from string
  i18n: unpack-trees: mark strings for translation
  i18n: builtin/branch.c: mark option for translation
  i18n: index-pack: use plural string instead of normal one
2016-05-26 13:17:20 -07:00
Junio C Hamano 57b76d3379 Merge branch 'bn/config-doc-tt-varnames' into maint
Doc formatting fixes.

* bn/config-doc-tt-varnames:
  config: consistently format $variables in monospaced font
  config: describe 'pathname' value type
2016-05-26 13:17:19 -07:00
Junio C Hamano 4e327bb4c2 Merge branch 'nd/remote-plural-ours-plus-theirs' into maint
Message fix.

* nd/remote-plural-ours-plus-theirs:
  remote.c: specify correct plural form in "commit diverge" message
2016-05-26 13:17:18 -07:00
Junio C Hamano e8c7b8cf68 Merge branch 'ak/t4151-ls-files-could-be-empty' into maint
Test fix.

* ak/t4151-ls-files-could-be-empty:
  t4151: make sure argument to 'test -z' is given
2016-05-26 13:17:17 -07:00
Junio C Hamano 6de6aba9f2 Merge branch 'jc/test-seq' into maint
Test fix.

* jc/test-seq:
  test-lib-functions.sh: rewrite test_seq without Perl
  test-lib-functions.sh: remove misleading comment on test_seq
2016-05-26 13:17:16 -07:00
Junio C Hamano 86a1d147e8 Merge branch 'tb/t5601-sed-fix' into maint
Test fix.

* tb/t5601-sed-fix:
  t5601: Remove trailing space in sed expression
2016-05-26 13:17:15 -07:00
Junio C Hamano 6db5205148 Merge branch 'va/i18n-remote-comment-to-align' into maint
Message fix.

* va/i18n-remote-comment-to-align:
  i18n: remote: add comment for translators
2016-05-26 13:17:14 -07:00
Junio C Hamano 31efe2a8a8 Merge branch 'va/mailinfo-doc-typofix' into maint
Typofix.

* va/mailinfo-doc-typofix:
  Documentation/git-mailinfo: fix typo
2016-05-26 13:17:14 -07:00
Junio C Hamano adbcfe6547 Merge branch 'maint-2.7' into maint
* maint-2.7:
  archive-tar: convert snprintf to xsnprintf
2016-05-26 13:16:51 -07:00
Karsten Blees f7f90e0f4f mingw: make isatty() recognize MSYS2's pseudo terminals (/dev/pty*)
MSYS2 emulates pseudo terminals via named pipes, and isatty() returns 0
for such file descriptors. Therefore, some interactive functionality
(such as launching a pager, asking if a failed unlink should be repeated
etc.) doesn't work when run in a terminal emulator that uses MSYS2's
ptys (such as mintty).

However, MSYS2 uses special names for its pty pipes ('msys-*-pty*'),
which allows us to distinguish them from normal piped input / output.

On startup, check if stdin / stdout / stderr are connected to such pipes
using the NtQueryObject API from NTDll.dll. If the names match, adjust
the flags in MSVCRT's ioinfo structure accordingly.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-26 13:12:02 -07:00
Junio C Hamano 50b4a7807f Merge branch 'jk/war-on-sprintf' into maint-2.7
* jk/war-on-sprintf:
  archive-tar: convert snprintf to xsnprintf
2016-05-26 10:45:37 -07:00
Jeff King 9e6c1e91a3 archive-tar: convert snprintf to xsnprintf
Commit f2f0267 (archive-tar: use xsnprintf for trivial
formatting, 2015-09-24) converted cases of "sprintf" to
"xsnprintf", but accidentally left one as just "snprintf".
This meant that we could silently truncate the resulting
buffer instead of flagging an error.

In practice, this is impossible to achieve, as we are
formatting a ustar checksum, which can be at most 7
characters. But the point of xsnprintf is to document and
check for "should be impossible" conditions; this site was
just accidentally mis-converted during f2f0267.

Noticed-by: Paul Green <Paul.Green@stratus.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-26 10:44:26 -07:00
Junio C Hamano 0f8e831356 Git 2.8.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-18 15:32:41 -07:00
Junio C Hamano 66106691a1 Merge branch 'sb/misc-cleanups' into HEAD
* sb/misc-cleanups:
  submodule-config: don't shadow `cache`
  config.c: drop local variable
  credential-cache, send_request: close fd when done
  bundle: don't leak an fd in case of early return
  abbrev_sha1_in_line: don't leak memory
  notes: don't leak memory in git_config_get_notes_strategy
2016-05-18 14:40:15 -07:00
Junio C Hamano 989cbd4556 Merge branch 'ew/doc-split-pack-disables-bitmap' into HEAD
Doc update.

* ew/doc-split-pack-disables-bitmap:
  pack-objects: warn on split packs disabling bitmaps
2016-05-18 14:40:15 -07:00
Junio C Hamano 10b6646afc Merge branch 'sb/clean-test-fix' into HEAD
* sb/clean-test-fix:
  t7300: mark test with SANITY
2016-05-18 14:40:14 -07:00
Junio C Hamano 8d61f0f07d Merge branch 'rn/glossary-typofix' into HEAD
* rn/glossary-typofix:
  Documentation: fix typo 'In such these cases'
2016-05-18 14:40:14 -07:00
Junio C Hamano 977cb3e2c5 Merge branch 'ew/normal-to-e' into HEAD
* ew/normal-to-e:
  .mailmap: update to my shorter email address
2016-05-18 14:40:12 -07:00
Junio C Hamano 258b862edb Merge branch 'sb/config-exit-status-list' into HEAD
Doc update.

* sb/config-exit-status-list:
  config doc: improve exit code listing
2016-05-18 14:40:12 -07:00
Junio C Hamano 87c594471d Merge branch 'rt/string-list-lookup-cleanup' into HEAD
Code cleanup.

* rt/string-list-lookup-cleanup:
  string_list: use string-list API in unsorted_string_list_lookup()
2016-05-18 14:40:12 -07:00
Junio C Hamano 9ba3b14c64 Merge branch 'jk/fix-attribute-macro-in-2.5' into HEAD
Code fixup.

* jk/fix-attribute-macro-in-2.5:
  remote.c: spell __attribute__ correctly
2016-05-18 14:40:12 -07:00
Junio C Hamano 777dec64bd Merge branch 'sg/test-lib-simplify-expr-away' into HEAD
Code cleanup.

* sg/test-lib-simplify-expr-away:
  test-lib: simplify '--option=value' parsing
2016-05-18 14:40:11 -07:00
Junio C Hamano 14af79b93d Merge branch 'nd/remove-unused' into HEAD
Code cleanup.

* nd/remove-unused:
  wrapper.c: delete dead function git_mkstemps()
  dir.c: remove dead function fnmatch_icase()
2016-05-18 14:40:11 -07:00
Junio C Hamano 13af774e26 Merge branch 'sk/gitweb-highlight-encoding' into HEAD
Some multi-byte encoding can have a backslash byte as a later part
of one letter, which would confuse "highlight" filter used in
gitweb.

* sk/gitweb-highlight-encoding:
  gitweb: apply fallback encoding before highlight
2016-05-18 14:40:10 -07:00
Junio C Hamano 09687585d1 Merge branch 'ls/travis-submitting-patches' into HEAD
* ls/travis-submitting-patches:
  Documentation: add setup instructions for Travis CI
2016-05-18 14:40:09 -07:00