From 5acf5e1f870fb5382556d4b434158f7d497893ca Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 11 Oct 2021 18:39:25 +0200 Subject: shell: fix script's comm field if ENABLE_FEATURE_PREFER_APPLETS=y function old new delta re_execed_comm - 46 +46 main 72 86 +14 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 60/0) Total: 60 bytes Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-comm/comm.right | 6 ++++++ shell/hush_test/hush-comm/comm.tests | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 shell/hush_test/hush-comm/comm.right create mode 100755 shell/hush_test/hush-comm/comm.tests (limited to 'shell/hush_test') diff --git a/shell/hush_test/hush-comm/comm.right b/shell/hush_test/hush-comm/comm.right new file mode 100644 index 0000000..1b62b61 --- /dev/null +++ b/shell/hush_test/hush-comm/comm.right @@ -0,0 +1,6 @@ +./SCRIPT.sh: + /proc/N/comm: SCRIPT.sh +exec ./SCRIPT.sh: + /proc/N/comm: SCRIPT.sh +sh ./SCRIPT.sh: + /proc/N/comm: hush diff --git a/shell/hush_test/hush-comm/comm.tests b/shell/hush_test/hush-comm/comm.tests new file mode 100755 index 0000000..671bfc1 --- /dev/null +++ b/shell/hush_test/hush-comm/comm.tests @@ -0,0 +1,20 @@ +{ +echo "#!$THIS_SH" +echo 'procdir=/proc/$$' +#echo 'echo " /proc/N/exe: $(basename $(readlink $procdir/exe))"' +echo 'echo " /proc/N/comm: $(cat $procdir/comm)"' +} >SCRIPT.sh +chmod 755 SCRIPT.sh + +# comm field was wrong if CONFIG_FEATURE_PREFER_APPLETS=y +echo './SCRIPT.sh:' +./SCRIPT.sh + +# comm field was wrong if CONFIG_FEATURE_PREFER_APPLETS=y +echo 'exec ./SCRIPT.sh:' +(exec ./SCRIPT.sh) + +echo 'sh ./SCRIPT.sh:' +$THIS_SH ./SCRIPT.sh + +rm SCRIPT.sh -- cgit v1.1