Bug 63222 - file named tilde (~) makes another file ending with ~ appears twice
Summary: file named tilde (~) makes another file ending with ~ appears twice
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.10.5
Hardware: All All
: P2 minor (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-03 00:35 UTC by Eugène Adell
Modified: 2020-10-06 19:41 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugène Adell 2019-03-03 00:35:10 UTC
When one file is strictly named ~ (tilde) and one or more file names end with ~, one of these files appears twice.

How to reproduce (I could reproduce 100%) : I have one directory published over FTP, which contains these files :
$ ls -AFlb
total 0
-rw-r--r--. 1 caolila users 0 Mar  3 01:00 ~
-rw-r--r--. 1 caolila users 0 Mar  3 01:08 1~
-rw-r--r--. 1 caolila users 0 Mar  3 01:08 2~
-rw-r--r--. 1 caolila users 0 Mar  3 01:08 3~


Listing this directory with an ANT FTPClient gives the following :

$ more toc.txt
-r--------   1 user group            0 Mar  3 01:08 1~
-r--------   1 user group            0 Mar  3 01:08 2~
-r--------   1 user group            0 Mar  3 01:08 3~
-r--------   1 user group            0 Mar  3 01:08 1~


Native FTPClient lists correctly :
Connected to localhost.
220 Service ready for new user.
-r--------   1 user group            0 Mar  3 01:08 1~
-r--------   1 user group            0 Mar  3 01:08 2~
-r--------   1 user group            0 Mar  3 01:08 3~
-r--------   1 user group            0 Mar  3 01:00 ~


If using characters instead of numbers in the file names, I get the same issue

FTPClient
220 Service ready for new user.
-r--------   1 user group            0 Mar  3 00:55 charactersthen~
-r--------   1 user group            0 Mar  3 01:00 ~

ANT
$ more toc.txt
-r--------   1 user group            0 Mar  3 00:55 charactersthen~
-r--------   1 user group            0 Mar  3 00:55 charactersthen~


It seems that the first file of the list appears twice, which is not a random behavior.

Note that the problem happens only when the ~ is at the end. If it is at another place, or at the beginning, no problem as we see :

FTPClient
220 Service ready for new user.
-r--------   1 user group            0 Mar  3 01:00 ~
-r--------   1 user group            0 Mar  3 00:55 ~thencharacters

ANT
$ more toc.txt
-r--------   1 user group            0 Mar  3 01:00 ~
-r--------   1 user group            0 Mar  3 00:55 ~thencharacters


My ANT target is :
  <target name="listing">
    <ftp action="list"
       listing="toc.txt"
       server="localhost"
       port="2121"
       userid="anonymous"
       password="anonymous"
       remotedir=".">
   <fileset dir="." defaultexcludes="no" includes="*" />
    </ftp>
  </target>