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

Re: Bug with bash emulation regarding ':'



On 29 January 2012 21:30, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sun, 29 Jan 2012 20:01:13 +0100
> Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>> On 2012-01-29 19:53:51 +0100, Mikael Magnusson wrote:
>> > On 29 January 2012 19:38, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>> > > On 2012-01-29 15:25:13 +0100, Mikael Magnusson wrote:
>> > >> On 29 January 2012 14:44, Felipe Contreras <felipe.contreras@xxxxxxxxx> wrote:
>> > >> > emulate bash
>> > >>
>> > >> There's no such emulation mode.
>> > >
>> > > I think the problem is that "emulate" doesn't return an error
>> > > if the argument is unsupported.
>> >
>> > Well, there are no unsupported arguments, anything that isn't
>> > recognized is documented (although not accurately) to enter zsh mode
>> > :).
>>
>> Yes, but this is not intuitive. An error would be better, IMHO.
>
> emulate "bash" is treated as emulate "sh", but isn't so documented.
>
> However, having any random emulation treated as zsh in the emulate
> command seems a bit pointless.  I think it only does that because the
> code is shared with what happens at shell start-up.
>
> How about the following compromise?
>
> - Behave the same at start-up as always.  There's no point in an
> error here if we don't recognise what zsh is supposed to be emulating.
>
> - In the emulate command, keep the behaviour that we only test the
> initial letter (and that "b" is like "s"), but document it.
>
> - However, if the initial letter isn't recognised within the emulate
> command (i.e. we now require a 'z' for native mode), complain.
>
> This will annoy anyone who deliberately used "emulate native" to enter
> zsh mode (for which I have only limited sympathy), but unless I've
> missed something it should keep everyone else happy; indeed, the emulate
> command only lists the explicit possibilities "zsh", "sh", "ksh", "csh",
> but we did document that zsh was used as a default.  Usually Bart spots
> something I've missed at this point, however.

I noticed that the 'Compatibility' section referred to only talks
about ksh and sh emulation, not csh, and it doesn't mention emulating
sh when the first letter is b either.

-- 
Mikael Magnusson



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