View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000124 | 1003.1(2008)/Issue 7 | Shell and Utilities | public | 2009-07-15 04:10 | 2013-04-16 13:06 |
Reporter | eblake | Assigned To | ajosey | ||
Priority | normal | Severity | Objection | Type | Omission |
Status | Closed | Resolution | Accepted As Marked | ||
Name | Eric Blake | ||||
Organization | |||||
User Reference | ebb.tilde | ||||
Section | Tilde Expansion | ||||
Page Number | 2305 | ||||
Line Number | 72682 | ||||
Interp Status | --- | ||||
Final Accepted Text | 0000124:0000199 | ||||
Summary | 0000124: tilde expansion and double slash file names | ||||
Description | The standard is silent on how tilde expansion must behave on implementations where // is different than /. See also https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=show_archive.tpl&source=L&listname=austin-group-l&id=8491. This proposal tries to codify the approach used when porting shells to cygwin, where // really is distinct from /. The intent is that: HOME=/; a=~:~/dir:~//dir; HOME=//; b=~:~/dir:~//dir; echo $a $b outputs "/:/dir://dir //://dir:///dir", such that using one slash between a tilde prefix and subsequent text never corrupts / into // or // into /, but using two slashes after a tilde prefix intentionally picks up the opposite sense. If one wants to avoid the // issue altogether but still use the root directory, then HOME can be set to ///. However, this could have a negative impact to existing implementations, where // is identical to / during pathname resolution. On those platforms, not deleting a trailing slash during tilde-expansion will have no impact to pathname resolution, but leads to observably different textual expansion. So it may be worth adding additional wording that permits platforms to skip stripping the trailing slash if // is identical to /. | ||||
Desired Action | After the existing text at line 72682: If the login name is null (that is, the tilde-prefix contains only the tilde), the tilde-prefix is replaced by the value of the variable HOME. If HOME is unset, the results are unspecified. Otherwise, the tilde-prefix shall be replaced by a pathname of the initial working directory associated with the login name obtained using the getpwnam( ) function as defined in the System Interfaces volume of POSIX.1-2008. If the system does not recognize the login name, the results are undefined. Add a new paragraph: If the replacement provided by the variable HOME or by getpwnam( ) ends in a <slash>, and the tilde-prefix was terminated by a <slash>, then the trailing slash in the replacement shall be omitted when concatenating the expansion with the rest of the word. If the tilde-prefix was terminated by <colon> or the end of the word, then the trailing slash of the replacement is left intact. | ||||
Tags | tc1-2008 |
|
On 124 we noted that introducing a change here would likely cause breakage for someone. Making the change proposed could break existing scripts written to conform to the standard. We would like a better understanding of the extent of the problem on a cygwin system. We are leaning towards adding a note to RATIONALE, Add to XRAT p3655 124299 System administrators on systems where // has an implementation defined meaning which is different to /, should not create users with a home directory of / or //, since this may lead to unexpected filename resolution on those systems. |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-07-15 04:10 | eblake | New Issue | |
2009-07-15 04:10 | eblake | Status | New => Under Review |
2009-07-15 04:10 | eblake | Assigned To | => ajosey |
2009-07-15 04:10 | eblake | Name | => Eric Blake |
2009-07-15 04:10 | eblake | User Reference | => ebb.tilde |
2009-07-15 04:10 | eblake | Section | => Tilde Expansion |
2009-07-15 04:10 | eblake | Page Number | => 2305 |
2009-07-15 04:10 | eblake | Line Number | => 72682 |
2009-08-20 15:59 | ajosey | Note Added: 0000199 | |
2009-10-08 15:49 | msbrown | Interp Status | => --- |
2009-10-08 15:49 | msbrown | Final Accepted Text | => 0000124:0000199 |
2009-10-08 15:49 | msbrown | Status | Under Review => Resolved |
2009-10-08 15:49 | msbrown | Resolution | Open => Accepted As Marked |
2010-08-27 13:15 | ajosey | Tag Attached: tc1-2008 | |
2013-04-16 13:06 | ajosey | Status | Resolved => Closed |