• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5638: readdir/closedir attempted on invalid dirhandle on perl-5.10

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Urgent Closed   patch 4.2.1, 5.0.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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. frown

on a pedant level: if you add -w to the top example, it tells you thatnot the code you meant to write smile

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

ItemTemplate
Summary readdir/closedir attempted on invalid dirhandle on perl-5.10
ReportedBy TWiki:Main.MichaelDaum
Codebase

SVN Range TWiki-5.0.0, Sun, 04 May 2008, build 16770
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins TWikirev:16945 TWikirev:16946 TWikirev:16947 TWikirev:16948
TargetRelease patch
ReleasedIn 4.2.1, 5.0.0
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2008-08-04 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback