zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: refactor memstream for "print -v"
Date: Tue, 05 Jan 2016 09:48:21 +0000	[thread overview]
Message-ID: <20160105094821.307cca71@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <160104231830.ZM20279@torch.brasslantern.com>

On Mon, 04 Jan 2016 23:18:30 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> - Should "print -v foo bar" write the trailing newline into $foo ?  In the
>   patch below I've chosen to make -n implicit with -v.  This does not
>   involve "printf" which always needs an explicit newline.

That's probably reasonable --- it would only become crucial which way it
was defined if you were able to append to the variable by some such
means, so needed the intervening newlines, but there's no call for that.

> - I did not change any behavior of the -z / -s / -S options, or at least
>   have not intentionally done so.  However, there have never been any
>   Test/B03* cases for those.

Interactive behaviour is much more lightly tested, but there is now some
prior art for both history and ZLE.  It probably goes in those areas.

> - I believe that prior to this patch, in the case of simulating memstream
>   with a temp file, errors closing the tempfile caused an error message
>   and a nonzero return even though the history/bufferstack/parameter was
>   already correctly stored.  I have not made an effort to fix that.

Probably not a big issue.  An error closing the temp file suggests
something rather nasty is screwed up.

> - I note in passing that "print something >&-" is explicitly not an error,
>   but "print -u1 something >&-" IS an error.  Also unchanged here.

In the second case we've explicitly been told to "do something" with the
fd, which happens to be dup'ing and fdopen'ing it.  There's no such code
in the first place, and there doesn't seem any point in making the
second case silent.  I suppose we'd have to detect bad writes in lots of
places to pick up errors in the first case, but that would probably be
the right thing to do in principle.

pws


  reply	other threads:[~2016-01-05  9:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  7:18 Bart Schaefer
2016-01-05  9:48 ` Peter Stephenson [this message]
2016-01-05 11:47   ` Peter Stephenson
2016-01-05 16:33     ` Bart Schaefer
2016-01-05 16:31 ` Jun T.
2016-01-05 17:58   ` Bart Schaefer
2016-01-06  6:02     ` Jun T.
2016-01-06 21:30       ` Bart Schaefer
2016-01-08 12:32         ` Jun T.
2016-01-09  4:37           ` 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=20160105094821.307cca71@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).