Bug 198635 - [ftp] On Windows servers, only lowercase *.exe files are treated as executable
Summary: [ftp] On Windows servers, only lowercase *.exe files are treated as executable
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P4 minor (vote)
Target Milestone: 2.0.1   Edit
Assignee: Javier Montalvo Orús CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-02 05:11 EDT by Martin Oberhuber CLA
Modified: 2007-08-02 09:21 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-08-02 05:11:22 EDT
RSENTFTPEntryParser.java version 1.2 was changed to only treat "*.exe" files as executable.

This is not correct, because on Windows any file type can be registered to be executable - some typical extensions include *.bat, *.cmd, *,com, *.js, *.vbs
Moreover, the check would need to be case insensitive (*.EXE, *.eXe etc)

Supposedly because the concept of being executable is not clearly defined, commercial FTP (and also Samba) clients typically treat ALL files as executable on Windows servers. I checked with CuteFTP.

Original behavior of RSENTFTPEntryParser.java version 1.1 should be restored.
Comment 1 Javier Montalvo Orús CLA 2007-08-02 06:09:30 EDT
When marking one file as "executable", it is  shown in the FTP client tree with a small 'binary and play' and  icon decorator (same as in SSH).
Marking all files as executable looks like all remote files are binary, and it can be confusing.
I would prefer ending up with a list of "binary and executable" extensions, unless marking a file as executable were used somewhere else a part of the icon decorator. What do you think ?

I agree with not being case-sensitive, it's quite easy to solve.
Comment 2 Javier Montalvo Orús CLA 2007-08-02 06:41:58 EDT
At the moment, the implementation is consistent with Windows Local file classification:

From org.eclipse.rse.services.clientserver.SystemFileClassifier.classifyNonVirtual(String):

// for Windows, we only detect *.exe and *.dll files
    	if (isWindows) 
    	{
    	    absolutePath = absolutePath.toLowerCase();
    		// classify *.class file
    		if (absolutePath.endsWith(".class")) { //$NON-NLS-1$
    			type = classifyClassFile(absolutePath);
    		}
    		// *.exe files are binary executables
    		else if (absolutePath.endsWith(".exe")) { //$NON-NLS-1$
    			type = "executable(binary)"; //$NON-NLS-1$
    		}
    		// *.dll files are of type "module"
    		else if (absolutePath.endsWith(".dll")) { //$NON-NLS-1$
    			type = "module"; //$NON-NLS-1$
    		}
    		
    		return type;
    	}
Comment 3 Martin Oberhuber CLA 2007-08-02 08:24:23 EDT
It is not consistent. They do at least toLowerCase().
It is not comparable with SSH because SSH does no file pattern matching.

Taking into account that having the "executable" bit is more dangerous than helpful, that it is only used for the file classifier, and in order to be consistent with Local, I'm OK with handling the *.exe pattern only.

I also noticed that it is not a regression since the classifier was not used before so it had not been visible to the outside. Updating summary and marking minor.


Comment 4 Javier Montalvo Orús CLA 2007-08-02 09:09:15 EDT
I agree with covering mixed cases, I'll commit a fix for it.
Comment 5 Javier Montalvo Orús CLA 2007-08-02 09:21:03 EDT
Now the pattern is compared in lower case, so mixed cases of ".exe" are considered executable.