Hi,

we've got complains that ksh produces incorrect ps output for scripts without shebang.

Reproducer:
cat >first.sh <<EOF
#!/bin/ksh
./second.sh abcdefghijklmnopqrstuvwxyz
EOF

cat >second.sh <<EOF
echo "args: $0 $@"
echo "ps  : $(ps -eo pid,args | grep $$ | grep -v grep)"
EOF

chmod +x first.sh second.sh

ksh -x ./first.sh abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ

produces:
+ ./second.sh abcdefghijklmnopqrstuvwxyz
args: ./second.sh abcdefghijklmnopqrstuvwxyz
ps : 18144 ./second.sh abcdefghijklmnopqrstuvwxyz vwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ

so ksh debug output and arguments are correct, but ps output has artifacts from original process

I can see there is fixargs() for ps in main.c, which modifies argv[0], but ps still prints the artifacts.

Michal
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to