Re: Interesting bug

2022-02-12 Thread David Hobach
Thanks a lot for the detailed explanations, much appreciated! So essentially it's no bug - just a rather uncommon choice of keywords. I still don't agree with that choice since it can be abused to somewhat hide code in pull requests to less experienced maintainers, but oh well... there's proba

Re: Interesting bug

2022-02-12 Thread David Hobach
P.S.: Also, if you remove the case/esac from the original example, it'll result in a syntax error. So why can the case/esac be used to ignore the syntax error? smime.p7s Description: S/MIME Cryptographic Signature

Re: Interesting bug

2022-02-12 Thread David Hobach
I guess 99% of programmers would either expect "Finished" to be printed or some syntax error. Well, 99% of shell programmers will (hopefully ;-) ) put a blank between "{" and "echo" in the line foo="$(testCode)" || {echo "foo";} Yes, the interesting part is that depending on which space you

Interesting bug

2022-02-12 Thread David Hobach
Dear all, I think I found a rather interesting bug: ``` #!/bin/bash function badCode { echo "bad code executed" } function testCode { #pick some existing file, nonexisting works too though echo "/etc/passwd" } function tfunc { local foo= foo="$(testCode)" || {echo "foo";} cat "$foo" || {