Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-File CPAN distribution.

Report information
The Basics
Id: 37676
Status: resolved
Priority: 0/
Queue: Test-File

People
Owner: Nobody in particular
Requestors: spurkis [...] cpan.org
Cc: steve.purkis [...] db.com
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.25
Fixed in: 1.32



CC: steve.purkis [...] db.com
Subject: owner_is / owner_isnt breaks when owner is root
The bug is best described by this test case, which should be run as root (unfortunately). use Test::More tests => 3; use Test::File; open( TEST, '> foo' ); print TEST "foo\n"; close TEST; # assuming root's uid/gid is 0 chown( 0, 0, 'foo' ); owner_is( 'foo', 'root' ); owner_is( 'foo', 'nonexistentuser' ); # succeds!? owner_isnt( 'foo', 'nonexistentuser' ); # fails!?
On Mon Jul 14 11:32:54 2008, SPURKIS wrote: Show quoted text
> The bug is best described by this test case, which should be run as root > (unfortunately)
I see that there is a problem with owner_isnt because it was failing when the user didn't exist. However, I can't reproduce the problem with owner is. Also, I see the same behavior with my normal user and root accounts. Can you give me some more information about your system, version of Perl, and so on? Thanks,
Hi Brian, On Mon Jul 14 18:52:47 2008, BDFOY wrote: Show quoted text
> On Mon Jul 14 11:32:54 2008, SPURKIS wrote:
> > The bug is best described by this test case, which should be > > run as root (unfortunately)
> > I see that there is a problem with owner_isnt because it was failing > when the user didn't exist. > However, I can't reproduce the problem with owner is. Also, I see the > same behavior with my normal user and root accounts.
You're right - I was testing with a different version of Test::File than I thought (1.17), sorry about that. I can confirm owner_isnt() is still failing. Show quoted text
> Can you give me some more information about your system, version of > Perl, and so on?
Sure: ------------------------------------------------------- 1..3 Perl version: 5.008007 Test::File::VERSION: 1.25 ok 1 - foo belongs to root # User [nonexistentuser] does not exist on this system not ok 2 - foo belongs to nonexistentuser # Failed test 'foo belongs to nonexistentuser' # at t.pl line 14. # File [foo] belongs to nonexistentuser () not ok 3 - foo belongs to nonexistentuser # Failed test 'foo belongs to nonexistentuser' # at t.pl line 15. # Looks like you failed 2 tests of 3.
Is this still happening on the latest version of Test::File?
On Mon Jan 30 20:50:15 2012, BAREFOOT wrote: Show quoted text
> Is this still happening on the latest version of Test::File?
See attached test script you can include in your distro. Looks like this bug has been fixed, but I noticed a new bug in testing this: owner_isnt() reports that a file belongs to a user, when it should really say it *doesn't* belong. Looks like it's actually doing the right test though. the attached test checks for the correct behaviour. Hope this helps, -Steve
Subject: owner-root.t
use Test::Builder::Tester; use Test::More; use Test::File; use File::Temp; use strict; use warnings; # NOTE: we assume root's uid is 0 plan skip_all => 'Test not written for Win32' if ($^O eq 'MSWin32'); plan skip_all => "Must be root (uid=0, not $<) to run this test" unless $< == 0; plan tests => 3; diag( "Testing Test::File v$Test::File::VERSION" ); my $tmp = File::Temp->new( UNLINK => 1, TEMPLATE => 'Test-File-XXXXX'); chown( 0, 0, $tmp ); test_out( "ok 1 - $tmp belongs to root" ); owner_is( $tmp, 'root' ); test_test( "owner_is( file, 'root' ) should pass" ); test_diag( "User [nonexistentuser] does not exist on this system!" ); test_out( "not ok 1 - $tmp belongs to nonexistentuser" ); test_fail( +1 ); owner_is( $tmp, 'nonexistentuser' ); # succeeds!? test_test( "owner_is( file, 'nonexistentuser' ) should fail" ); test_out( "ok 1 - $tmp doesn't belong to nonexistentuser" ); owner_isnt( $tmp, 'nonexistentuser' ); # fails!? test_test( "owner_isnt( file, 'nonexistentuser' ) should pass" );
Actually, it looks like the only real problem is that the automatically generated test name wasn't correct. And the test for it (t/owner.t) was always passing a test name, so it didn't catch it. Nothing to do with being root, apparently. Fixing that causes your test file to pass. I also fixed t/owner.t to test for it. I'm going to resolve the ticket; look for a fix as of dev version 1.31_02 (later tonight), which I will promote to prod release 1.32 hopefully next week, barring CPAN Testers issues. Thanks for the report.
That's good news, thanks Buddy!
From: paul [...] city-fan.org
Slight quibble with 1.32: $ perl Makefile.PL INSTALLDIRS=vendor Checking if your kit is complete... Warning: the following files are missing in your kit: .Changes.swp Please inform the author. Ugly, but otherwise harmless.
Show quoted text
> Warning: the following files are missing in your kit: > .Changes.swp
Damn! not sure how that happened. I'll take care of it. Thanks for letting me know.