Re: [OpenWrt-Devel] Hang on setting $PROMPT in master

2019-10-21 Thread Koen Vandeputte



On 21.10.19 17:04, Martin Tippmann wrote:

We are using a shell-function to set the prompt based on return code -
it works fine in 17.01 / 18.06 / 19.07, however in current master when
the function is run the terminal/ssh session hangs.

how to reproduce:



<--- hang.sh:
#!/bin/sh


You could add following line here to check where it hangs:

set -x


prompt_set() {
face() {
 local rc=$?
 case "$rc" in
0) printf '%s' "$1" ;;
*) printf '%s' "$2" ; return $rc ;;
   esac
}

local e='\[\e' # start escape-sequence
local c='\]' # close escape-sequence

local user='\u'
local wdir='\w' # workdir
local host='\h' # short form

 local reset="${e}[0m${c}" # all attributes
 local white="${e}[37m${c}"
 local cyan="${e}[36m${c}"
 local yellow="${e}[33;1m${c}" # bold
 local green="${e}[32m${c}"
 local red="${e}[31m${c}"

 local ok="${green}:)"
 local bad="${red}8("

# e.g. user@hostname:~ :)
export PS1="${cyan}${user}$white@${green}$host:${yellow}$wdir \$(
face '$ok' '$bad' ) $reset"
}

prompt_set
-->

now source the file:

. ./hang.sh

shellcheck does not complain - I'm writing because I'm not sure wether
this invalid sh that happened to work anyway or is this a
bug/regression in ash?

regards
Martin

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Hang on setting $PROMPT in master

2019-10-21 Thread Jo-Philipp Wich
Hi,

might be related to this:
http://lists.busybox.net/pipermail/busybox/2019-October/087535.html

Regards,
Jo

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Hang on setting $PROMPT in master

2019-10-21 Thread Martin Tippmann
We are using a shell-function to set the prompt based on return code -
it works fine in 17.01 / 18.06 / 19.07, however in current master when
the function is run the terminal/ssh session hangs.

how to reproduce:



<--- hang.sh:
#!/bin/sh

prompt_set() {
   face() {
local rc=$?
case "$rc" in
   0) printf '%s' "$1" ;;
   *) printf '%s' "$2" ; return $rc ;;
  esac
   }

   local e='\[\e' # start escape-sequence
   local c='\]' # close escape-sequence

   local user='\u'
   local wdir='\w' # workdir
   local host='\h' # short form

local reset="${e}[0m${c}" # all attributes
local white="${e}[37m${c}"
local cyan="${e}[36m${c}"
local yellow="${e}[33;1m${c}" # bold
local green="${e}[32m${c}"
local red="${e}[31m${c}"

local ok="${green}:)"
local bad="${red}8("

   # e.g. user@hostname:~ :)
   export PS1="${cyan}${user}$white@${green}$host:${yellow}$wdir \$(
face '$ok' '$bad' ) $reset"
}

prompt_set
-->

now source the file:

. ./hang.sh

shellcheck does not complain - I'm writing because I'm not sure wether
this invalid sh that happened to work anyway or is this a
bug/regression in ash?

regards
Martin

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel