[Issue 8 drafts 0001632]: Tilde expansions with HOME="" or HOME value ending in /
The following issue has a resolution that has been APPLIED. == https://austingroupbugs.net/view.php?id=1632 == Reported By:kre Assigned To: == Project:Issue 8 drafts Issue ID: 1632 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: Applied Name: Robert Elz Organization: User Reference: Section:XCU 2.6.1 Page Number:2319-2320 Line Number:74775-74794 Final Accepted Text:https://austingroupbugs.net/view.php?id=1632#c6184 Resolution: Accepted As Marked Fixed in Version: == Date Submitted: 2023-01-31 00:58 UTC Last Modified: 2023-05-16 10:55 UTC == Summary:Tilde expansions with HOME="" or HOME value ending in / == Issue History Date ModifiedUsername FieldChange == 2023-01-31 00:58 kreNew Issue 2023-01-31 00:58 kreName => Robert Elz 2023-01-31 00:58 kreSection => XCU 2.6.1 2023-01-31 00:58 krePage Number => 2319-2320 2023-01-31 00:58 kreLine Number => 74775-74794 2023-02-06 01:46 mirabilos Note Added: 0006144 2023-03-02 16:42 geoffclare Note Added: 0006184 2023-03-02 16:44 geoffclare Final Accepted Text => https://austingroupbugs.net/view.php?id=1632#c6184 2023-03-02 16:44 geoffclare Status New => Resolved 2023-03-02 16:44 geoffclare Resolution Open => Accepted As Marked 2023-03-02 16:45 geoffclare Tag Attached: tc3-2008 2023-05-16 10:55 geoffclare Status Resolved => Applied ==
[Issue 8 drafts 0001632]: Tilde expansions with HOME="" or HOME value ending in /
The following issue has been RESOLVED. == https://austingroupbugs.net/view.php?id=1632 == Reported By:kre Assigned To: == Project:Issue 8 drafts Issue ID: 1632 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: Resolved Name: Robert Elz Organization: User Reference: Section:XCU 2.6.1 Page Number:2319-2320 Line Number:74775-74794 Final Accepted Text:https://austingroupbugs.net/view.php?id=1632#c6184 Resolution: Accepted As Marked Fixed in Version: == Date Submitted: 2023-01-31 00:58 UTC Last Modified: 2023-03-02 16:44 UTC == Summary:Tilde expansions with HOME="" or HOME value ending in / == Issue History Date ModifiedUsername FieldChange == 2023-01-31 00:58 kreNew Issue 2023-01-31 00:58 kreName => Robert Elz 2023-01-31 00:58 kreSection => XCU 2.6.1 2023-01-31 00:58 krePage Number => 2319-2320 2023-01-31 00:58 kreLine Number => 74775-74794 2023-02-06 01:46 mirabilos Note Added: 0006144 2023-03-02 16:42 geoffclare Note Added: 0006184 2023-03-02 16:44 geoffclare Final Accepted Text => https://austingroupbugs.net/view.php?id=1632#c6184 2023-03-02 16:44 geoffclare Status New => Resolved 2023-03-02 16:44 geoffclare Resolution Open => Accepted As Marked ==
[Issue 8 drafts 0001632]: Tilde expansions with HOME="" or HOME value ending in /
A NOTE has been added to this issue. == https://austingroupbugs.net/view.php?id=1632 == Reported By:kre Assigned To: == Project:Issue 8 drafts Issue ID: 1632 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:XCU 2.6.1 Page Number:2319-2320 Line Number:74775-74794 Final Accepted Text: == Date Submitted: 2023-01-31 00:58 UTC Last Modified: 2023-03-02 16:42 UTC == Summary:Tilde expansions with HOME="" or HOME value ending in / == -- (0006184) geoffclare (manager) - 2023-03-02 16:42 https://austingroupbugs.net/view.php?id=1632#c6184 -- On page 2320 line 74793 section 2.6.1, change:The pathname resulting from tilde expansion shall be treated as if quoted to prevent it being altered by field splitting and pathname expansion.to:The pathname that replaces the tilde-prefix shall be treated as if quoted to prevent it being altered by field splitting and pathname expansion; if a follows the tilde-prefix and the pathname ends with a , the trailing from the pathname should be omitted from the replacement. If the word being expanded consists of only the character and HOME is set to the null string, this produces an empty field (as opposed to zero fields) as the expanded word. Note: A future version of this standard may require that if a follows the tilde-prefix and the pathname ends with a , the trailing from the pathname is omitted from the replacement. Issue History Date ModifiedUsername FieldChange == 2023-01-31 00:58 kreNew Issue 2023-01-31 00:58 kreName => Robert Elz 2023-01-31 00:58 kreSection => XCU 2.6.1 2023-01-31 00:58 krePage Number => 2319-2320 2023-01-31 00:58 kreLine Number => 74775-74794 2023-02-06 01:46 mirabilos Note Added: 0006144 2023-03-02 16:42 geoffclare Note Added: 0006184 ==
[Issue 8 drafts 0001632]: Tilde expansions with HOME="" or HOME value ending in /
A NOTE has been added to this issue. == https://austingroupbugs.net/view.php?id=1632 == Reported By:kre Assigned To: == Project:Issue 8 drafts Issue ID: 1632 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:XCU 2.6.1 Page Number:2319-2320 Line Number:74775-74794 Final Accepted Text: == Date Submitted: 2023-01-31 00:58 UTC Last Modified: 2023-02-06 01:46 UTC == Summary:Tilde expansions with HOME="" or HOME value ending in / == -- (0006144) mirabilos (reporter) - 2023-02-06 01:46 https://austingroupbugs.net/view.php?id=1632#c6144 -- I’d prefer HOME= to be treated the same as HOME=/ wrt. expansion, and to make sure that these are logical concatenations of pathnames, e.g. '/home' + 'foo' = '/home/foo' but '/' + 'foo' = '/foo'. This avoids both “naïve” string concatenation and the problem of having to decide what to do with an empty string; I consider an empty string to not be a valid pathname and therefore not a valid expansion for a sole tilde. I’m happy to change mksh to match; from a Debian perspective, we’re entering soft freeze in a few days so a speedy decision would be welcome. Issue History Date ModifiedUsername FieldChange == 2023-01-31 00:58 kreNew Issue 2023-01-31 00:58 kreName => Robert Elz 2023-01-31 00:58 kreSection => XCU 2.6.1 2023-01-31 00:58 krePage Number => 2319-2320 2023-01-31 00:58 kreLine Number => 74775-74794 2023-02-06 01:46 mirabilos Note Added: 0006144 ==
[Issue 8 drafts 0001632]: Tilde expansions with HOME="" or HOME value ending in /
The following issue has been SUBMITTED. == https://austingroupbugs.net/view.php?id=1632 == Reported By:kre Assigned To: == Project:Issue 8 drafts Issue ID: 1632 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: New Name: Robert Elz Organization: User Reference: Section:XCU 2.6.1 Page Number:2319-2320 Line Number:74775-74794 Final Accepted Text: == Date Submitted: 2023-01-31 00:58 UTC Last Modified: 2023-01-31 00:58 UTC == Summary:Tilde expansions with HOME="" or HOME value ending in / Description: The current draft, and earlier versions, this is not a new problem, it could have been filed against any older version - but as 2.6.1 has already been updated for other reasons for Issue 8, it seemed sensible to use its most recent draft, don't specify what should happen if HOME="" or if the value of HOME ends in a '/' - including particularly, the case of HOME=/ The case of HOME=/ is perhaps most interesting, as if the text is treated literally, which almost all shells do, the result of expanding ~/foo in such a case is //foo which is an unspecified pathname (as I understand it). A recent ksh93 produces /foo from this case, but that's the only shell I can find which does (amusingly, for the case of HOME=/dir/ that version of ksh93 produces /dir//foo for ~/foo whereas an older one produces //foo for HOME=/ and /dir/foo for the HOME=/dir/ case).. mksh also makes /dir/foo in the HOME=/dir/ case and //foo in the HOME= case, most other shells simply do as the standard says, and replace the tilde prefix (just '~' here) with the value of HOME, which results in the // in both cases. This leads to the desire to use HOME="" instead of HOME=/ in the case where the home directory is intended to be the root directory, which results in ~/foo expanding to /foo in almost all shells (the now quite old FreeBSD shell I use to test with doesn't expand ~ at all when $HOME is an empty string, but that is. or quite likely was, clearly a bug, so I assume it has been fixed sometime in the past several years). However, despite the language of the standard: The pathname resulting from tilde expansion shall be treated as if quoted to prevent it being altered by field splitting and pathname expansion. most shells expand a word which is just ~ to nothing if HOME='' rather than (effectively) to "" which that sentence seems to require. Only bash, the NetBSD shell, and the older version of ksh93 made "". (Again, the FreeBSD shell just produces ~ here, for the same reason as above). This all needs to be cleaned up. Desired Action: I'd suggest requiring that if a pathname resulting from a tilde espansion (a term which really ought be better defined - I assume that in ~/foo where HOME=/dir that the pathname intended is "/dir" not "/dir/foo" otherwise ~/*.c would never be able to work) ends in a / that if a / occurs as the next character of the word containing the tilde expansion be omitted from the result - as that produces better results overall (despite it going to require changes in most shells, including the one I maintain). I'd also suggest being more explicit either than when HOME='' ~ expands to "" or nothing (it makes no difference if there is more to the word). For this, I'd prefer "" (for both the obvious reason, and because it is more consistemt with both the current wording, and useful behaviour). == Issue History Date ModifiedUsername FieldChange == 2023-01-31 00:58 kreNew Issue 2023-01-31 00:58 kreName => Robert Elz 2023-01-31 00:58 kreSection => XCU 2.6.1 2023-01-31 00:58 krePage Number => 2319-2320 2023-01-31 00:58 kreLine Number => 74775-74794 ==