You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/03/26 21:56:39 UTC
DO NOT REPLY [Bug 39108] New: - FTP.java missing checks when file type is unknown
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
Summary: FTP.java missing checks when file type is unknown
Product: Ant
Version: 1.6.5
Platform: Other
OS/Version: other
Status: NEW
Keywords: PatchAvailable
Severity: normal
Priority: P3
Component: Optional Tasks
AssignedTo: dev@ant.apache.org
ReportedBy: henrik.sorensen@balcab.ch
CC: henrik.sorensen@balcab.ch
The FTP.java class has two local methods used to check is a file entry is really
a file or a directory. The problem with the current implementation is it is not
taking into account that the entries can be unknown, and the current logic
further assumes that isFile==!isDirectory.
The two methods are
isFunctioningAsFile
and
isFunctioningAsDirectory
I have tested the following changes to the functions:
private boolean isFunctioningAsDirectory(FTPClient ftp, String dir, FTPFile
file) {
boolean result = false;
String currentWorkingDir = null;
if (file.isDirectory()) {
return true;
} else if (file.isFile()) {
return false;
}
<b> else if (file.isUnknown()) {
return false;
}
</b>
...
}
private boolean isFunctioningAsFile(FTPClient ftp, String dir, FTPFile
file) {
if (file.isDirectory()) {
return false;
} else if (file.isFile()) {
return true;
}<b> else if (file.isUnknown()) {
return false;
}</b>
return !isFunctioningAsDirectory(ftp, dir, file);
}
Henrik
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
------- Additional Comments From henrik.sorensen@balcab.ch 2006-03-28 20:56 -------
>Also, something which is of type unknown may still be functioning as file or
>directory
but if that is the case what is the point of setting the type to unknown ?
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
henrik.sorensen@balcab.ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
------- Additional Comments From jkf@apache.org 2006-03-28 21:00 -------
The type is probably set to unknown unless the commons FTP library is able to
determine the type by parsing the listing, which may not be the case (or
implemented) for all listings.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
------- Additional Comments From henrik.sorensen@balcab.ch 2006-03-28 21:17 -------
My question still remain.
And further, would you blindly trust a rmdir, let alone read or write on an file
type unknown ?
Once you have determined if you can read or write to the file, why not just set
the type accordingly ?
Frankly I do not follow you line of argument here.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
------- Additional Comments From jkf@apache.org 2006-03-28 23:39 -------
Sorry, but I do not understand the issue, what would be the benefit of not
trying to determine the behaviour of an unknown entry?
Ant does not set the type to unknown.
Commons does set the type to unknown when it can not -for whatever reason-
determine what an entry is by inspecting the listing. Commons will not try to
determine if something unknown proves to be a file or a directory.
Ant does try to determine whether it acts as a directory or a file.
Ant does not try to determine this by inspecting the entry of a listing.
For unix ftp listings commons will treat block and character devices as file,
but will treat fifo's as unknown. Fifo's for instance will act like files.
Ant does not change the entry it has received from the commons FTP library, I am
not familiar enough with the ftp library of commons to see if it could do any
harm to change this, but again, what would be the benefit?
So please indicate what is wrong on a functional level.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
antoine@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WONTFIX |
------- Additional Comments From antoine@apache.org 2006-10-30 15:02 -------
Hello Henrik,
I did not look at your bug report before.
Are you closing it as WONTFIX because you believe that there is no one in the
Ant community who wants to process this bug report ?
I think that your bug report makes a valid point. Actually, I am the one who
wrote these methods isFunctioningAsFile and isFunctioningAsDirectory. Yes, I did
not have in mind directory entries which are neither files nor directories. Yes
it might be a good idea to avoid doing anything with these directory entries FTP
wise.
I am reopening the report.
Antoine
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
------- Additional Comments From jkf@apache.org 2006-03-27 22:44 -------
I think the original idea was that everything not functioning as a directory is
assumed to be functioning as a file, as to be able to compare / download as much
as possible.
Also, something which is of type unknown may still be functioning as file or
directory, so to return false right away doesn't seem to be the right decision
for those checks.
For example fifo's are neither files nor directories, yet they will function as
file when read from / written to.
Maybe unknown is also used for FTP servers that do not propagate any obvious
difference between file entries and directory entries.
Therefore, it is not clear to me what would be the benefit of always having
isFunctioningAsDirectory and isFunctioningAsFile returning false if the type is
unknown.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 39108] - FTP.java missing checks when file type is unknown
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39108
------- Additional Comments From henrik.sorensen@balcab.ch 2006-10-31 14:41 -------
(In reply to comment #6)
> Are you closing it as WONTFIX because you believe that there is no one in the
> Ant community who wants to process this bug report ?
yes, that is a pretty accurate description.
But I understand you have a lot to do, and my solution works for me.
> I think that your bug report makes a valid point. Actually, I am the one who
> wrote these methods isFunctioningAsFile and isFunctioningAsDirectory. Yes, I did
> not have in mind directory entries which are neither files nor directories. Yes
> it might be a good idea to avoid doing anything with these directory entries FTP
> wise.
yes.
I had to patch Ant locally to avoid the problem when the
commons.net.MVSFTPEntryParser returns filetype unknown.
>
> I am reopening the report.
thanks.
Basically, if filetype is unknown both methods isFile and isDir should return false.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org