Did anybody recently updated a machine running twiki to perl-5.10 and seeing "attempted on invalid dirhandle"? That's a perl error, not a twiki one. According to the docs opendir should return true on success but perl-5.10 doesn't. Test:
perl -e 'opendir DIR, foo && print "opening directory foo should fail\n";'
If perl-5.10 isn't going to be fixed soon, the workaround for TWiki is to add a check like
if (-d $dir)
in the store impls before opendir-ing the directory.
Btw
TWiki::Store::RcsFile::getAttachmentList
should return
()
instead of
''
on an error. e.g. if opendir fails. That one is a real twiki error.
Can anybody confirm this finding?
--
TWiki:Main/MichaelDaum - 19 May 2008
Which distro runs perl 5.10 today? I ask so I can maybe make a virtual machine to confirm this or similar bugs.
And Michael are you fixing part 2 of this bug item?
--
TWiki:Main.KennethLavrsen - 29 May 2008
adding
-d $dir
isn't helping in the unit tests that show this problem in 5.10.
on a pedant level: if you add -w to the top example, it tells you thatnot the code you meant to write
t42p:/mnt/data/sven/Desktop/un/firefox# perl -we 'opendir DIR, foo && print "opening directory foo should fail\n";'
Unquoted string "foo" may clash with future reserved word at -e line 1.
Bareword found in conditional at -e line 1.
Name "main::DIR" used only once: possible typo at -e line 1.
opening directory foo should fail
t42p:/mnt/data/sven/Desktop/un/firefox# perl -we 'opendir (DIR, "foo") && print "opening directory foo should fail\n";'
Name "main::DIR" used only once: possible typo at -e line 1.
The strange thing is, that
AccessControlTests::test_SetInText
with 5.10 has such a failure in the closedir() in Store::_rmtree, on a directoory that passes the=-d= test - something else is stuffed.
--
TWiki:Main.SvenDowideit - 01 Jun 2008
Who is following up on this one?
--
TWiki:Main.KennethLavrsen - 18 Jun 2008
looks like the right fix is the one suggested by perlcritic -
http://perlcritic.tigris.org/Perl/Critic/Policy/InputOutput/ProhibitBarewordFileHandles.html
rearranged
TWiki::Store::RcsFile::getAttachmentList
to automatically return the right stuff.
--
TWiki:Main.SvenDowideit - 26 Jun 2008