zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH3] Re: avoid closed stdin() in zle widgets
Date: Wed, 14 Jun 2017 15:44:25 -0700	[thread overview]
Message-ID: <170614154425.ZM20199@torch.brasslantern.com> (raw)
In-Reply-To: <20170612190218.GA12445@chaz.gmail.com>

On Jun 12,  8:02pm, Stephane Chazelas wrote:
}
} My point is that a command should be able to reasonably make some
} assumptions, like:
} 
} - stdin should be open for at least reading
} - stdout, stderr should be open for at least writing

Although I understand the security implication of accidentally opening
some other file onto fd 0/1/2, I can't agree with the above statements.
Taken to the logical conclusion, the >&- <&- or 2>&- operators would
be required always to fail with an error.

It should not be the shell's job to plug this hole.  I will agree that
a valid argument is that the shell should not implicitly *open* this
hole, which one could also argue is what the completion system had
been doing in spite of the behavior being documented.  However, with
these two likely exceptions --

} - argv[0] should be set (argc > 0)
} - no dups in the environment

-- there is nothing else on your list where I would agree that the
shell should ignore the user's directives in the name of protecting
an external command from itself.

} $ (limit stacksize 100k; zsh)
} zsh: segmentation fault
} zsh: segmentation fault
} 
} (twice!?). Is that a bug?

I believe what's happening is that both the zsh inside the subshell
and the parent handling the subshell exit are reporting the error,
so one failure / two messages.

However, I can't test directly because I can start zsh -f with a hard
limit stack size of *zero*, so I'm quite curious as to why you get a
crash on 100k.


  reply	other threads:[~2017-06-14 22:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-11 18:20 [PATCH] " Stephane Chazelas
2017-06-12  4:15 ` Eric Cook
2017-06-12  6:05   ` [PATCH2] " Stephane Chazelas
2017-06-12 14:34     ` Daniel Shahaf
2017-06-12 15:10       ` Stephane Chazelas
2017-06-12 15:19         ` [PATCH3] " Stephane Chazelas
2017-06-12 15:34           ` Daniel Shahaf
2017-06-12 16:09             ` Bart Schaefer
2017-06-12 19:02               ` Stephane Chazelas
2017-06-14 22:44                 ` Bart Schaefer [this message]
2017-06-15  8:42                   ` Stephane Chazelas
2017-06-17  3:03                     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170614154425.ZM20199@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).