Jump to content

"List Folder" Returns Incorrect Results for Folders on Network Drives


Justin Goeres

Recommended Posts

(crossposted to NI Forums)

I'm seeing a behavior where LabVIEW's List Folder primitive returns incorrect results for a folder on a mapped network drive, if the folder contains a file whose name starts with any of:

<space> ! # $ % & ( ) + , -

(I suspect it's actually any ASCII character whose value is less than or equal to 0x2D, but some of those are illegal and/or unprintable).

OS: WindowsXP

LV Version: LabVIEW 8.6 and LabVIEW 2009

Steps to Reproduce

(1) Map a network drive to a drive letter (I'm not sure that a mapped drive is necessary, and the network drive in this demonstration is a samba share from a Linux system).

(2) Create a file in a directory on the network share from #1, e.g. "Z:\list-folder-bug\file.txt".

(3) Note that LabVIEW's List Folder function returns correct results when listing the folder you just created.

post-2992-125269899986_thumb.png

(4) Rename the file you created in #2 above, changing its name to !file.txt. (The key is that the filename must start with !, or any of the other characters listed above.)

(5) Note that LabVIEW's List Folder function now returns two elements in folder names that don't really exist.

post-2992-125269900668_thumb.png

Why This Is Important

This is important because these phantom directories "." and ".." are expanded to "current directory" and "parent directory," which means LabVIEW thinks that the target directory contains a copy of itself and its parent. This produces an infinite recursion when listing directory contents recursively. In particular, the OpenG function List Directory Recursively is affected by this bug and enters an infinite loop when run on the directory shown in #5.

Bonus Information

Note, also that the dir command at the Windows Command Prompt sorts the file list in an odd way for files that begin with the aforementioned characters, but only on network shares.

post-2992-125269991409_thumb.png

  • Like 1
Link to comment

They are not phantom directories. They are shorthand for the current directory and the parent directory.

Filenames, Paths and Namespaces

If you type in "cd .." in a command prompt it will take you to the parent directory.

If you allow "view hidden files" and "OS Files" and uncheck "Hide Known File Types"in the folder options you will also see them on the local drive.Its a throwback to DOS.

Edited by ShaunR
Link to comment

I'm aware of that, but they're "phantom" in the sense that they shouldn't be returned by the List Folders operation (and aren't, except on network shares). That's the issue.

Well.

This is what I get when I follow your instructions.

LV2009, Windows 7, LS-CHL NAS storage (don't know the versions off-hand but know its Samba on Linux).

Link to comment

I don't know that I'd be exposing images of my torrents folder to the general public. Errr, that is if I had one... unsure.gif

lol. Luckily I don't live in the USA. so am not paranoid. :ph34r: But now you have pointed it out in text, I know who to blame when it turns up of a search engine eh?:cool:

Anyhoo, programmers have to install these nefarious clients so they can come up with software to defeat them....right? :) Your virus scanner would go ape on one of my machines.

Edited by ShaunR
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.