Anonymous | Login | 2023-12-07 10:42 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0000114 | [1003.1(2008)/Issue 7] Shell and Utilities | Comment | Omission | 2009-07-01 16:55 | 2013-04-16 13:06 | ||
Reporter | eblake | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | ||||||
Name | Eric Blake | ||||||
Organization | |||||||
User Reference | ebb.dot | ||||||
Section | dot | ||||||
Page Number | 2341 | ||||||
Line Number | 74053 | ||||||
Interp Status | Approved | ||||||
Final Accepted Text | Note: 0000257 | ||||||
Summary | 0000114: dot exit status | ||||||
Description |
The standard is unclear what happens to $? when an argument to . is not found in an interactive shell. Line 74030 states that a diagnostic is written but it is not a syntax error (which generally implies non-zero status), but line 74053 states that the exit status is 0 if no command is executed (and since no file was found, no command was executed). Existing practice is that $? is set to non-zero in this case (although various shells have chosen 1, 2, or 127). In a similar vein, the standard appears to be silent on what happens when ., eval, or trap encounter text that cannot be parsed in isolation. In this case, traditional shells either aborted with non-zero status, or guaranteed non-zero status visible to subsequent commands; but some modern shells do not detect the failure (which can be rather surprising): $ echo 'if' > tmp $ zsh -c 'emulate sh; . ./tmp; echo $?' ./tmp:1: parse error near `\n' 0 $ bash --posix -c 'trap "if" 0'; echo $? bash: exit trap: line 1: syntax error: unexpected end of file 0 It would be nice to tighten this up (even though that renders some existing implementations buggy). |
||||||
Desired Action |
At line 74053 (dot), replace: Returns the value of the last command executed, or a zero exit status if no command is executed. with: If no readable file was found or if the commands in the file could not be parsed, and the shell does not abort, the exit status shall be non-zero. Otherwise, return the value of the last command executed, or a zero exit status if no command is executed. At line 74110 (eval), replace: If there are no arguments, or only null arguments, eval shall return a zero exit status; otherwise, it shall return the exit status of the command defined by the string of concatenated arguments separated by <space> characters. with: If there are no arguments, or only null arguments, eval shall return a zero exit status; otherwise, it shall return the exit status of the command defined by the string of concatenated arguments separated by <space> characters, or a non-zero exit status if the concatenation could not be parsed as a command and the shell did not abort. At line 74864 (trap), replace: The value of "$?" after the trap action completes shall be the value it had before trap was invoked. with: If a trap action cannot be parsed at the time it is invoked, and the shell does not abort, then the value of "$?" shall be non-zero; otherwise the value of "$?" after the trap action completes shall be the value it had before the trap action was invoked. |
||||||
Tags | tc1-2008 | ||||||
Attached Files | |||||||
|
![]() |
|||||||
|
![]() |
|||
Date Modified | Username | Field | Change |
2009-07-01 16:55 | eblake | New Issue | |
2009-07-01 16:55 | eblake | Status | New => Under Review |
2009-07-01 16:55 | eblake | Assigned To | => ajosey |
2009-07-01 16:55 | eblake | Name | => Eric Blake |
2009-07-01 16:55 | eblake | User Reference | => ebb.dot |
2009-07-01 16:55 | eblake | Section | => dot |
2009-07-01 16:55 | eblake | Page Number | => 2341 |
2009-07-01 16:55 | eblake | Line Number | => 74053 |
2009-08-13 16:07 | ajosey | Interp Status | => --- |
2009-08-13 16:07 | ajosey | Note Added: 0000195 | |
2009-10-15 15:07 | nick | Note Added: 0000255 | |
2009-10-15 15:08 | nick | Note Added: 0000256 | |
2009-10-15 15:15 | geoffclare | Note Added: 0000257 | |
2009-10-15 15:21 | geoffclare | Note Edited: 0000257 | |
2009-10-15 15:23 | geoffclare | Interp Status | --- => Pending |
2009-10-15 15:23 | geoffclare | Final Accepted Text | => Note: 0000257 |
2009-10-15 15:23 | geoffclare | Status | Under Review => Interpretation Required |
2009-10-15 15:23 | geoffclare | Resolution | Open => Accepted As Marked |
2009-11-07 07:36 | ajosey | Interp Status | Pending => Proposed |
2009-12-07 16:57 | ajosey | Interp Status | Proposed => Approved |
2010-09-21 11:07 | geoffclare | Tag Attached: tc1-2008 | |
2011-05-16 09:14 | geoffclare | Relationship added | related to 0000443 |
2013-04-16 13:06 | ajosey | Status | Interpretation Required => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |