Skip Menu |

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

Report information
The Basics
Id: 24184
Status: resolved
Priority: 0/
Queue: File-HomeDir

People
Owner: Nobody in particular
Requestors: ryan [...] vbijl.net
Cc:
AdminCc:

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



Subject: problems via sudo
Date: Tue, 2 Jan 2007 05:23:59 -0800
To: bug-File-HomeDir [...] rt.cpan.org
From: Ryan VanderBijl <ryan [...] vbijl.net>
I'm trying to install File::Homedir 0.61 using this command: sudo perl -MCPAN -e 'install(File::HomeDir)' I then get these test errors: ---- PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t t/01_compile....ok t/02_main.......ok 1/52 # Failed test 'home(username) returns the same value' # at t/02_main.t line 205. # got: '/root' # expected: '/home/ryan' # Failed test 'Legacy %~ tied interface' # at t/02_main.t line 211. # got: '/root' # expected: '/home/ryan' t/02_main.......NOK 29/52# Looks like you failed 2 tests of 52. t/02_main.......dubious ---- I am using Kubuntu 6.10. -Ryan
From: RUEYCHENG [...] cpan.org
Try this patch. Download the tarball, extract it to the working directory, and then: $ patch -p0 < File-HomeDir-0.64.patch
diff -Naur File-HomeDir-0.64/t/02_main.t File-HomeDir-0.64-fix/t/02_main.t --- File-HomeDir-0.64/t/02_main.t 2007-02-10 01:44:52.000000000 +0800 +++ File-HomeDir-0.64-fix/t/02_main.t 2007-02-10 01:47:54.000000000 +0800 @@ -202,13 +202,13 @@ is( $home, $my_home, 'Different APIs give same results' ); SKIP: { skip("getpwuid not available", 1) if $NO_GETPWUID; - is( home(getpwuid($<)), $home, 'home(username) returns the same value' ); + is( home(getpwuid($>)), $home, 'home(username) returns the same value' ); } is( $~{""}, $home, 'Legacy %~ tied interface' ); SKIP: { skip("getpwuid not available", 1) if $NO_GETPWUID; - is( $~{getpwuid($<)}, $home, 'Legacy %~ tied interface' ); + is( $~{getpwuid($>)}, $home, 'Legacy %~ tied interface' ); } my $my_home2 = File::HomeDir::my_home();
Subject: Re: [rt.cpan.org #24184] problems via sudo
Date: Fri, 9 Feb 2007 05:36:46 -0800
To: via RT <bug-File-HomeDir [...] rt.cpan.org>
From: Ryan VanderBijl <ryan [...] vbijl.net>
This patch did not fix the problem. When running as sudo, both the real and effective user are the same: 0. The problem is that under sudo, the environment is not being overridden, and so the HOME variable is left point at the value of the original user. For example in this case, we will see that: File::HomeDir->my_home eq "/home/ryan/" File::HomeDir->users_home(getpwuid($<)) eq "/root" -Ryan On Fri, Feb 09, 2007 at 05:07:42AM -0500, via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=24184 > > > Try this patch. Download the tarball, extract it to the working > directory, and then: > $ patch -p0 < File-HomeDir-0.64.patch
-- Ryan VanderBijl | http://vbijl.net/~ryan/
From: RUEYCHENG [...] cpan.org
Well, that's strange. The fix works for me. :P Since I'm not the maintainer of the mod, I guess that's the best I can do. (I'll try to fix it up right... maybe later.) On Fri Feb 09 08:38:58 2007, ryan@vbijl.net wrote: Show quoted text
> This patch did not fix the problem. > > When running as sudo, both the real and effective user are the same: 0. > The problem is that under sudo, the environment is not being overridden, > and so the HOME variable is left point at the value of the original user. > > For example in this case, we will see that: > File::HomeDir->my_home eq "/home/ryan/" > File::HomeDir->users_home(getpwuid($<)) eq "/root" > > -Ryan > > On Fri, Feb 09, 2007 at 05:07:42AM -0500, via RT wrote:
> > > > <URL: http://rt.cpan.org/Ticket/Display.html?id=24184 > > > > > Try this patch. Download the tarball, extract it to the working > > directory, and then: > > $ patch -p0 < File-HomeDir-0.64.patch
> > >
I think this is finally solved in current dev release