This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/main by this push:
     new 6189c9a7 YETUS-1218. locate_patch falsely succeeds (#320)
6189c9a7 is described below

commit 6189c9a71056192f9206b4d2af4e8d29358784c3
Author: Allen Wittenauer <a...@apache.org>
AuthorDate: Tue Sep 12 07:39:21 2023 -0700

    YETUS-1218. locate_patch falsely succeeds (#320)
    
    Signed-off-by: Nick Dimiduk <ndimi...@apache.org>
---
 precommit/src/main/shell/core.d/patchfiles.sh | 12 +++++++++---
 precommit/src/main/shell/plugins.d/github.sh  |  2 ++
 precommit/src/main/shell/plugins.d/gitlab.sh  |  2 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/precommit/src/main/shell/core.d/patchfiles.sh 
b/precommit/src/main/shell/core.d/patchfiles.sh
index 1af59663..67dec857 100755
--- a/precommit/src/main/shell/core.d/patchfiles.sh
+++ b/precommit/src/main/shell/core.d/patchfiles.sh
@@ -155,8 +155,14 @@ function locate_patch
             "${PATCH_OR_ISSUE}" \
             "${INPUT_PATCH_FILE}" \
             "${INPUT_DIFF_FILE}"; then
-          gotit=true
-          PATCH_SYSTEM=${bugsys}
+          if [[ -f "${INPUT_PATCH_FILE}" || -f "${INPUT_DIFF_FILE}" ]]; then
+            gotit=true
+            PATCH_SYSTEM=${bugsys}
+          else
+            # this situation can happen if the bugsystem forced a full build
+            # so not an error.
+            yetus_debug "Bugsystem ${bugsys} did not actually download a 
change."
+          fi
         fi
       fi
       # did the bug system actually make us change our mind?
@@ -168,7 +174,7 @@ function locate_patch
     # ok, none of the bug systems know. let's see how smart we are
     if [[ ${gotit} == false ]]; then
       if ! generic_locate_patch "${PATCH_OR_ISSUE}" "${INPUT_PATCH_FILE}"; then
-        yetus_error "ERROR: Unsure how to process ${PATCH_OR_ISSUE}."
+        yetus_error "ERROR: Unsure how to process ${PATCH_OR_ISSUE}. 
Permissions missing?"
         cleanup_and_exit 1
       fi
       PATCH_SYSTEM=generic
diff --git a/precommit/src/main/shell/plugins.d/github.sh 
b/precommit/src/main/shell/plugins.d/github.sh
index b49c404f..71b0c3c9 100755
--- a/precommit/src/main/shell/plugins.d/github.sh
+++ b/precommit/src/main/shell/plugins.d/github.sh
@@ -522,9 +522,11 @@ function github_locate_patch
   case "${input}" in
       GHSHA:*)
         github_locate_sha_patch "${input}" "${patchout}" "${diffout}"
+        return $?
       ;;
       *)
         github_locate_pr_patch "${input}" "${patchout}" "${diffout}"
+        return $?
       ;;
   esac
 }
diff --git a/precommit/src/main/shell/plugins.d/gitlab.sh 
b/precommit/src/main/shell/plugins.d/gitlab.sh
index d647751c..8c4b0a52 100755
--- a/precommit/src/main/shell/plugins.d/gitlab.sh
+++ b/precommit/src/main/shell/plugins.d/gitlab.sh
@@ -346,9 +346,11 @@ function gitlab_locate_patch
   case "${input}" in
       GLSHA:*)
         gitlab_locate_sha_patch "${input}" "${patchout}" "${diffout}"
+        return $?
       ;;
       *)
         gitlab_locate_mr_patch "${input}" "${patchout}" "${diffout}"
+        return $?
       ;;
   esac
 }

Reply via email to