[ 
https://issues.apache.org/jira/browse/IO-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17575149#comment-17575149
 ] 

Jiangwei Liu edited comment on IO-770 at 8/4/22 9:23 AM:
---------------------------------------------------------

Hi [~sgessner] ,

I think we can't use underscore({_}) in hostname, because the two RFC defained 
the syntax, can't contains the underscore({_}):

RFC-1034 -3.5 and RFC-1035 -2.3.1 :

The DNS specifications attempt to be as general as possible in the rules for 
constructing domain names. The idea is that the name of any existing object can 
be expressed as a domain name with minimal changes. However, when assigning a 
domain name for an object, the prudent user will select a name which satisfies 
both the rules of the domain system and any existing rules for the object, 
whether these rules are published or implied by existing programs.

For example, when naming a mail domain, the user should satisfy both the rules 
of this memo and those in RFC-822. When creating a new host name, the old rules 
for HOSTS.TXT should be followed. This avoids problems when old software is 
converted to use domain names.

The following syntax will result in fewer problems with many applications that 
use domain names (e.g., mail, TELNET).

{{<domain> ::= <subdomain> | " "}}
{{<subdomain> ::= <label> | <subdomain> "." <label>}}
{{<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]}}
{{<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>}}
{{<let-dig-hyp> ::= <let-dig> | "-"}}
{{<let-dig> ::= <letter> | <digit>}}
{{<letter> ::= any one of the 52 alphabetic characters A through Z in upper 
case and a through z in lower case}}
{{<digit> ::= any one of the ten digits 0 through 9}}

Note that while upper and lower case letters are allowed in domain names, no 
significance is attached to the case. That is, two names with the same spelling 
but different case are to be treated as if identical.

*The labels must follow the rules for ARPANET host names. They must start with 
a letter, end with a letter or digit, and have as interior characters only 
letters, digits, and hyphen. There are also some restrictions on the length. 
Labels must be 63 characters or less.*

For example, the following strings identify hosts in the Internet:

{{A.ISI.EDU XX.LCS.MIT.EDU SRI-NIC.ARPA}}


was (Author: JIRAUSER293868):
Hi [~sgessner] ,

I think we can't use underscore(_) in hostname, because the two RFC is defained 
the syntax, can't contains the underscore(_):

RFC-1034 -3.5 and RFC-1035 -2.3.1 :

The DNS specifications attempt to be as general as possible in the rules for 
constructing domain names. The idea is that the name of any existing object can 
be expressed as a domain name with minimal changes. However, when assigning a 
domain name for an object, the prudent user will select a name which satisfies 
both the rules of the domain system and any existing rules for the object, 
whether these rules are published or implied by existing programs.

For example, when naming a mail domain, the user should satisfy both the rules 
of this memo and those in RFC-822. When creating a new host name, the old rules 
for HOSTS.TXT should be followed. This avoids problems when old software is 
converted to use domain names.

The following syntax will result in fewer problems with many applications that 
use domain names (e.g., mail, TELNET).

{{<domain> ::= <subdomain> | " "}}
{{<subdomain> ::= <label> | <subdomain> "." <label>}}
{{<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]}}
{{<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>}}
{{<let-dig-hyp> ::= <let-dig> | "-"}}
{{<let-dig> ::= <letter> | <digit>}}
{{<letter> ::= any one of the 52 alphabetic characters A through Z in upper 
case and a through z in lower case}}
{{<digit> ::= any one of the ten digits 0 through 9}}

Note that while upper and lower case letters are allowed in domain names, no 
significance is attached to the case. That is, two names with the same spelling 
but different case are to be treated as if identical.

*The labels must follow the rules for ARPANET host names. They must start with 
a letter, end with a letter or digit, and have as interior characters only 
letters, digits, and hyphen. There are also some restrictions on the length. 
Labels must be 63 characters or less.*

For example, the following strings identify hosts in the Internet:

{{A.ISI.EDU XX.LCS.MIT.EDU SRI-NIC.ARPA}}

> FilenameUtils#getFullPathNoEndSeparator has issues with windows and 
> underscore in hostname
> ------------------------------------------------------------------------------------------
>
>                 Key: IO-770
>                 URL: https://issues.apache.org/jira/browse/IO-770
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.7, 2.8.0, 2.9.0, 2.10.0, 2.11.0
>            Reporter: Sita Geßner
>            Priority: Major
>
> After updating commons-io to version 2.11.0 there is an issue with 
> FilenameUtils#getFullPathNoEndSeparator only when using Windows.
> When using Linux there are no problems.
> getFullPathNoEndSeparator returns  null if the hostname of the path contains 
> an underscore. This issue occured since version 2.7
> {code:java}
>     private static void commonsIo() {
>         final String result = getSubFolderFromFile(new 
> File("\\\\sub_1.example.com\\path\\subfolder\\test.pdf"));
>         // Fails in common-io:2.11.0 b/c result is null.
>         System.out.println("result should be \"subfolder\", but it is: " + 
> result);
>     }
>     private static String getSubFolderFromFile(final File file) {
>         return 
> FilenameUtils.getBaseName(FilenameUtils.getFullPathNoEndSeparator(file.getAbsolutePath()));
>     }
> {code}
> We know hostnames are not supposed to have underscores, but windows allows it 
> and  unfortunatly we have to deal with this.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to