Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Empty file execution behavior differs between zsh and sh



On 02/23/2018 01:21 PM, William Shipley wrote:
> In sh and bash
> 
> touch true
> chmod +x true
> ./true
> echo $?
> 
> prints 0, as an empty file returns successfully on execution.
> 
> On zsh, the same command returns
> 
> zsh: exec format error: ./true
> 
> on stderr and
> 
> 126
> 
> for the echo statement.
> 
> This holds true when running zsh in sh compatibility mode:
> 
> ARGV0=sh zsh
> 
> I don't consider this of pressing importance, but it would be one step
> closer to sh compatibility.
> 

% touch true;chmod +x true; for sh in /bin/zsh-*; $sh -c 'print -n $ZSH_VERSION\ ;./true; echo $?'
3.0.8 zsh: exec format error: ./true
1
3.1.9 zsh: exec format error: ./true
1
4.0.9 zsh: exec format error: ./true
1
4.2.7 zsh: exec format error: ./true
126
4.3.17 zsh:1: exec format error: ./true
126
5.0.5 zsh:1: exec format error: ./true
126
5.0.7 zsh:1: exec format error: ./true
126
5.0.8 zsh:1: exec format error: ./true
126
5.1 zsh:1: exec format error: ./true
126
5.1.1 zsh:1: exec format error: ./true
126
5.2 zsh:1: exec format error: ./true
126
5.3 0
5.3.1 0
5.4 0
5.4.1 0
5.4.2 0



Messages sorted by: Reverse Date, Date, Thread, Author