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

Re: PATCH: [for consideration] TMPSUFFIX



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.



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