Discussion:
[ast-developers] LC_ALL=C shcomp crashes
Joshuah Hurst
2013-11-08 12:39:18 UTC
Permalink
LC_ALL=C shcomp crashes but my Debian system has no debugger. Can
anyone investigate, please?

Josh
Joshuah Hurst
2013-11-08 17:20:22 UTC
Permalink
shcomp on why file crashes?
printf 'print hello' | LC_ALL=C /usr/bin/shcomp | /usr/bin/ksh
dumps core

Josh
Post by Joshuah Hurst
LC_ALL=C shcomp crashes but my Debian system has no debugger. Can
anyone investigate, please?
Josh
--
Josh
Roland Mainz
2013-11-09 23:27:43 UTC
Permalink
Post by Joshuah Hurst
Post by Joshuah Hurst
LC_ALL=C shcomp crashes but my Debian system has no debugger. Can
anyone investigate, please?
shcomp on why file crashes?
printf 'print hello' | LC_ALL=C /usr/bin/shcomp | /usr/bin/ksh
dumps core
I can reproduce the issue on Illumos with "shcomp" from a
ast-ksh.2013-10-10/AMD64/64bit build:
-- snip --
$ printf 'print hello' | LC_ALL=C ~/bin/shcomp | ~/bin/ksh
$ dbx - core
Corefile specified executable: "/home/test001/bin/shcomp"
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.6' in your .dbxrc
Reading shcomp
core file header read successfully
Reading ld.so.1
Reading libm.so.2
Reading libdl.so.1
Reading libsocket.so.1
Reading libnsl.so.1
Reading libmd.so.1
Reading libsecdb.so.1
Reading libc.so.1
program terminated by signal SEGV (no mapping at the fault address)
Current function is dtuserdata
45 return asogetptr(&dt->data->user.data);
(dbx) where
=>[1] dtuserdata(dt = (nil), data = (nil), set = 0), line 45 in "dtuser.c"
[2] nv_open(name = 0xfffffd7fff039bd0 "_AST_FEATURES=CONFORMANCE -
ast", root = (nil), flags = 2105984), line 1412 in "name.c"
[3] sh_setenviron(name = 0xfffffd7fff039bd0
"_AST_FEATURES=CONFORMANCE - ast"), line 3295 in "name.c"
[4] _ast_setenviron(name = 0xfffffd7fff039bd0
"_AST_FEATURES=CONFORMANCE - ast"), line 3308 in "name.c"
[5] synthesize(fp = 0x6d3908, path = 0x6b1f50 "-", value = 0x6b2278
"ast"), line 481 in "astconf.c"
[6] initialize(fp = 0x6d3908, path = 0x6d3b70 "/", command = (nil),
succeed = 0x6b1fa0 "standard", fail = 0x6b2278 "ast"), line 620 in
"astconf.c"
[7] format(fp = 0x6d3908, path = 0x6d3b70 "/", value = (nil), flags
= 0, conferror = (nil)), line 686 in "astconf.c"
[8] feature(fp = 0x6d3908, name = 0x6b2f70 "CONFORMANCE", path =
0x6d3b70 "/", value = (nil), flags = 0, conferror = (nil)), line 864
in "astconf.c"
[9] astgetconf(name = 0x6b2f70 "CONFORMANCE", path = 0x6d3b70 "/",
value = (nil), flags = 0, conferror = (nil)), line 1547 in "astconf.c"
[10] astconf(name = 0x6b2f70 "CONFORMANCE", path = (nil), value =
(nil)), line 1569 in "astconf.c"
[11] initconformance(), line 53 in "conformance.c"
[12] conformance(s = (nil), n = 0), line 125 in "conformance.c"
[13] _ast_codeset(op = 0), line 55 in "codeset.c"
[14] set_ctype(cp = 0x6d0d48), line 2386 in "setlocale.c"
[15] single(category = 2, lc = 0x6d1030, flags = 0), line 2625 in
"setlocale.c"
[16] _ast_setlocale(category = 0, locale = 0x6ad748 ""), line 2902
in "setlocale.c"
[17] init(s = 0x654ed4 "[-?\n@(#)$Id: shcomp (AT&T Research)
2003-03-02 $\n][-author?David Korn
<dgk at research.att.com>][-copyright?Copyright (c) 1982-2013 AT&T
Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libshell][+NAME?shcomp
- compile a shell script][+DESCRIPTION?Unless ^H-D^H is specified,
^Hshcomp^H takes a shell script, ^Ginfile^G, and creates a binary
format file, ^Goutfile^G, that ^Hksh^H can read and execute with the
same effect as the original script.][+?Since aliases are processed as
" ..., p = 0x6e63e8), line 994 in "optget.c"
[18] _ast_optget(argv = 0xfffffd7fffdffc58, oopts = 0x654ed4
"[-?\n@(#)$Id: shcomp (AT&T Research) 2003-03-02 $\n][-author?David
Korn <dgk at research.att.com>][-copyright?Copyright (c) 1982-2013 AT&T
Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libshell][+NAME?shcomp
- compile a shell script][+DESCRIPTION?Unless ^H-D^H is specified,
^Hshcomp^H takes a shell script, ^Ginfile^G, and creates a binary
format file, ^Goutfile^G, that ^Hksh^H can read and execute with the
same effect as the original script.][+?Since aliases are processed as
" ...), line 4388 in "optget.c"
[19] main(argc = 1, argv = 0xfffffd7fffdffc58), line 79 in "shcomp.c"
-- snip --

The important part seems to be the $ env - ... # to clear the
environment and then explicitly set LC_ALL=C ... note that |nv_open()|
is called with a |NULL| |root| argument...

----

Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
Roland Mainz
2013-11-09 23:34:00 UTC
Permalink
Post by Roland Mainz
Post by Joshuah Hurst
Post by Joshuah Hurst
LC_ALL=C shcomp crashes but my Debian system has no debugger. Can
anyone investigate, please?
shcomp on why file crashes?
printf 'print hello' | LC_ALL=C /usr/bin/shcomp | /usr/bin/ksh
dumps core
I can reproduce the issue on Illumos with "shcomp" from a
-- snip --
$ printf 'print hello' | LC_ALL=C ~/bin/shcomp | ~/bin/ksh
$ dbx - core
Corefile specified executable: "/home/test001/bin/shcomp"
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.6' in your .dbxrc
Reading shcomp
core file header read successfully
Reading ld.so.1
Reading libm.so.2
Reading libdl.so.1
Reading libsocket.so.1
Reading libnsl.so.1
Reading libmd.so.1
Reading libsecdb.so.1
Reading libc.so.1
program terminated by signal SEGV (no mapping at the fault address)
Current function is dtuserdata
45 return asogetptr(&dt->data->user.data);
(dbx) where
=>[1] dtuserdata(dt = (nil), data = (nil), set = 0), line 45 in "dtuser.c"
[2] nv_open(name = 0xfffffd7fff039bd0 "_AST_FEATURES=CONFORMANCE -
ast", root = (nil), flags = 2105984), line 1412 in "name.c"
[3] sh_setenviron(name = 0xfffffd7fff039bd0
"_AST_FEATURES=CONFORMANCE - ast"), line 3295 in "name.c"
[4] _ast_setenviron(name = 0xfffffd7fff039bd0
"_AST_FEATURES=CONFORMANCE - ast"), line 3308 in "name.c"
[5] synthesize(fp = 0x6d3908, path = 0x6b1f50 "-", value = 0x6b2278
"ast"), line 481 in "astconf.c"
[6] initialize(fp = 0x6d3908, path = 0x6d3b70 "/", command = (nil),
succeed = 0x6b1fa0 "standard", fail = 0x6b2278 "ast"), line 620 in
"astconf.c"
[7] format(fp = 0x6d3908, path = 0x6d3b70 "/", value = (nil), flags
= 0, conferror = (nil)), line 686 in "astconf.c"
[8] feature(fp = 0x6d3908, name = 0x6b2f70 "CONFORMANCE", path =
0x6d3b70 "/", value = (nil), flags = 0, conferror = (nil)), line 864
in "astconf.c"
[9] astgetconf(name = 0x6b2f70 "CONFORMANCE", path = 0x6d3b70 "/",
value = (nil), flags = 0, conferror = (nil)), line 1547 in "astconf.c"
[10] astconf(name = 0x6b2f70 "CONFORMANCE", path = (nil), value =
(nil)), line 1569 in "astconf.c"
[11] initconformance(), line 53 in "conformance.c"
[12] conformance(s = (nil), n = 0), line 125 in "conformance.c"
[13] _ast_codeset(op = 0), line 55 in "codeset.c"
[14] set_ctype(cp = 0x6d0d48), line 2386 in "setlocale.c"
[15] single(category = 2, lc = 0x6d1030, flags = 0), line 2625 in
"setlocale.c"
[16] _ast_setlocale(category = 0, locale = 0x6ad748 ""), line 2902
in "setlocale.c"
2003-03-02 $\n][-author?David Korn
<dgk at research.att.com>][-copyright?Copyright (c) 1982-2013 AT&T
Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libshell][+NAME?shcomp
- compile a shell script][+DESCRIPTION?Unless ^H-D^H is specified,
^Hshcomp^H takes a shell script, ^Ginfile^G, and creates a binary
format file, ^Goutfile^G, that ^Hksh^H can read and execute with the
same effect as the original script.][+?Since aliases are processed as
" ..., p = 0x6e63e8), line 994 in "optget.c"
[18] _ast_optget(argv = 0xfffffd7fffdffc58, oopts = 0x654ed4
Korn <dgk at research.att.com>][-copyright?Copyright (c) 1982-2013 AT&T
Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libshell][+NAME?shcomp
- compile a shell script][+DESCRIPTION?Unless ^H-D^H is specified,
^Hshcomp^H takes a shell script, ^Ginfile^G, and creates a binary
format file, ^Goutfile^G, that ^Hksh^H can read and execute with the
same effect as the original script.][+?Since aliases are processed as
" ...), line 4388 in "optget.c"
[19] main(argc = 1, argv = 0xfffffd7fffdffc58), line 79 in "shcomp.c"
-- snip --
The important part seems to be the $ env - ... # to clear the
environment and then explicitly set LC_ALL=C ... note that |nv_open()|
is called with a |NULL| |root| argument...
1. Fixing Glenn's email address
2. Question to Glenn: Wouldn't it be better to make calling
|_ast_setlocale()| mandatory (by throwing an assert) for each single
application instead of doing it implicitly in |_ast_optget()| ? Aside
from the performance gain it would prevent trouble like this one...

----

Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
Joshuah Hurst
2013-11-13 16:47:59 UTC
Permalink
Post by Roland Mainz
Post by Roland Mainz
Post by Joshuah Hurst
Post by Joshuah Hurst
LC_ALL=C shcomp crashes but my Debian system has no debugger. Can
anyone investigate, please?
shcomp on why file crashes?
printf 'print hello' | LC_ALL=C /usr/bin/shcomp | /usr/bin/ksh
dumps core
I can reproduce the issue on Illumos with "shcomp" from a
-- snip --
$ printf 'print hello' | LC_ALL=C ~/bin/shcomp | ~/bin/ksh
$ dbx - core
Corefile specified executable: "/home/test001/bin/shcomp"
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.6' in your .dbxrc
Reading shcomp
core file header read successfully
Reading ld.so.1
Reading libm.so.2
Reading libdl.so.1
Reading libsocket.so.1
Reading libnsl.so.1
Reading libmd.so.1
Reading libsecdb.so.1
Reading libc.so.1
program terminated by signal SEGV (no mapping at the fault address)
Current function is dtuserdata
45 return asogetptr(&dt->data->user.data);
(dbx) where
=>[1] dtuserdata(dt = (nil), data = (nil), set = 0), line 45 in "dtuser.c"
[2] nv_open(name = 0xfffffd7fff039bd0 "_AST_FEATURES=CONFORMANCE -
ast", root = (nil), flags = 2105984), line 1412 in "name.c"
[3] sh_setenviron(name = 0xfffffd7fff039bd0
"_AST_FEATURES=CONFORMANCE - ast"), line 3295 in "name.c"
[4] _ast_setenviron(name = 0xfffffd7fff039bd0
"_AST_FEATURES=CONFORMANCE - ast"), line 3308 in "name.c"
[5] synthesize(fp = 0x6d3908, path = 0x6b1f50 "-", value = 0x6b2278
"ast"), line 481 in "astconf.c"
[6] initialize(fp = 0x6d3908, path = 0x6d3b70 "/", command = (nil),
succeed = 0x6b1fa0 "standard", fail = 0x6b2278 "ast"), line 620 in
"astconf.c"
[7] format(fp = 0x6d3908, path = 0x6d3b70 "/", value = (nil), flags
= 0, conferror = (nil)), line 686 in "astconf.c"
[8] feature(fp = 0x6d3908, name = 0x6b2f70 "CONFORMANCE", path =
0x6d3b70 "/", value = (nil), flags = 0, conferror = (nil)), line 864
in "astconf.c"
[9] astgetconf(name = 0x6b2f70 "CONFORMANCE", path = 0x6d3b70 "/",
value = (nil), flags = 0, conferror = (nil)), line 1547 in "astconf.c"
[10] astconf(name = 0x6b2f70 "CONFORMANCE", path = (nil), value =
(nil)), line 1569 in "astconf.c"
[11] initconformance(), line 53 in "conformance.c"
[12] conformance(s = (nil), n = 0), line 125 in "conformance.c"
[13] _ast_codeset(op = 0), line 55 in "codeset.c"
[14] set_ctype(cp = 0x6d0d48), line 2386 in "setlocale.c"
[15] single(category = 2, lc = 0x6d1030, flags = 0), line 2625 in
"setlocale.c"
[16] _ast_setlocale(category = 0, locale = 0x6ad748 ""), line 2902
in "setlocale.c"
2003-03-02 $\n][-author?David Korn
<dgk at research.att.com>][-copyright?Copyright (c) 1982-2013 AT&T
Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libshell][+NAME?shcomp
- compile a shell script][+DESCRIPTION?Unless ^H-D^H is specified,
^Hshcomp^H takes a shell script, ^Ginfile^G, and creates a binary
format file, ^Goutfile^G, that ^Hksh^H can read and execute with the
same effect as the original script.][+?Since aliases are processed as
" ..., p = 0x6e63e8), line 994 in "optget.c"
[18] _ast_optget(argv = 0xfffffd7fffdffc58, oopts = 0x654ed4
Korn <dgk at research.att.com>][-copyright?Copyright (c) 1982-2013 AT&T
Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libshell][+NAME?shcomp
- compile a shell script][+DESCRIPTION?Unless ^H-D^H is specified,
^Hshcomp^H takes a shell script, ^Ginfile^G, and creates a binary
format file, ^Goutfile^G, that ^Hksh^H can read and execute with the
same effect as the original script.][+?Since aliases are processed as
" ...), line 4388 in "optget.c"
[19] main(argc = 1, argv = 0xfffffd7fffdffc58), line 79 in "shcomp.c"
-- snip --
The important part seems to be the $ env - ... # to clear the
environment and then explicitly set LC_ALL=C ... note that |nv_open()|
is called with a |NULL| |root| argument...
1. Fixing Glenn's email address
2. Question to Glenn: Wouldn't it be better to make calling
|_ast_setlocale()| mandatory (by throwing an assert) for each single
application instead of doing it implicitly in |_ast_optget()| ? Aside
from the performance gain it would prevent trouble like this one...
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
David, can you reproduce the crash now?

Josh

Loading...