Bug 7671 - internal line numbering is screwed in subshell
Summary: internal line numbering is screwed in subshell
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: bash (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-14 02:51 MSD by at@altlinux.org
Modified: 2006-01-07 00:58 MSK (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description at@altlinux.org 2005-08-14 02:51:34 MSD
$ cat test.sh
:
while getopts d: opt; do
        case "$opt" in
                d) dir="$(readlink -ev "${OPTARG:?}")" ;;
                *) exit 2 ;;
        esac
done
$ bash -e test.sh -d ''
test.sh: line 1: OPTARG: parameter null or not set
$ ash -e test.sh -d '' 
test.sh: 7: OPTARG: parameter not set or null
$ 

Why does bash says it was line 1?
I guess when bash enters subshell, internal line counter is reset to 1.

And why does ash says it was line 7?
It must have been line 4!
Comment 1 Dmitry V. Levin 2005-12-31 02:22:52 MSK
Seems to be fixed in bash-3.0
Comment 2 Dmitry V. Levin 2006-01-06 22:04:43 MSK
Fixed in 3.1.1-alt1.
Comment 3 Dmitry V. Levin 2006-01-07 00:58:46 MSK
ash still not fixed, but I don't care.