View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001601 | 1003.1(2016/18)/Issue7+TC2 | Shell and Utilities | public | 2022-08-23 15:09 | 2024-06-11 09:07 |
Reporter | kre | Assigned To | |||
Priority | normal | Severity | Objection | Type | Error |
Status | Closed | Resolution | Accepted | ||
Name | Robert Elz | ||||
Organization | |||||
User Reference | |||||
Section | XCU 2.14 cd | ||||
Page Number | 2562 | ||||
Line Number | 82969 - 82971 | ||||
Interp Status | --- | ||||
Final Accepted Text | See Desired Action | ||||
Summary | 0001601: when cd sets OLDPWD not all shells export it to the environment | ||||
Description | The cd utility description includes thus If, during the execution of the above steps, the PWD environment variable is set, the OLDPWD environment variable shall also be set [...] (what it gets set to is not the issue). The same sentence appears in Issue 8 draft 2.1 (lines 82512-4) For OLDPWD to be an "environment variable" (as defined in XBD 8.1) it needs to be exported in shell terminology. Otherwise it would simply be a variable (as for example used in the getopts and read utilities). It turns out that only about half the shells I have available to test cause OLDPWD to be exported. The ash derived shells all do, as does ksh93 and zsh. But bash, bosh, pdksh, mksh, and yash do not. I don't know what ksh88 does. The simple test is: unset OLDPWD; # so it is not exported from the current environment cd /anywhere/that/exists env | grep OLDPWD All shells I tested set the variable OLDPWD in this case, they just don't all export it (to make it become an environment variable). One could also discuss PWD in a similar vein, but for PWD things become unspecified if the user/application sets or unsets it, so that one gets to be impossible to easily test. | ||||
Desired Action | Change the sentence above by deleting the word "environment" after OLDPWD, and then add another sentence It is unspecified whether, when setting OLDPWD, the shell also causes it to be exported if it was not already. Or something like that. Alternatively, if the standard really is intending to require implementations to export OLDPWD when it is set by the cd command, then it clearly needs to be more explicit in how it states that. | ||||
Tags | tc3-2008 |
Date Modified | Username | Field | Change |
---|---|---|---|
2022-08-23 15:09 | kre | New Issue | |
2022-08-23 15:09 | kre | Name | => Robert Elz |
2022-08-23 15:09 | kre | Section | => XCU 2.14 cd |
2022-08-23 15:09 | kre | Page Number | => 2562 |
2022-08-23 15:09 | kre | Line Number | => 82969 - 82971 |
2022-10-24 15:50 | nick | Interp Status | => --- |
2022-10-24 15:50 | nick | Final Accepted Text | => See Desired Action |
2022-10-24 15:50 | nick | Status | New => Resolved |
2022-10-24 15:50 | nick | Resolution | Open => Accepted |
2022-10-24 15:50 | nick | Tag Attached: issue8 | |
2022-10-24 15:51 | nick | Tag Detached: issue8 | |
2022-10-24 15:51 | nick | Tag Attached: tc3-2008 | |
2022-11-08 14:13 | geoffclare | Status | Resolved => Applied |
2024-06-11 09:07 | agadmin | Status | Applied => Closed |