Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shc not working with ksh 93u+ #13

Closed
kparcher opened this issue May 25, 2016 · 1 comment
Closed

shc not working with ksh 93u+ #13

kparcher opened this issue May 25, 2016 · 1 comment

Comments

@kparcher
Copy link

uname -a
Linux dove 2.6.32-573.1.1.el6.x86_64 #1 SMP Tue Jul 14 02:46:51 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

ksh --version
  version         sh (AT&T Research) 93u+ 2012-08-01

cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)

I compiled a simple ksh shell script with shc (it does not matter which options are used or what the shell script actually does, the result is the same).

./a.out

shll=main
argc=1
argv[0]=./a.out
argv[1]=<null>
getenv(xffffffe4ac74559f)=<null>
shll=/bin/ksh
argc=4
argv[0]=./a.out
argv[1]=-c
argv[2]=exec '*23612*./a.out' "$@"
argv[3]=./a.out
argv[4]=<null>
./a.out: exec: *23612*./a.out: not found

The ksh environment has a strange entry for $_

env

_=*23612*/bin/env
DBPATH=/cms/db/inf
DB_LOCALE=en_us.utf8
G_BROKEN_FILENAMES=1
HISTCONTROL=ignoredups
HISTSIZE=1000
HOME=/root
...

The problem is in the xsh function and here is how I fixed it temporarily:

        //char * me = getenv("_");
        //if (me == NULL) { me = argv[0]; }
        char * me = argv[0];

I am sure there is a better way to fix this permanently.

neurobin added a commit that referenced this issue Jul 30, 2016
neurobin added a commit that referenced this issue Jul 30, 2016
@neurobin
Copy link
Owner

Fixed in 3.9.3a4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants