Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Make readdir stop returning short (8.3) filenames

by jdporter (Paladin)
on Apr 05, 2011 at 14:06 UTC ( [id://897515]=perlquestion: print w/replies, xml ) Need Help??

jdporter has asked for the wisdom of the Perl Monks concerning the following question:

I'm getting this odd, unheretofore-seen behavior from readdir on Windows 7. It has started returning "short" (8.3) filenames, at least for a directory on a network share. Several of my critical Perl programs are now broken! Any idea how to stop this?

Some details: I'm running the perl programs on a Windows 7 workstation; the filesystem being read is on a Windows Server 2003 R2 machine. Of possible significance is that we had a power outage last night; my machine survived, but the server may have rebooted.

I also verified that it is not exhibiting this behavior when reading a directory on the local workstation, only when reading the share on the server.

MidLifeXis floated the idea that the value of the registry entry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem:Win31FileSystem may have changed. But I checked; it is still zero on all machines involved.

Thanks in advance...

Update: It seems I resolved the problem by changing my system's locale to coincide with the language in the filenames. Hrmph. It still seems strange to me, because I've never had this problem before, and I've been doing stuff exactly like this for quite some time.

Footnote: So it seems I omitted one detail which turned out to be critical: the filenames in question contained characters not valid in the current system locale. Still, I think I would have run into this problem before, as I deal with multiple languages quite a bit and have to switch the system locale rather often.

I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.

Replies are listed 'Best First'.
Re: Make readdir stop returning short (8.3) filenames
by Limbic~Region (Chancellor) on Apr 05, 2011 at 14:46 UTC
    jdporter,
    I haven't had the displeasure of trying Windows 7 yet but I found this article which suggests a work around might be to use the native API and call the GetLongPathName function.

    Cheers - L~R

      Thanks, LR. I tried that; bizarrely, it returned the correct long name but then attempting to open the file failed with "no such file" errors.

        jdporter,
        Barring any wonderful insight here from the monks, the next thing I would do is ping the Active State mailing list (assuming it is AS). Jan Dubois has been a wonderful help to me in the past with regards to bizarre windows problems (when I was forced to develop on Vista for a client).

        Cheers - L~R

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://897515]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found