Re: incorrect lseek() when processing script ending in unterminated line

2016-12-21 Thread Chet Ramey
On 12/21/16 9:35 AM, Stephane Chazelas wrote: > Hello. > > That was discovered at > http://unix.stackexchange.com/a/331884 > > Consider this script that modifies itself (and happens not to > end in a newline character): Thanks for the report, looks like a relatively unlikely scenario. -- ``The

Re: incorrect lseek() when processing script ending in unterminated line

2016-12-21 Thread Stephane Chazelas
2016-12-21 14:35:44 +, Stephane Chazelas: [...] > That sync_buffered_stream is meant to seek back to where we're > meant to resume reading the script when we've read more than > needed, but here b_inputp > b_used would suggest we've processed > code that is passed what we've read. Or more likel

incorrect lseek() when processing script ending in unterminated line

2016-12-21 Thread Stephane Chazelas
Hello. That was discovered at http://unix.stackexchange.com/a/331884 Consider this script that modifies itself (and happens not to end in a newline character): $ printf %s 'printf "\necho %s\n" {1..10} >> $0' > script.sh; bash -x ./script.sh + printf '\necho %s\n' 1 2 3 4 5 6 7 8 9 10 + echo 1