プロジェクト

全般

プロフィール

Vote #75889

未完了

empty svn logentry crashes revision batch reading

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
3
version_id:
0
issue_org_id:
18754
author_id:
118295
assigned_to_id:
0
comments:
8
status_id:
1
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

If svn xml log contains logentry without data the revision reading is interruped and no error message is written to redmine logs.

Revisions are read from xml returned from command:

svn log --xml ...

Example:





mkrol
2015-01-02T06:24:51.507749Z
test commit



...

@logentry@ for revision 2177 is empty - there is no @author@, @msg@ and @date@ tags.
But the code assumes that @revision@, @date@ and @msg@ exist in @logentry@.
This is the code from @lib/redmine/scm/adapters/subversion_adapter.rb@, lines 175-196:


            begin
              doc = parse_xml(output)
              each_xml_element(doc['log'], 'logentry') do |logentry|

               (...)

                revisions << Revision.new({:identifier => logentry['revision'],
                              :author => (logentry['author'] ? logentry['author']['__content__'] : ""),
                              :time => Time.parse(logentry['date']['__content__'].to_s).localtime,
                              :message => logentry['msg']['__content__'],
                              :paths => paths
                            })
              end
            rescue
            end

If @@ does not exist the @logentry['msg']@ returns @nil@. The call @logentry['msg']['content']@ becomes @nil['content']@ and exception is thrown (then it is ignored and it is ignored outside loop...).

The existing of @logentry['author']@ is checked before reading @logentry['author']['content']@. It should be done before reading @date@ and @msg@ also. For example:


                revisions << Revision.new({:identifier => logentry['revision'],
                              :author => (logentry['author'] ? logentry['author']['__content__'] : ""),
                              :time => (logentry['date'] ? Time.parse(logentry['date']['__content__'].to_s).localtime : nil),
                              :message => (logentry['msg'] ? logentry['msg']['__content__'] : ""),
                              :paths => paths
                            })

Why there are empty revisions in svn log? This is when revision has only files which are not visible for user performing @svn log@ command. Propably it's a rare case.


journals

My environment:
<pre>
Environment:
Redmine version 2.6.0.stable.13735
Ruby version 1.9.3-p194 (2012-04-20) [x86_64-linux]
Rails version 3.2.21
Environment production
Database adapter Mysql2
SCM:
Subversion 1.6.17
Git 1.7.10.4
Filesystem
Redmine plugins:
redmine_checklists 3.0.2
redmine_close_button 0.0.8
</pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
We face this issue often because the repository we use contains protected data along with the actual project data. This happens actually very often, provided you have some permission management inside svn. I think this is not awkward or a special case at all and should be fixed.

IMHO this ticket duplicates: #3663, #7086

--------------------------------------------------------------------------------
I created a patch to address this problem, instead of bailing out for the whole batch any empty log entries are skipped and a message is logged (loglevel INFO)
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Stephan Wiehr wrote:
> I created a patch to address this problem, instead of bailing out for the whole batch any empty log entries are skipped and a message is logged (loglevel INFO)

I think logging is reasonable, but discrete revision causes another problem.
I think re-raising exception with logging is better.
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> Stephan Wiehr wrote:
> > I created a patch to address this problem, instead of bailing out for the whole batch any empty log entries are skipped and a message is logged (loglevel INFO)
>
> I think logging is reasonable, but discrete revision causes another problem.
> I think re-raising exception with logging is better.

The current code just stops processing further logentries and then consumes the exception in an unconditional begin ... rescue end block.

The provided patch is meant not only to log but also to enable continuation of the logentry processing.

Current code:
<pre>
begin
doc = parse_xml(output)
each_xml_element(doc['log'], 'logentry') do |logentry|
[code where exception occurs]
end
rescue
end
</pre>

Code with patch:
<pre>
begin
doc = parse_xml(output)
each_xml_element(doc['log'], 'logentry') do |logentry|
begin
[code where exception occurs]
rescue
logger.info "Skipped svn revision ##{logentry['revision']} due to parse error" if logentry && logentry['revision']
end
end
rescue
end
</pre>

I don't see how re-raising the exception would help here.

--------------------------------------------------------------------------------


related_issues

relates,Needs feedback,3663,Problem with subversion logentry without date nor author.
relates,New,7086,Few fixes for subversion

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0