Skip Menu |

This queue is for tickets about the Authen-Htpasswd CPAN distribution.

Report information
The Basics
Id: 27012
Status: resolved
Priority: 0/
Queue: Authen-Htpasswd

People
Owner: Nobody in particular
Requestors: CHORNY [...] cpan.org
zakame [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.15
Fixed in: (no value)



Subject: 05edit.t error
ActiveState perl v5.8.7 built for MSWin32-x86-multi-thread Binary build 813 Same with Vanilla perl. Windows XP SP2. 05edit.t: ok 1 - object created successfully Bad file descriptor at blib/lib/Authen/Htpasswd.pm line 245. # Looks like you planned 28 tests but only ran 1. # Looks like your test died just after 1. -- Alexandr Ciornii, http://chorny.net
Hello: I've just released a new version of Authen::Htpasswd which should work now in Win32. If you get a chance, please let me know if the tests now pass for you. Thanks! Dave
On Jul 17 00:44:48 2007, DKAMHOLZ wrote: Show quoted text
> I've just released a new version of Authen::Htpasswd which should work > now in Win32.
t/05edit...........NOK 5/28# Failed test 'updated user verified' # at t/05edit.t line 25. t/05edit...........NOK 6/28 # Failed test 'old password invalid' # at t/05edit.t line 26. t/05edit...........NOK 8/28# Failed test 'deleted user not found' # at t/05edit.t line 30. ... -- Alexandr Ciornii, http://chorny.net
From: bailey [...] newman.upenn.edu
On Tue Jul 17 05:41:36 2007, CHORNY wrote: Show quoted text
> > t/05edit...........NOK 5/28# Failed test 'updated user verified' > # at t/05edit.t line 25. > t/05edit...........NOK 6/28 > # Failed test 'old password invalid' > # at t/05edit.t line 26. > > t/05edit...........NOK 8/28# Failed test 'deleted user not found' > # at t/05edit.t line 30. > > ...
I'll guess that these failures are seen with bleadperl. It appears that there's been a change in the semantics of backslash, such that the expression m/^\Q$username\:/, which used to match a username followed by colon, now matches a username followed by a literal backslash followed by a colon (tested with 5.8.8 vs. 5.9.5). The docs in perlop and perlre aren't specific enough about the desired semantics of backslash to prove whether this is a bug or correct behavior. The general statements that "anything that looks like" . \[^[:alnum:]] . "is interpreted as a literal character" (perlre) and "Let it be stressed that whatever falls between \Q and \E is interpolated in the usual way: (perlop) would seem to indicate that "\:" and "\Q\:" should have identical behavior. However, the repeated warnings about undesired behavior of backslash within quotemeta appear to indicate that the difference is intended behavior. The attached patch, which simply places a \E before the \: (after which the backslash before the : is really redundant, but doesn't hurt) allows the test to function properly under both 5.8.8 and 5.9.5.
--- lib/Authen/Htpasswd.pm.0.16 2007-07-15 18:10:58.000000000 -0400 +++ lib/Authen/Htpasswd.pm 2007-07-21 23:41:09.000000000 -0400 @@ -188,7 +188,7 @@ my ($old,$new) = $self->_start_rewrite; my $seen = 0; while (defined(my $line = <$old>)) { - if ($line =~ /^\Q$username\:/) { + if ($line =~ /^\Q$username\E\:/) { chomp $line; my (undef,undef,@extra_info) = split /:/, $line; $user->{extra_info} ||= [ @extra_info ] if scalar @extra_info; @@ -219,7 +219,7 @@ my ($old,$new) = $self->_start_rewrite; while (defined(my $line = <$old>)) { - if ($line =~ /^\Q$username\:/) { + if ($line =~ /^\Q$username\E\:/) { $self->_abort_rewrite; croak "user $username already exists in " . $self->file . "!"; } @@ -244,7 +244,7 @@ my ($old,$new) = $self->_start_rewrite; while (defined(my $line = <$old>)) { - next if $line =~ /^\Q$username\:/; + next if $line =~ /^\Q$username\E\:/; $self->_print( $new, $line ); } $self->_finish_rewrite($old,$new);
From: bailey [...] newman.upenn.edu
On Sun Jul 22 00:16:32 2007, CBAIL wrote: Show quoted text
> > The attached patch, which simply places a \E before the \: (after which > the backslash before the : is really redundant, but doesn't hurt) allows > the test to function properly under both 5.8.8 and 5.9.5.
After a bit more thought, I wondered whether it might not be simpler to just remove the backslash before the colon in the above expressions, instead of inserting \E before it (i.e. the expression would read /^\Q$username:/). A few quick tests on 5.8.8 and 5.9.5 appear to work as desired. I won't clutter RT with another patch, since it's a simple edit to the prior patch or the module itself. I hope this is useful.
On Sun Jul 22 11:26:48 2007, CBAIL wrote: Show quoted text
> On Sun Jul 22 00:16:32 2007, CBAIL wrote:
> > > > The attached patch, which simply places a \E before the \: (after which > > the backslash before the : is really redundant, but doesn't hurt) allows > > the test to function properly under both 5.8.8 and 5.9.5.
> > After a bit more thought, I wondered whether it might not be simpler to > just remove the backslash before the colon in the above expressions, > instead of inserting \E before it (i.e. the expression would read > /^\Q$username:/). A few quick tests on 5.8.8 and 5.9.5 appear to work > as desired.
Hmm I'm confirming this on the newly-released Perl 5.10.0 as well, while trying to build Catalyst::Plugin::Authentication::Store::Htpasswd (which depends on this module.)
This bug should be fixed in Authen::Htpasswd 0.161.