Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: siracusa [...] gmail.com
Cc:
AdminCc:

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



Subject: Tests fail when run but the root user in Mac OS X
If you run the test suite as the "root" user in Mac OS X, tests fail because root generally does not have the same directories as regular users (e.g., no "Application Support" folder). It also gets tripped up by the fact that root's home directory (/var/root) is below a symlink (/var is a symlink to /private/var in Mac OS X.) Testing results are show below: Show quoted text
cpan> look File::HomeDir
Running look for module 'File::HomeDir' Trying to open a subshell in the build directory... Working directory is /usr/local/src/CPAN/build/File-HomeDir-0.95-7hI8Xk mymac [File-HomeDir-0.95-7hI8Xk]# id uid=0(root) gid=0(wheel) groups=0(wheel),101(com.apple.sharepoint.group.1),204(_developer),100(_lpoperator),98(_lp admin),80(admin),61(localaccounts),29(certusers),20(staff),12(everyone),9(procmod),8(procvi ew),5(operator),4(tty),3(sys),2(kmem),1(daemon),401(com.apple.access_screensharing),102(c om.apple.sharepoint.group.2) mymac [File-HomeDir-0.95-7hI8Xk]# perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for File::HomeDir mymac [File-HomeDir-0.95-7hI8Xk]# make test cp lib/File/HomeDir/Darwin.pm blib/lib/File/HomeDir/Darwin.pm cp lib/File/HomeDir/Darwin/Cocoa.pm blib/lib/File/HomeDir/Darwin/Cocoa.pm cp lib/File/HomeDir/Test.pm blib/lib/File/HomeDir/Test.pm cp lib/File/HomeDir/MacOS9.pm blib/lib/File/HomeDir/MacOS9.pm cp lib/File/HomeDir/Driver.pm blib/lib/File/HomeDir/Driver.pm cp lib/File/HomeDir/Windows.pm blib/lib/File/HomeDir/Windows.pm cp lib/File/HomeDir.pm blib/lib/File/HomeDir.pm cp lib/File/HomeDir/Unix.pm blib/lib/File/HomeDir/Unix.pm cp lib/File/HomeDir/FreeDesktop.pm blib/lib/File/HomeDir/FreeDesktop.pm cp lib/File/HomeDir/Darwin/Carbon.pm blib/lib/File/HomeDir/Darwin/Carbon.pm PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t t/01_compile.t ........ 1/11 # Implemented by: File::HomeDir::Darwin::Cocoa t/01_compile.t ........ ok t/02_main.t ........... 1/51 # Failed test 'Legacy %~ tied interface' # at t/02_main.t line 256. # got: '/private/var/root' # expected: '/var/root' # Looks like you failed 1 test of 51. t/02_main.t ........... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/51 subtests (less 21 skipped subtests: 29 okay) t/10_test.t ........... ok t/11_darwin.t ......... 1/6 Use of uninitialized value $this in pattern match (m//) at t/11_darwin.t line 55. # Failed test at t/11_darwin.t line 55. # undef # doesn't match '(?-xism:Application Support)' # Looks like you failed 1 test of 6. t/11_darwin.t ......... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/6 subtests (less 4 skipped subtests: 1 okay) t/12_darwin_carbon.t .. skipped: Not running on 32-bit Darwin t/13_darwin_cocoa.t ... 1/6 Use of uninitialized value $this in pattern match (m//) at t/13_darwin_cocoa.t line 60. # Failed test at t/13_darwin_cocoa.t line 60. # undef # doesn't match '(?-xism:Application Support)' # Looks like you failed 1 test of 6. t/13_darwin_cocoa.t ... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/6 subtests (less 4 skipped subtests: 1 okay) Test Summary Report ------------------- t/02_main.t (Wstat: 256 Tests: 51 Failed: 1) Failed test: 28 Non-zero exit status: 1 t/11_darwin.t (Wstat: 256 Tests: 6 Failed: 1) Failed test: 5 Non-zero exit status: 1 t/13_darwin_cocoa.t (Wstat: 256 Tests: 6 Failed: 1) Failed test: 5 Non-zero exit status: 1 Files=6, Tests=104, 0 wallclock secs ( 0.04 usr 0.02 sys + 0.21 cusr 0.04 csys = 0.31 CPU) Result: FAIL Failed 3/6 test programs. 3/104 subtests failed. make: *** [test_dynamic] Error 1 mymac [File-HomeDir-0.95-7hI8Xk]#
I believe this is now fixed in the latest dev release. Please re-open if you still have issues with 0.96_03
On Mon Jan 31 17:09:50 2011, ADAMK wrote: Show quoted text
> I believe this is now fixed in the latest dev release. > > Please re-open if you still have issues with 0.96_03
I’m afraid it’s not fixed. root is not the only user without special directories. This logic can’t be right, for several reasons. I have a stripped down user similar to what you test for under AUTOMATED_TESTING, but without having that env var set, because I’m not automating testing. So I always get test failures. Also, $< != 0 does not indicate a normal user. www, for instance, doesn’t have any special directories. So I would simply suggest skipping this test altogether. All it does is guarantee that File::HomeDir won’t install in many places. } elsif ( $^O eq 'darwin' ) { # "Unixes with proper desktops" special cases if ( $ENV{AUTOMATED_TESTING} ) { # Automated testers on Mac (notably BINGOS) will often have # super stripped down testing users. $HAVEHOME = 1; $HAVEDESKTOP = 1; $HAVEMUSIC = 0; $HAVEPICTURES = 0; $HAVEVIDEOS = 0; $HAVEOTHERS = 1; } elsif ( $< ) { # Normal user $HAVEHOME = 1; $HAVEDESKTOP = 1; $HAVEMUSIC = 1; $HAVEPICTURES = 1; $HAVEVIDEOS = 1; $HAVEOTHERS = 1; } else { # Root can only be relied on to have a home $HAVEHOME = 1; $HAVEDESKTOP = 0; $HAVEMUSIC = 0; $HAVEPICTURES = 0; $HAVEVIDEOS = 0; $HAVEOTHERS = 0; }
Hi, I've just been speaking with rurban. The bug turns out to be with Mac::SystemDirectory. He's reported the bug and a fix in RT 73539. He could only provide a patch by switching to EU::MM. I believe it was a limitation of MI or his understanding of it that required this.
On Wed Feb 01 14:48:33 2012, TODDR wrote: Show quoted text
> Hi, I've just been speaking with rurban. The bug turns out to be with > Mac::SystemDirectory. He's > reported the bug and a fix in RT 73539.
But that only fixes compilation issues, as far as I can tell. It doesn’t prevent FindDirectory(NSMusicDirectory) from returning a nonexistent path.
The issue was "test fail". On MacOS X, the root user doesn't shall run applications, so no my_videos etc. is required.
Out with 1.003_001. Please re-open when the issue is still there.
On Sat Mar 10 12:14:57 2018, REHSACK wrote: Show quoted text
> Out with 1.003_001. Please re-open when the issue is still there.
I am still getting the same failure with 1.003_001: t/02_main.t ........... 1/39 # Failed test 'Our videos directory exists' # at t/02_main.t line 256. # Failed test 'Our videos directory exists' # at t/02_main.t line 257. # Looks like you failed 2 tests of 39. t/02_main.t ........... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/39 subtests (less 1 skipped subtest: 36 okay)
I'm sorry. I cannot reproduce that. My system perl doesn't have Mac::SystemDirectory and I refuse to install perlbrew for root. It is heavily wrong running File::HomeDir on MacOS X using a system user. You can do following: Debug the root cause (the real one - not one of a particular machine which might be broken because of misusing). Develop a patch with test, which runs fine for normal users and deal with your special conditions. I checked my root user, which has it's home at /var/root and it has a Library folder in there. I applied the suggested patch skipping the check as proposed. I recommend a Pull-Request when you need something special. I change the status to stalled and see what happens soon.
On Wed Feb 01 15:57:10 2012, SPROUT wrote: Show quoted text
> On Wed Feb 01 14:48:33 2012, TODDR wrote:
> > Hi, I've just been speaking with rurban. The bug turns out to be with > > Mac::SystemDirectory. He's > > reported the bug and a fix in RT 73539.
> > But that only fixes compilation issues, as far as I can tell. It > doesn’t prevent > FindDirectory(NSMusicDirectory) from returning a nonexistent path.
This call only returns that path as it should be. I add especially for you a diag output in 1.003_002. We will see where that leads us.
There is no failed test fitting to your issue. Closing this since it seems to be passed away.