]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Sync with 2.33.8
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 11 Mar 2023 19:47:33 +0000 (20:47 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 17 Apr 2023 19:15:56 +0000 (21:15 +0200)
* maint-2.33: (27 commits)
  Git 2.33.8
  Git 2.32.7
  Git 2.31.8
  tests: avoid using `test_i18ncmp`
  Git 2.30.9
  gettext: avoid using gettext if the locale dir is not present
  apply --reject: overwrite existing `.rej` symlink if it exists
  http.c: clear the 'finished' member once we are done with it
  clone.c: avoid "exceeds maximum object size" error with GCC v12.x
  range-diff: use ssize_t for parsed "len" in read_patches()
  range-diff: handle unterminated lines in read_patches()
  range-diff: drop useless "offset" variable from read_patches()
  t5604: GETTEXT_POISON fix, conclusion
  t5604: GETTEXT_POISON fix, part 1
  t5619: GETTEXT_POISON fix
  t0003: GETTEXT_POISON fix, conclusion
  t0003: GETTEXT_POISON fix, part 1
  t0033: GETTEXT_POISON fix
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
  ...

1  2 
.github/workflows/main.yml
ci/install-dependencies.sh
ci/lib.sh
compat/nedmalloc/nedmalloc.c
config.c
dir.c
gettext.h
http.c

Simple merge
Simple merge
diff --cc ci/lib.sh
index 82cb17f8eea732967860ffe5b6c82f5be92d96c7,1deb8ca352b235125ac0e0bd0f999b53e0b08f2a..bbc19028d80030a4a88127840436d2b2fa4699e6
+++ b/ci/lib.sh
@@@ -183,7 -183,8 +183,8 @@@ export GIT_TEST_CLONE_2GB=tru
  export SKIP_DASHED_BUILT_INS=YesPlease
  
  case "$jobname" in
 -linux-clang|linux-gcc)
 +linux-clang|linux-gcc|linux-leaks)
+       PYTHON_PACKAGE=python2
        if [ "$jobname" = linux-gcc ]
        then
                export CC=gcc-8
Simple merge
diff --cc config.c
Simple merge
diff --cc dir.c
index 5aa6fbad0b76ad3ad026a8775761f9c7ea1776e8,03c4d212672bc4b68bc45a514fe16180f57ee1f4..ea78f606230d4acd229f1f073b8781ec16256e78
--- 1/dir.c
--- 2/dir.c
+++ b/dir.c
@@@ -3039,120 -2970,6 +3039,129 @@@ int is_empty_dir(const char *path
        return ret;
  }
  
 +char *git_url_basename(const char *repo, int is_bundle, int is_bare)
 +{
 +      const char *end = repo + strlen(repo), *start, *ptr;
 +      size_t len;
 +      char *dir;
 +
 +      /*
 +       * Skip scheme.
 +       */
 +      start = strstr(repo, "://");
 +      if (start == NULL)
 +              start = repo;
 +      else
 +              start += 3;
 +
 +      /*
 +       * Skip authentication data. The stripping does happen
 +       * greedily, such that we strip up to the last '@' inside
 +       * the host part.
 +       */
 +      for (ptr = start; ptr < end && !is_dir_sep(*ptr); ptr++) {
 +              if (*ptr == '@')
 +                      start = ptr + 1;
 +      }
 +
 +      /*
 +       * Strip trailing spaces, slashes and /.git
 +       */
 +      while (start < end && (is_dir_sep(end[-1]) || isspace(end[-1])))
 +              end--;
 +      if (end - start > 5 && is_dir_sep(end[-5]) &&
 +          !strncmp(end - 4, ".git", 4)) {
 +              end -= 5;
 +              while (start < end && is_dir_sep(end[-1]))
 +                      end--;
 +      }
 +
++      /*
++       * It should not be possible to overflow `ptrdiff_t` by passing in an
++       * insanely long URL, but GCC does not know that and will complain
++       * without this check.
++       */
++      if (end - start < 0)
++              die(_("No directory name could be guessed.\n"
++                    "Please specify a directory on the command line"));
++
 +      /*
 +       * Strip trailing port number if we've got only a
 +       * hostname (that is, there is no dir separator but a
 +       * colon). This check is required such that we do not
 +       * strip URI's like '/foo/bar:2222.git', which should
 +       * result in a dir '2222' being guessed due to backwards
 +       * compatibility.
 +       */
 +      if (memchr(start, '/', end - start) == NULL
 +          && memchr(start, ':', end - start) != NULL) {
 +              ptr = end;
 +              while (start < ptr && isdigit(ptr[-1]) && ptr[-1] != ':')
 +                      ptr--;
 +              if (start < ptr && ptr[-1] == ':')
 +                      end = ptr - 1;
 +      }
 +
 +      /*
 +       * Find last component. To remain backwards compatible we
 +       * also regard colons as path separators, such that
 +       * cloning a repository 'foo:bar.git' would result in a
 +       * directory 'bar' being guessed.
 +       */
 +      ptr = end;
 +      while (start < ptr && !is_dir_sep(ptr[-1]) && ptr[-1] != ':')
 +              ptr--;
 +      start = ptr;
 +
 +      /*
 +       * Strip .{bundle,git}.
 +       */
 +      len = end - start;
 +      strip_suffix_mem(start, &len, is_bundle ? ".bundle" : ".git");
 +
 +      if (!len || (len == 1 && *start == '/'))
 +              die(_("No directory name could be guessed.\n"
 +                    "Please specify a directory on the command line"));
 +
 +      if (is_bare)
 +              dir = xstrfmt("%.*s.git", (int)len, start);
 +      else
 +              dir = xstrndup(start, len);
 +      /*
 +       * Replace sequences of 'control' characters and whitespace
 +       * with one ascii space, remove leading and trailing spaces.
 +       */
 +      if (*dir) {
 +              char *out = dir;
 +              int prev_space = 1 /* strip leading whitespace */;
 +              for (end = dir; *end; ++end) {
 +                      char ch = *end;
 +                      if ((unsigned char)ch < '\x20')
 +                              ch = '\x20';
 +                      if (isspace(ch)) {
 +                              if (prev_space)
 +                                      continue;
 +                              prev_space = 1;
 +                      } else
 +                              prev_space = 0;
 +                      *out++ = ch;
 +              }
 +              *out = '\0';
 +              if (out > dir && prev_space)
 +                      out[-1] = '\0';
 +      }
 +      return dir;
 +}
 +
 +void strip_dir_trailing_slashes(char *dir)
 +{
 +      char *end = dir + strlen(dir);
 +
 +      while (dir < end - 1 && is_dir_sep(end[-1]))
 +              end--;
 +      *end = '\0';
 +}
 +
  static int remove_dir_recurse(struct strbuf *path, int flag, int *kept_up)
  {
        DIR *dir;
diff --cc gettext.h
Simple merge
diff --cc http.c
index 5c2fcfa84003a17afd55299edd3f88a997c9ad2f,a63589785dad63e54c6fa001ac6e98e005e85a53..7247234591c44f03a10d00d19a53548eb659ee28
--- 1/http.c
--- 2/http.c
+++ b/http.c
@@@ -1398,6 -1546,38 +1398,32 @@@ void run_active_slot(struct active_requ
                        select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
                }
        }
 -#else
 -      while (slot->in_use) {
 -              slot->curl_result = curl_easy_perform(slot->curl);
 -              finish_active_slot(slot);
 -      }
 -#endif
+       /*
+        * The value of slot->finished we set before the loop was used
+        * to set our "finished" variable when our request completed.
+        *
+        * 1. The slot may not have been reused for another requst
+        *    yet, in which case it still has &finished.
+        *
+        * 2. The slot may already be in-use to serve another request,
+        *    which can further be divided into two cases:
+        *
+        * (a) If call run_active_slot() hasn't been called for that
+        *     other request, slot->finished would have been cleared
+        *     by get_active_slot() and has NULL.
+        *
+        * (b) If the request did call run_active_slot(), then the
+        *     call would have updated slot->finished at the beginning
+        *     of this function, and with the clearing of the member
+        *     below, we would find that slot->finished is now NULL.
+        *
+        * In all cases, slot->finished has no useful information to
+        * anybody at this point.  Some compilers warn us for
+        * attempting to smuggle a pointer that is about to become
+        * invalid, i.e. &finished.  We clear it here to assure them.
+        */
+       slot->finished = NULL;
  }
  
  static void release_active_slot(struct active_request_slot *slot)