View Issue Details

IDProjectCategoryView StatusLast Update
00006121003.1(2008)/Issue 7System Interfacespublic2019-06-10 08:55
Reporternsz Assigned Toajosey  
PrioritynormalSeverityEditorialTypeClarification Requested
Status ClosedResolutionAccepted As Marked 
NameSzabolcs Nagy
Organization
User Reference
Sectiondirname()
Page Number725-726
Line Number24372-24373
Interp Status---
Final Accepted TextSee 0000612:0001394
Summary0000612: dirname of "usr/" or "/" are not clear
Descriptionit seems the intention of dirname(path) is to return "." when path is "usr/", and return "/" when path is "/", but the wording is not quite clear about it.

the text says trailing '/' should be dropped:

"Trailing '/' characters in the path are not counted as part of the path."

and for a path without '/', dirname should return ".":

"If path does not contain a '/' , then dirname() shall return a pointer to the string "." ."

however in this second sentence path is in italic, which means it's not "the path" of the first sentence, but the argument, so the "usr/" case is not covered.

if the path in the second sentence is already stripped from trailing '/', then the "/" path case is not covered.
Desired Actionchange the wording of the normative text so it's clear that "usr/" path returns "." and "/" path returns "/".
Tagstc2-2008

Relationships

related to 0000653 Closedajosey 1003.1(2008)/Issue 7 incomplete definition of basename 
related to 0000830 Closed 1003.1(2013)/Issue7+TC1 not clear that dirname() is purely a string operation 
related to 0001073 Closedajosey 1003.1(2008)/Issue 7 dirname utility: algorithm for computing pathname string is stricter than the corresponding dirname() function 

Activities

Don Cragun

2012-10-10 14:52

manager   bugnote:0001394

Last edited: 2012-10-31 16:24

To fix the problem reported in this bug:

Change the last sentence of the first paragraph of the dirname
DESCRIPTION on P725, L24372-24373 from:
Trailing ’/’ characters in the path are not counted as part of the
path.
to:
Trailing ’/’ characters in the path that are not also leading '/'
characters shall not be counted as part of the path.

To more closely align the descriptions of baseame() and dirname():

Add a new paragraph in the dirname() DESCRIPTION section after P725,
L24375:
The dirname() function may modify the string pointed to by path, and may
return a pointer to static storage that may then be overwritten by a
subsequent call to dirname().

To make it obvious that the basename() and dirname() functions and the
basename and dirname utilities are closely related, make the following
additions and changes to EXAMPLES and SEE ALSO sections:

Change P614, L20996-21004 in the basename() EXAMPLES section from:
Sample Input and Output Strings for basename()

In the following table, the input string is the value pointed to by
path, and the output string is the return value of the basename()
function.

      Input String      Output String
     ==============     =============
     "/usr/lib"         "lib"
     "/usr/"            "usr"
     "/"                "/"
     "///"              "/"
     "//usr//lib//"     "lib"

to:
Sample Input and Output Strings for the basename() and dirname()
functions and the basename and dirname utilities

In the following table, the input string is the value pointed to by
path, and the output string is the return value of the basename()
function.
                                                              output    output
                                                basename     written    written
  basename() and     string       string      and dirname       by        by
dirname() functions returned by returned by    utilities     basename   dirname
  path argument     basename()  dirname()    string operand  utility    utility
================== =========== ============ ================ ======== ==========
"usr"              "usr"       "."          usr              usr      .
"usr/"             "usr"       "."          usr/             usr      .
""                 "."         "."          ""         NOTE    .
"/"                "/"         "/"          /                /        /
"//"		   "/" or "//" "/" or "//"  //		     / or // / or //
"///"              "/"         "/"          ///              /        /
"/usr/"            "usr"       "/"          /usr/            usr      /
"/usr/lib"         "lib"       "/usr"       /usr/lib         lib      /usr
"//usr//lib//"     "lib"       "//usr"      //usr//lib//     lib      //usr
"/home//dwc//test" "test"      "/home//dwc" /home//dwc//test test     /home//dwc

Note to the editor: Change "NOTE" in the above table to ". or empty string" split into multiple lines if needed under the heading "output written by basename utility".

Change the "Sample Input and Output Strings for dirname()" example in
the dirname() EXAMPLES on P726, L24404-24413 to:
The EXAMPLES section of the basename() function (see XREF basename()
EXAMPLES section on page XXX) includes a table showing examples of the
results of processing several sample pathnames by the basename() and
dirname() functions and by the basename and dirname utilities.

Add a new paragraph at the end of the basename utility's EXAMPLES
section after P2465, L78660:
The EXAMPLES section of the basename() function (see XREF to XSH
basename() EXAMPLES section) includes a table showing examples of the
results of processing several sample pathnames by the basename() and
dirname() functions and by the basename and dirname utilities.

Add a new paragraph at the end of the basename utility's SEE ALSO section after P2466, L78676:
XSH basename(),

Change the table in the dirname utility's EXAMPLES section on P2609,
L84125-84135 to:
The EXAMPLES section of the basename() function (see XREF to XSH
basename() EXAMPLES section) includes a table showing examples of the
results of processing several sample pathnames by the basename() and
dirname() functions and by the basename and dirname utilities.

Add a new paragraph to the end of the dirname utility's SEE ALSO section after P2610, L84154:
XSH dirname()


Issue History

Date Modified Username Field Change
2012-09-24 21:39 nsz New Issue
2012-09-24 21:39 nsz Status New => Under Review
2012-09-24 21:39 nsz Assigned To => ajosey
2012-09-24 21:39 nsz Name => Szabolcs Nagy
2012-09-24 21:39 nsz Section => dirname
2012-09-24 21:39 nsz Page Number => 1-10000
2012-09-24 21:39 nsz Line Number => 1-10000
2012-10-10 14:52 Don Cragun Section dirname => dirname()
2012-10-10 14:52 Don Cragun Page Number 1-10000 => 725-726
2012-10-10 14:52 Don Cragun Line Number 1-10000 => 24372-24373
2012-10-10 14:52 Don Cragun Interp Status => ---
2012-10-10 14:52 Don Cragun Note Added: 0001394
2012-10-10 14:53 Don Cragun Note Edited: 0001394
2012-10-17 20:37 Don Cragun Note Edited: 0001394
2012-10-17 20:42 Don Cragun Note Edited: 0001394
2012-10-31 15:23 Don Cragun Note Edited: 0001394
2012-10-31 15:24 Don Cragun Note Edited: 0001394
2012-10-31 15:25 Don Cragun Note Edited: 0001394
2012-10-31 15:28 Don Cragun Note Edited: 0001394
2012-10-31 15:29 Don Cragun Note Edited: 0001394
2012-10-31 15:30 Don Cragun Note Edited: 0001394
2012-10-31 15:30 Don Cragun Note Edited: 0001394
2012-10-31 15:31 Don Cragun Note Edited: 0001394
2012-10-31 15:32 Don Cragun Note Edited: 0001394
2012-10-31 15:33 Don Cragun Note Edited: 0001394
2012-10-31 15:34 Don Cragun Note Edited: 0001394
2012-10-31 15:35 Don Cragun Note Edited: 0001394
2012-10-31 15:37 Don Cragun Note Edited: 0001394
2012-10-31 15:38 Don Cragun Note Edited: 0001394
2012-10-31 15:57 Don Cragun Note Edited: 0001394
2012-10-31 16:10 Don Cragun Note Edited: 0001394
2012-10-31 16:12 Don Cragun Note Edited: 0001394
2012-10-31 16:13 Don Cragun Note Edited: 0001394
2012-10-31 16:13 Don Cragun Note Edited: 0001394
2012-10-31 16:16 Don Cragun Note Edited: 0001394
2012-10-31 16:17 Don Cragun Note Edited: 0001394
2012-10-31 16:18 Don Cragun Note Edited: 0001394
2012-10-31 16:19 Don Cragun Note Edited: 0001394
2012-10-31 16:20 Don Cragun Note Edited: 0001394
2012-10-31 16:23 Don Cragun Note Edited: 0001394
2012-10-31 16:24 Don Cragun Note Edited: 0001394
2012-10-31 16:26 Don Cragun Final Accepted Text => See 0000612:0001394
2012-10-31 16:26 Don Cragun Status Under Review => Resolved
2012-10-31 16:26 Don Cragun Resolution Open => Accepted As Marked
2012-10-31 16:27 Don Cragun Tag Attached: tc2-2008
2013-02-06 12:38 geoffclare Relationship added related to 0000653
2014-03-28 15:20 geoffclare Relationship added related to 0000830
2016-08-30 08:47 geoffclare Relationship added related to 0001073
2019-06-10 08:55 agadmin Status Resolved => Closed