| Summary: | 'set +o' in /bin/sh does not include unset options | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Jilles Tjoelker <jilles> | ||||
| Component: | standards | Assignee: | Stefan Farfeleder <stefanf> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 6.0-CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-standards->tjr Over to Tim J. Robbins, who implemented the current 'set +o' output in rev. 1.19 of options.c. Responsible Changed From-To: tjr->freebsd-standards Unassign due to lack of time. Responsible Changed From-To: freebsd-standards->stefanf I'll handle this. State Changed From-To: open->patched Committed in a slightly modified way. Thanks! State Changed
From-To: patched->closed
Also fixed in RELENG_{5,6}.
|
The output of 'set +o' only contains options that are set, not options that are unset. IEEE Std 1003.1-2001 says: +o Write the current option settings to standard output in a format that is suitable for reinput to the shell as commands that achieve the same options settings. Obviously, the current implementation does not achieve that. The man page says this which might be interpreted both ways: If +o is used without an argument, the current option settings are output in a format suitable for re-input into the shell. Fix: Include unset options with '+o' in the output of 'set +o'. Patch included. How-To-Repeat: jilles@hammer /home/jilles$ /bin/sh $ set +o set -o interactive -o monitor -o stdin $ A more complicated real-world-like demonstration is the following shell script: #!/bin/sh settings="$(set +o)" set -o noglob eval "$settings" echo /* It outputs '/*' with the current version of /bin/sh. The script works correctly (shows all files directly under /) with bash-2.05b.007_2 and Solaris 10 /usr/xpg4/bin/sh.