You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Mockford, Ian " <Ia...@thalesgroup.com> on 2010/02/23 12:41:37 UTC

contrib hook enforcer throws on empty renamed file

Using the enforcer script from contrib/hooks, I get an error when a 
commit includes a renamed empty file, for example:
AssertionError: Expected left file info, got: 'Deleted:
trunk/EmptyDocToBeRenamed.txt'

This only happens if the file is empty.

The exact result seems to depend on the order in which the two 
operations that constitute a rename happen - Delete & Add-by-copying.

The problem seems to be that enforcer always expects a "diff" output
following the file rename, but if the file is empty, svnlook diff 
shows no diff output bars.

(enforcer using svnlook version 1.6.9 (r901367), on Windows XP)

Can anyone confirm this is a bug? 
Or a possible change to svnlook output format?

****************************************************************************
Please consider the environment before printing this email.
Thales Research and Technology (UK) Limited DISCLAIMER:  The information
contained in this e-mail is confidential.  It may also be legally
privileged.  It is intended only for the stated addressee(s) and access to
it by any other person is unauthorised.  If you are not an addressee, you
must not disclose, copy, circulate or in any other way use or rely on the
information contained herein.  Such unauthorised use may be unlawful.  We
may monitor all e-mail communications through our networks.  If you have
received this e-mail in error, please inform us immediately on +44 (0)1293
575987 and delete it and all copies from your system.  We accept no
responsibility for changes to any e-mail which occur after it has been sent.
Attachments to this e-mail may contain software viruses which could damage
your system.  We therefore recommend you virus-check all attachments before
opening.  The registered office of Thales Research and Technology (UK)
Limited is at: 2 Dashwood Lang Road, The Bourne Business Park, Addlestone,
Weybridge, Surrey KT15 2NX.  Registered in England No. 774298.
****************************************************************************

Re: svnlook diff or contrib hooks enforcer problems with empty files (was Re: contrib hook enforcer throws on empty renamed file)

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Mar 04, 2010 at 08:49:49AM +0000, icm wrote:
> Ian Mockford writes:
> 
> > [...]
> > > The problem seems to be that enforcer always expects a "diff" output
> > > following the file rename, but if the file is empty, svnlook diff 
> > > shows no diff output bars.
> > > 
> > > (enforcer using svnlook version 1.6.9 (r901367), on Windows XP)
> > > 
> > > Can anyone confirm this is a bug? 
> > > Or a possible change to svnlook output format?
> 
> My summary of the situation, for the record:
> 
> contrib\hooks\enforcer seems to struggle with empty files when using svnlook 
> v1.6.9.
> 
> I can't find if/how/where or rather, by whom, the contribs are maintained.
> 
> v1.6.5 includes this change:
> "make 'svnlook diff' show empty added or deleted files (r38458)"
> - so that might be where the change happened. But r38458 description
> includes the following:
> 
> "If we don't print any output for empty added or deleted files,
> hook scripts relying on 'svnlook diff' to gather information about
> files affected by a revision can get confused.
> E.g. contrib/hook-scripts/enforcer is known to be affected,
> it cannot enforce rules on added empty files."
> 
> I can't find any record of "E.g. contrib/hook-scripts/enforcer is known to be
> affected".
> 
> Hopefully one day someone who knows more about it will be able to confirm this
> as a problem in either svnlook or the enforcer script and possibly and fix one
> of them. If I could be sure that it was enforcer rather than svnlook that was
> wrong I could have a go at fixing it myself.
> 

I made this fix to svnlook in 1.6.5.

I think the user who reported this problem reported it on IRC,
so you'd have to search the log of the #svn IRC channel to find
a record of the statement that "enforcer is known to be affected".

I had the user test the patch and has said it fixed his particular problem.

>From what you describe it sounds like enforcer is still broken in
some way and needs some kind of fix. I'd encourage you to try to fix
this yourself and submit a patch if you can.

Thanks,
Stefan

Re: svnlook diff or contrib hooks enforcer problems with empty files (was Re: contrib hook enforcer throws on empty renamed file)

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Mar 04, 2010 at 08:49:49AM +0000, icm wrote:
> Ian Mockford writes:
> 
> > [...]
> > > The problem seems to be that enforcer always expects a "diff" output
> > > following the file rename, but if the file is empty, svnlook diff 
> > > shows no diff output bars.
> > > 
> > > (enforcer using svnlook version 1.6.9 (r901367), on Windows XP)
> > > 
> > > Can anyone confirm this is a bug? 
> > > Or a possible change to svnlook output format?
> 
> My summary of the situation, for the record:
> 
> contrib\hooks\enforcer seems to struggle with empty files when using svnlook 
> v1.6.9.
> 
> I can't find if/how/where or rather, by whom, the contribs are maintained.
> 
> v1.6.5 includes this change:
> "make 'svnlook diff' show empty added or deleted files (r38458)"
> - so that might be where the change happened. But r38458 description
> includes the following:
> 
> "If we don't print any output for empty added or deleted files,
> hook scripts relying on 'svnlook diff' to gather information about
> files affected by a revision can get confused.
> E.g. contrib/hook-scripts/enforcer is known to be affected,
> it cannot enforce rules on added empty files."
> 
> I can't find any record of "E.g. contrib/hook-scripts/enforcer is known to be
> affected".
> 
> Hopefully one day someone who knows more about it will be able to confirm this
> as a problem in either svnlook or the enforcer script and possibly and fix one
> of them. If I could be sure that it was enforcer rather than svnlook that was
> wrong I could have a go at fixing it myself.
> 

I made this fix to svnlook in 1.6.5.

I think the user who reported this problem reported it on IRC,
so you'd have to search the log of the #svn IRC channel to find
a record of the statement that "enforcer is known to be affected".

I had the user test the patch and has said it fixed his particular problem.

svnlook diff or contrib hooks enforcer problems with empty files (was Re: contrib hook enforcer throws on empty renamed file)

Posted by icm <ia...@thalesgroup.com>.
Ian Mockford writes:

> [...]
> > The problem seems to be that enforcer always expects a "diff" output
> > following the file rename, but if the file is empty, svnlook diff 
> > shows no diff output bars.
> > 
> > (enforcer using svnlook version 1.6.9 (r901367), on Windows XP)
> > 
> > Can anyone confirm this is a bug? 
> > Or a possible change to svnlook output format?

My summary of the situation, for the record:

contrib\hooks\enforcer seems to struggle with empty files when using svnlook 
v1.6.9.

I can't find if/how/where or rather, by whom, the contribs are maintained.

v1.6.5 includes this change:
"make 'svnlook diff' show empty added or deleted files (r38458)"
- so that might be where the change happened. But r38458 description
includes the following:

"If we don't print any output for empty added or deleted files,
hook scripts relying on 'svnlook diff' to gather information about
files affected by a revision can get confused.
E.g. contrib/hook-scripts/enforcer is known to be affected,
it cannot enforce rules on added empty files."

I can't find any record of "E.g. contrib/hook-scripts/enforcer is known to be
affected".

Hopefully one day someone who knows more about it will be able to confirm this
as a problem in either svnlook or the enforcer script and possibly and fix one
of them. If I could be sure that it was enforcer rather than svnlook that was
wrong I could have a go at fixing it myself.


Re: contrib hook enforcer throws on empty renamed file

Posted by icm <ia...@thalesgroup.com>.
Mockford, Ian writes:

[...]
> The problem seems to be that enforcer always expects a "diff" output
> following the file rename, but if the file is empty, svnlook diff 
> shows no diff output bars.
> 
> (enforcer using svnlook version 1.6.9 (r901367), on Windows XP)
> 
> Can anyone confirm this is a bug? 
> Or a possible change to svnlook output format?

Maybe it's svnlook not outputting a blank line? From
C:\Repo>svnlook diff -r 22 ./
I get:
Copied: trunk/testing/EmptyDocRenamed.txt (from rev 20, 
trunk/testing/EmptyDocToBeRenamed.txt)
===================================================================
Deleted: trunk/testing/EmptyDocToBeRenamed.txt
===================================================================

Should there be a blank line after the Copied: and ==== lines?