zsh-workers
 help / color / mirror / code / Atom feed
* Empty file execution behavior differs between zsh and sh
@ 2018-02-23 18:21 William Shipley
  2018-02-23 21:59 ` Eric Cook
  2018-02-23 22:12 ` Eric Cook
  0 siblings, 2 replies; 3+ messages in thread
From: William Shipley @ 2018-02-23 18:21 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Empty file execution behavior differs between zsh and sh
  2018-02-23 18:21 Empty file execution behavior differs between zsh and sh William Shipley
@ 2018-02-23 21:59 ` Eric Cook
  2018-02-23 22:12 ` Eric Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Cook @ 2018-02-23 21:59 UTC (permalink / raw)
  To: zsh-workers

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.
> 

for more context why this was probably reported:
https://twitter.com/rob_pike/status/966896123548872705


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Empty file execution behavior differs between zsh and sh
  2018-02-23 18:21 Empty file execution behavior differs between zsh and sh William Shipley
  2018-02-23 21:59 ` Eric Cook
@ 2018-02-23 22:12 ` Eric Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Cook @ 2018-02-23 22:12 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-23 22:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23 18:21 Empty file execution behavior differs between zsh and sh William Shipley
2018-02-23 21:59 ` Eric Cook
2018-02-23 22:12 ` Eric Cook

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).