zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: [for consideration] TMPSUFFIX
Date: Tue, 27 Sep 2016 12:20:50 -0700	[thread overview]
Message-ID: <160927122050.ZM13394@torch.brasslantern.com> (raw)
In-Reply-To: <20160927070039.GA20798@fujitsu.shahaf.local2>

On Sep 27,  7:00am, Daniel Shahaf wrote:
}
} > won't assert the attack is 100% impossible, but there's nothing more
} > we can do about that than we already have.
} 
} Yes, there is: we should stop calling addfilelist(nam) if open(nam)
} returns negative.

That's not the "that" I was talking about.

} (Sidebar: that mktemp() call is the only warning in my build; it'd be
} nice to get rid of it while we're here.)

zsh-workers had this conversation years ago and landed where we are now
(except I don't think this bit about =() returning the name even if it
wasn't opened was noticed/considered).

} > It'd have to be an error on the same order as "bad substitution" so the
} > whole command context fails.  Hence bringing it up for discussion.
} 
} I don't know what's best here.
} 
} Using ERRFLAG_ERROR risks aborting too much code (39154 being a recent
} example).

I'm not sure that's really a valid example for this case -- the trouble
there was not that too much code was aborted, rather that because of a
surrounding use of "eval" not *enough* code was aborted; a scripting
error.

} A middle way would be to force the simple command that =(:) was part to
} return 127.

If we were to parallel other redirection errors, the command should
just return 1.  Otherwise I'd say we should report the actual error
number instead of always 127.  However, I don't see any obvious way
to do either of those things from inside stringsubst().

The code in stringsubst() expects getoutputfile() to return NULL and
then substitutes nothing as the replacement, which could change the
number of arguments in the command -- so that isn't ideal either.

We could just call zwarn() [instead of zerr()] and return "/dev/null"
to supply an empty file as if the command inside the =() had failed,
but I'm more inclined to just call zerr() and allow things to abort.

This obviously isn't a very common occurrence or we'd have seen it come
up before; this is hardly an obscure or little-used feature.


  reply	other threads:[~2016-09-27 19:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-25 22:51 Bart Schaefer
2016-09-26  7:25 ` Daniel Shahaf
2016-09-26 16:19   ` Bart Schaefer
2016-09-27  7:00     ` Daniel Shahaf
2016-09-27 19:20       ` Bart Schaefer [this message]
2016-09-28 10:24         ` Daniel Shahaf
2016-09-28 18:49           ` _dispatch (was Re: PATCH: [for consideration] TMPSUFFIX) Bart Schaefer
2016-09-29  6:39             ` Daniel Shahaf
2016-09-29  7:30               ` Bart Schaefer
2016-09-30  7:03                 ` Daniel Shahaf
2016-09-30 21:53                   ` Bart Schaefer
2016-09-28  6:09 ` PATCH: [for consideration] TMPSUFFIX Sebastian Gniazdowski

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=160927122050.ZM13394@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).