[
https://issues.apache.org/jira/browse/YETUS-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17044697#comment-17044697
]
Allen Wittenauer edited comment on YETUS-948 at 2/25/20 5:53 PM:
-----------------------------------------------------------------
find_changed_files has code that, at the core, does this:
{code}
"${AWK}" 'function p(s){sub("^[ab]/","",s); if(s!~"^/dev/null"){print s}}
/^diff --git / { p($3); p($4) }
/^(\+\+\+|---) / { p($2) }' "${INPUT_APPLIED_FILE}" | sort -u)
{code}
Running the input.patch file (origin of which is
https://github.com/lf-edge/eve/pull/683), generates the attached awk output.
The big thing that sticks out is that we're getting *empty filenames*. The
empty entries should be easy to toss, but there is a possibility that the code
is misinterpreting other lines as well. My hunch is that our awk check might
be too lenient, but I'm not particuarly sure how we can fix it so that we also
accept filenames that begin with + and - as well. Maybe we just strip the
empties and think that is good enough? Maybe make a judgment call on risk?
ping [~aajisaka], because I know he likes awk riddles. :)
was (Author: aw):
find_changed_files has code that, at the core, does this:
{code}
"${AWK}" 'function p(s){sub("^[ab]/","",s); if(s!~"^/dev/null"){print s}}
/^diff --git / { p($3); p($4) }
/^(\+\+\+|---) / { p($2) }' "${INPUT_APPLIED_FILE}" | sort -u)
{code}
Running the input.patch file (origin of which is
https://github.com/lf-edge/eve/pull/683), generates the attached awk output.
The big thing that sticks out is that we're getting *empty filenames*. The
empty entries should be easy to toss, but there is a possibility that the code
is misinterpreting other lines as well. Much hunch is that our awk check might
be too lenient, but I'm not particuarly sure how we can fix it so that we also
accept filenames that begin with + and - as well. Maybe we just strip the
empties and think that is good enough? Maybe make a judgment call on risk?
ping [~aajisaka], because I know he likes awk riddles. :)
> patches to patches confuse find_changed_files
> ---------------------------------------------
>
> Key: YETUS-948
> URL: https://issues.apache.org/jira/browse/YETUS-948
> Project: Yetus
> Issue Type: Bug
> Components: Precommit
> Affects Versions: 0.12.0
> Reporter: Allen Wittenauer
> Priority: Critical
> Attachments: awk-output.txt, input.patch
>
>
> If a patch has patches to other patches in a source tree, there is a good
> chance that find_changed_files is going to get completely confused. See
> below for more.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)