From: Junio C Hamano Date: Tue, 13 Dec 2022 12:20:35 +0000 (+0900) Subject: Merge branch 'maint-2.36' into maint-2.37 X-Git-Tag: v2.39.1~1^2~1^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=431f6e67e620f1b4f9acfddd356b56a3fd5c5e79;p=thirdparty%2Fgit.git Merge branch 'maint-2.36' into maint-2.37 --- 431f6e67e620f1b4f9acfddd356b56a3fd5c5e79 diff --cc fsck.h index 6f801e53b1,cc3379d4e9..121b831985 --- a/fsck.h +++ b/fsck.h @@@ -55,7 -55,12 +55,11 @@@ enum fsck_msg_type FUNC(GITMODULES_URL, ERROR) \ FUNC(GITMODULES_PATH, ERROR) \ FUNC(GITMODULES_UPDATE, ERROR) \ + FUNC(GITATTRIBUTES_MISSING, ERROR) \ + FUNC(GITATTRIBUTES_LARGE, ERROR) \ + FUNC(GITATTRIBUTES_LINE_LENGTH, ERROR) \ + FUNC(GITATTRIBUTES_BLOB, ERROR) \ /* warnings */ \ - FUNC(BAD_FILEMODE, WARN) \ FUNC(EMPTY_NAME, WARN) \ FUNC(FULL_PATHNAME, WARN) \ FUNC(HAS_DOT, WARN) \ diff --cc git-compat-util.h index 6aee4d92e7,33636827d5..fdb24fcd2f --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -998,28 -989,14 +998,36 @@@ static inline unsigned long cast_size_t return (unsigned long)a; } + static inline int cast_size_t_to_int(size_t a) + { + if (a > INT_MAX) + die("number too large to represent as int on this platform: %"PRIuMAX, + (uintmax_t)a); + return (int)a; + } + +/* + * Limit size of IO chunks, because huge chunks only cause pain. OS X + * 64-bit is buggy, returning EINVAL if len >= INT_MAX; and even in + * the absence of bugs, large chunks can result in bad latencies when + * you decide to kill the process. + * + * We pick 8 MiB as our default, but if the platform defines SSIZE_MAX + * that is smaller than that, clip it to SSIZE_MAX, as a call to + * read(2) or write(2) larger than that is allowed to fail. As the last + * resort, we allow a port to pass via CFLAGS e.g. "-DMAX_IO_SIZE=value" + * to override this, if the definition of SSIZE_MAX given by the platform + * is broken. + */ +#ifndef MAX_IO_SIZE +# define MAX_IO_SIZE_DEFAULT (8*1024*1024) +# if defined(SSIZE_MAX) && (SSIZE_MAX < MAX_IO_SIZE_DEFAULT) +# define MAX_IO_SIZE SSIZE_MAX +# else +# define MAX_IO_SIZE MAX_IO_SIZE_DEFAULT +# endif +#endif + #ifdef HAVE_ALLOCA_H # include # define xalloca(size) (alloca(size))