You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Branko Čibej <br...@xbc.nu> on 2004/06/09 01:34:22 UTC

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Martin Tomes wrote:

>use strict;
>  
>
use warnings; would be a good idea here.

>my $opSys = $^O;
>
>my $svnlook;
>my $openstr;
>
># Please check the path to svnlook is correct...
>if ($opSys eq 'MSWin32') {
>  $svnlook = '"c:\Program Files\subversion\bin\svnlook.exe"';
>  $openstr = '-|';
>} else {
>  $svnlook = '/usr/local/bin/svnlook';
>  $openstr = '-|:utf8';
>}
>  
>
    * I suggest you move configurable paramters to the very top of the
      script, so that they're easier to find.
    * Why doesn't the Win32 variant open the svnlook pipe in utf8 mode?
      I wonder if svnlook does, in fact, print utf8 paths. Hmmm... no it
      does not. Svnlook will only write utf-8 filenames if your current
      locale is utf-8. So much for this script then -- it won't work.
      You should use the bindings instead.
    * Which version of Perl do you need for '-l:utf8'? Maybe you need a
      "require" line.

># If there is too much debug output to STDERR subversion doesn't like it, so,
># if a lot of output is expected send it to a file instead.
>if ($debug > 1) {
>  if ($opSys eq 'MSWin32') {
>    open(STDERR, ">c:/svnlog.txt");
>  } else {
>    open(STDERR, ">/tmp/svnlog.txt");
>  }
>}
>  
>
There is sucha thing as File::Temp in Perl...


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by kf...@collab.net.
Martin Tomes <li...@tomes.org> writes:
> Many thanks for the comments.  If the above changes are acceptable I
> will re-post the script.

Sure -- assuming that includes changed copyright, we can check it
right into the repository then.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Martin Tomes <li...@tomes.org>.
Branko Čibej wrote:

> Martin Tomes wrote:
> 
> 
>>use strict;
> use warnings; would be a good idea here.

OK, done.

>     * I suggest you move configurable paramters to the very top of the
>       script, so that they're easier to find.

I have moved them to just after the copyright bit.

>     * Why doesn't the Win32 variant open the svnlook pipe in utf8 mode?
>       I wonder if svnlook does, in fact, print utf8 paths. Hmmm... no it
>       does not. Svnlook will only write utf-8 filenames if your current
>       locale is utf-8. So much for this script then -- it won't work.
>       You should use the bindings instead.

I have added 'use locale' to the script which according to the perldoc will ensure that perl uses 
the current locale settings.  I have removed the utf8 stuff from the open.  The use locale is 
accepted by ActiveState perl on Windows. Will this solve the problem?  If the locale is set to use 
utf8 will svnlook and this script play well together?

The book says that svnlook is meant to be used for commit hooks, doesn't your above comment mean 
that svnlook has very limited value in this area?

If svnlook and perl cannot be made to work together I will work on a version of this script which 
uses the bindings (which I have used for other scripts).  Question, are the perl bindings installed 
on windows by the svn windows installer?

>     * Which version of Perl do you need for '-l:utf8'? Maybe you need a
>       "require" line.

That I don't know, but I have removed the utf8 bit anyway for now.  I have added a require 5.0004 
which is the earliest version supporting use locale.

> 
>>   open(STDERR, ">c:/svnlog.txt");
> 
> There is sucha thing as File::Temp in Perl...

I know, this is only for debugging and it is useful to know the name of the file the output will 
appear in, if I used File::Temp I would have to write out the file name somewhere so I knew where to 
look for the debug output.  Of course I could remove the debug code for the published version if it 
offends sensibilities:-)

Many thanks for the comments.  If the above changes are acceptable I will re-post the script.

-- 
Martin Tomes
echo 'Martin x Tomes at controls x eurotherm x co x uk'\
  | sed -e 's/ x /\./g' -e 's/ at /@/'

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Ben Reser <be...@reser.org>.
On Wed, Jun 09, 2004 at 07:27:50AM -0500, Jeremy Bettis wrote:
> http://article.gmane.org/gmane.comp.version-control.subversion.user/11372
> 
> I did ask, no one answered.

There really isn't any documentation for the Python bindings.  They
closely follow the C API.  So looking at the documentation for it is
probably helpful.  Beyond that you have to read the SWIG code and
experiment. :(

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by kf...@collab.net.
Branko Čibej <br...@xbc.nu> writes:
> Sorry, that's not good enough for a script that you want to maintain in
> the svn repository.

A script can be "in progress" in the svn repository, IMHO.  If we
don't feel it meets the portability/robustness standards that apply to
the rest of Subversion, then the script should be placed under
contrib/ instead of tools/, that's all.

*Some* case-protection script is better than none, after all, and it's
a lot easier for people to work on it (and review changes) if it's
under version control here.

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Branko Čibej <br...@xbc.nu>.
Jeremy Bettis wrote:

>----- Original Message ----- 
>From: "Branko Čibej" <br...@xbc.nu>
>  
>
>>>That's all fine and good, but I can't find any documentation on the
>>>bindings.
>>>
>>>      
>>>
>>Perhaps you should ask. :.-)
>>    
>>
>
>http://article.gmane.org/gmane.comp.version-control.subversion.user/11372
>
>I did ask, no one answered.
>
>  
>
>>>Also, your case a) is not relevant, since all the paths here are
>>>examined on the server, the client doesn't come into play,
>>>
>>>      
>>>
>>Yes it is relevant. The client does local->utf8 conversion, and the
>>server does utf8->local conversion. If the two "local"s aren't the same,
>>the conversion will fail or worse, will be incorrect.
>>    
>>
>I still don't think this matters.  If you check in a file of xyö.c and the
>hook sees it as xyo.c, as long as there isn't a file named xyO.c it will be
>allowed.  So it doesn't really matter.
>  
>
That's assuming that the client and server local encodings are remotely
compatible. They might not be; for example, imagine a client that adds a
file with cyrillic characters, and a server that only understands latin
with diacritics. In this combination, it's almost guaranteed not to
work. (Or Arabic/Hebrew vs. Latin, etc).

>Also, I think that it would be better to put this into contrib as is to
>quiet the 100's of messages on the users mailing list about case-sensitivity
>even if it won't work right in 1% of the cases.
>  
>
I suppose it is 1% at this point... I think the ideal solution would be
to write a program that uses the Subversion libraries (probably based on
the svnlook code). The only remaining problem is unicode case folding,
which I don't think we can assume the iconv library provides. Sigh.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Jeremy Bettis <je...@deadbeef.com>.
----- Original Message ----- 
From: "Branko Čibej" <br...@xbc.nu>
> >That's all fine and good, but I can't find any documentation on the
> >bindings.
> >
> Perhaps you should ask. :.-)

http://article.gmane.org/gmane.comp.version-control.subversion.user/11372

I did ask, no one answered.

>
> >Also, your case a) is not relevant, since all the paths here are
> >examined on the server, the client doesn't come into play,
> >
> Yes it is relevant. The client does local->utf8 conversion, and the
> server does utf8->local conversion. If the two "local"s aren't the same,
> the conversion will fail or worse, will be incorrect.

I still don't think this matters.  If you check in a file of xyö.c and the
hook sees it as xyo.c, as long as there isn't a file named xyO.c it will be
allowed.  So it doesn't really matter.

Also, I think that it would be better to put this into contrib as is to
quiet the 100's of messages on the users mailing list about case-sensitivity
even if it won't work right in 1% of the cases.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Branko Čibej <br...@xbc.nu>.
Jeremy Bettis wrote:

>>Jeremy Bettis wrote:
>>
>>    
>>
>>>----- Original Message ----- 
>>>From: "Branko Čibej" <br...@xbc.nu>
>>>
>>>
>>>      
>>>
>>>>   * Why doesn't the Win32 variant open the svnlook pipe in utf8 mode?
>>>>     I wonder if svnlook does, in fact, print utf8 paths. Hmmm... no it
>>>>     does not. Svnlook will only write utf-8 filenames if your current
>>>>     locale is utf-8. So much for this script then -- it won't work.
>>>>     You should use the bindings instead.
>>>>
>>>>
>>>>        
>>>>
>>>The utf8 didn't work for me with ActivePerl, so I took it out.
>>>
>>>
>>>      
>>>
>>You're missing the point. svnlook does not output paths in utf-8.
>>Therefore your hook a) won't work if the server uses a different default
>>locale than the client (which is very probable), and b) will interpret
>>the paths incorrectly if it thinks they're utf-8 when they're actually
>>    
>>
>not.
>
>
>That's all fine and good, but I can't find any documentation on the
>bindings.
>
Perhaps you should ask. :.-)

>Also, your case a) is not relevant, since all the paths here are
>examined on the server, the client doesn't come into play,
>
Yes it is relevant. The client does local->utf8 conversion, and the
server does utf8->local conversion. If the two "local"s aren't the same,
the conversion will fail or worse, will be incorrect.

>also for me, all my machines are in the same locale.
>  
>
Sorry, that's not good enough for a script that you want to maintain in
the svn repository.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Jeremy Bettis <je...@deadbeef.com>.
----- Original Message ----- 
From: "Branko Čibej" <br...@xbc.nu>
To: "Jeremy Bettis" <je...@deadbeef.com>
Cc: "Martin Tomes" <li...@tomes.org>; <de...@subversion.tigris.org>
Sent: Tuesday, June 08, 2004 10:20 PM
Subject: Re: pre-commit hook that stops CaSe-InSenSiTive collisions


> Jeremy Bettis wrote:
>
> >----- Original Message ----- 
> >From: "Branko Čibej" <br...@xbc.nu>
> >
> >
> >>    * Why doesn't the Win32 variant open the svnlook pipe in utf8 mode?
> >>      I wonder if svnlook does, in fact, print utf8 paths. Hmmm... no it
> >>      does not. Svnlook will only write utf-8 filenames if your current
> >>      locale is utf-8. So much for this script then -- it won't work.
> >>      You should use the bindings instead.
> >>
> >>
> >The utf8 didn't work for me with ActivePerl, so I took it out.
> >
> >
> You're missing the point. svnlook does not output paths in utf-8.
> Therefore your hook a) won't work if the server uses a different default
> locale than the client (which is very probable), and b) will interpret
> the paths incorrectly if it thinks they're utf-8 when they're actually
not.


That's all fine and good, but I can't find any documentation on the
bindings.  Also, your case a) is not relevant, since all the paths here are
examined on the server, the client doesn't come into play, also for me, all
my machines are in the same locale.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Branko Čibej <br...@xbc.nu>.
Jeremy Bettis wrote:

>----- Original Message ----- 
>From: "Branko Čibej" <br...@xbc.nu>
>  
>
>>    * Why doesn't the Win32 variant open the svnlook pipe in utf8 mode?
>>      I wonder if svnlook does, in fact, print utf8 paths. Hmmm... no it
>>      does not. Svnlook will only write utf-8 filenames if your current
>>      locale is utf-8. So much for this script then -- it won't work.
>>      You should use the bindings instead.
>>    
>>
>The utf8 didn't work for me with ActivePerl, so I took it out.
>  
>
You're missing the point. svnlook does not output paths in utf-8.
Therefore your hook a) won't work if the server uses a different default
locale than the client (which is very probable), and b) will interpret
the paths incorrectly if it thinks they're utf-8 when they're actually not.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Jeremy Bettis <je...@deadbeef.com>.
----- Original Message ----- 
From: "Branko Čibej" <br...@xbc.nu>
>     * Why doesn't the Win32 variant open the svnlook pipe in utf8 mode?
>       I wonder if svnlook does, in fact, print utf8 paths. Hmmm... no it
>       does not. Svnlook will only write utf-8 filenames if your current
>       locale is utf-8. So much for this script then -- it won't work.
>       You should use the bindings instead.
The utf8 didn't work for me with ActivePerl, so I took it out.

> There is sucha thing as File::Temp in Perl...

Doesn't really matter, it's just debugging.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Branko Čibej <br...@xbc.nu>.
Steve Williams wrote:

>The path to subversion\bin should be in the PATH environment variable for
>Windows.  Otherwise you would have to type the full path every time just to
>run 'svn'.  It would also have to be in the path for *nix as well for the
>same reason, so why does the full path have to be specified for svnlook?
>  
>
Because you might not want to put Subversion in the path, or have
different versions for the server and client. Or a million other reasons.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Jeremy Bettis <je...@deadbeef.com>.
----- Original Message ----- 
From: "Steve Williams" <st...@kromestudios.com>
> The path to subversion\bin should be in the PATH environment variable for
> Windows.  Otherwise you would have to type the full path every time just
to
> run 'svn'.  It would also have to be in the path for *nix as well for the
> same reason, so why does the full path have to be specified for svnlook?

I don't think that Apache is exporting the PATH variable to the SVN module,
so the full path is necessary.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pre-commit hook that stops CaSe-InSenSiTive collisions

Posted by Steve Williams <st...@kromestudios.com>.
The path to subversion\bin should be in the PATH environment variable for
Windows.  Otherwise you would have to type the full path every time just to
run 'svn'.  It would also have to be in the path for *nix as well for the
same reason, so why does the full path have to be specified for svnlook?

Sly

> ># Please check the path to svnlook is correct...
> >if ($opSys eq 'MSWin32') {
> >  $svnlook = '"c:\Program Files\subversion\bin\svnlook.exe"';
> >  $openstr = '-|';
> >} else {
> >  $svnlook = '/usr/local/bin/svnlook';
> >  $openstr = '-|:utf8';
> >}


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org