View Issue Details

IDProjectCategoryView StatusLast Update
00002301003.1(2008)/Issue 7Shell and Utilitiespublic2013-04-16 13:06
ReporterKonrad_Schwarz Assigned Toajosey  
PrioritynormalSeverityEditorialTypeClarification Requested
Status ClosedResolutionAccepted 
NameKonrad Schwarz
OrganizationSiemens AG
User Referencecd-algorithm-simlification
Sectioncd
Page Numberhttp://www.opengroup.org/onlinepubs/9699919799/utilities/cd.html
Line NumberSection DESCRIPTION, Step 6
Interp Status---
Final Accepted Text
Summary0000230: Simplify step 6
DescriptionThere is some overlap in the actions of step 6 and 7. The casual reader might be mislead into thinking that the "prefixing" of the *curpath* variable with _PWD_ and a slash could happen twice.

Removing the prefixing action in step 6 does not change the algorithm and eliminates this source of confusion by making the presentation simpler.

Below is a more precise analysis of the algorithm, taken from my post to austin-group-l@opengroup.org on 2010-03-26:

If -P is not in effect, step 6 says that *curpath* is set to the concatenation of _PWD_, possibly a slash, and the operand, then to proceed with step 7.

If -P is not in effect, step 7 says that *curpath* is prefixed with _PWD_ and possibly a slash if it does not begin with a slash character.

The only other ways to get to step 7 are via step 3, if *curpath* begins with a slash, and step 5, if the concatenation results in an existing directory. The prefixing in step 7 does not apply coming from step 3. It may apply coming from step 5.

Step 6 can be reached via step 4 or step 5.

In the first case (step 4), _directory_ starts with . or ..
In this case *curpath* is set to _PWD_/_directory_ in step 6.
Were prefixing not done in step 6, it would be done in step 7.

Otherwise (end of step 5), *curpath* has not been found by scanning CDPATH, does not begin with . or .. (because of step 4), and does not begin with / (because of step 3).
Were prefixing not done in step 6, it would be done in step 7.

Thus, in every path leading to step 6 that leads to step 7, the prefixing action done in step 6 could be omitted, since it would be done in step 7.

If _PWD_ did not start with a slash, the combined result of steps 6 and 7 would be to prefix it twice with _PWD_. (Such a value of _PWD_ is possible if the application, invoking unspecified behavior, modifies _PWD_.)
Desired ActionStep 6 should be changed to just:

    6. Set curpath to the directory operand.
Tagstc1-2008

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2010-03-29 07:59 Konrad_Schwarz New Issue
2010-03-29 07:59 Konrad_Schwarz Status New => Under Review
2010-03-29 07:59 Konrad_Schwarz Assigned To => ajosey
2010-03-29 07:59 Konrad_Schwarz Name => Konrad Schwarz
2010-03-29 07:59 Konrad_Schwarz Organization => Siemens AG
2010-03-29 07:59 Konrad_Schwarz User Reference => cd-algorithm-simlification
2010-03-29 07:59 Konrad_Schwarz Section => cd
2010-03-29 07:59 Konrad_Schwarz Page Number => http://www.opengroup.org/onlinepubs/9699919799/utilities/cd.html
2010-03-29 07:59 Konrad_Schwarz Line Number => Section DESCRIPTION, Step 6
2010-04-15 15:37 Don Cragun Interp Status => ---
2010-04-15 15:37 Don Cragun Status Under Review => Resolved
2010-04-15 15:37 Don Cragun Resolution Open => Accepted
2010-08-27 12:51 ajosey Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Resolved => Closed