zsh-workers
 help / color / mirror / code / Atom feed
* possible to disable zsh compatibility mode?
@ 1998-08-11 21:47 Paul Lew
  1998-08-12  2:54 ` Bart Schaefer
  1998-08-12  8:53 ` Zefram
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Lew @ 1998-08-11 21:47 UTC (permalink / raw)
  To: zsh-workers

Is it possible to disable the sh/ksh compatibility mode in zsh?  My OS
(Digital UNIX) script program fork the shell as:

	 execl(shell, "sh", "-is", 0);

The shell came from environment variable SHELL, but the arg0 is 'sh'
which trigger compatibility mode.  When it entered the script zsh,
none of the rc files are read.  I have been manually run it so far.

I can either build my on script executable or modify zsh but I would
rather use a solution that will not require patch either program in
the future.  Any idea?  How about use another environment varaible?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: possible to disable zsh compatibility mode?
  1998-08-11 21:47 possible to disable zsh compatibility mode? Paul Lew
@ 1998-08-12  2:54 ` Bart Schaefer
  1998-08-12  8:53 ` Zefram
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 1998-08-12  2:54 UTC (permalink / raw)
  To: Paul Lew, zsh-workers

On Aug 11,  5:47pm, Paul Lew wrote:
} Subject: possible to disable zsh compatibility mode?
}
} Is it possible to disable the sh/ksh compatibility mode in zsh?

There's presently no way (without modifying the source yourself) to build
zsh with argv[0]-based emulation turned off.  Perhaps there should be?

} My OS (Digital UNIX) script program fork the shell as:
} 
} 	 execl(shell, "sh", "-is", 0);

Ick.  Your best bet is to use the ENV environment variable, e.g.

	ENV=$HOME/.zshzsh script zsh

Where the file ~/.zshzsh contains

	emulate -R zsh
	function source_etc {
	  [[ -r /etc/$1 ]] && source /etc/$1
	  unsetopt localoptions
	}
	function sourcehome {
	  [[ -r ${ZDOTDIR:-$HOME}/$1 ]] && source ${ZDOTDIR:-$HOME}/$1
	  unsetopt localoptions
	}
	source_etc zshenv
	[[ -o rcs ]] && {
	  sourcehome .zshenv
	  [[ -o login ]] && {
	    source_etc zprofile
	    sourcehome .zprofile
	  }
	  [[ -o interact ]] && {
	    source_etc zshrc
	    sourcehome .zshrc
	  }
	  [[ -o login ]] && {
	    source_etc zlogin
	    sourcehome .zlogin
	  }
	}
	unfunction source_etc sourcehome

Zsh sources the file named by $ENV when emulating sh or ksh, and the above
commands are equivalent to what zsh executes internally when not emulating.

The remaining problem is that zsh still interprets its command-line flags in
emulation mode, but there's nothing that can be done about that.  The only
differences are in pretty obscure usages anyway.  Oh, and you can't stop it
from sourcing /etc/profile, which could alter ENV and thereby mess you up,
but it doesn't sound like you're having problems with that.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: possible to disable zsh compatibility mode?
  1998-08-11 21:47 possible to disable zsh compatibility mode? Paul Lew
  1998-08-12  2:54 ` Bart Schaefer
@ 1998-08-12  8:53 ` Zefram
  1998-08-12 11:50   ` Paul Lew
  1 sibling, 1 reply; 4+ messages in thread
From: Zefram @ 1998-08-12  8:53 UTC (permalink / raw)
  To: Paul Lew; +Cc: zsh-workers

Paul Lew wrote:
>	 execl(shell, "sh", "-is", 0);

That's broken.  I suggest you fix it.  Alternatively, set your SHELL to
be the executable of this program:

	extern char **environ;
	int main(int argc, char **argv)
	{
	    if(argc != 0)
		argv[0] = "zsh";
	    execve("/usr/local/bin/zsh", argv, environ);
	    _exit(1);
	}

-zefram


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: possible to disable zsh compatibility mode?
  1998-08-12  8:53 ` Zefram
@ 1998-08-12 11:50   ` Paul Lew
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Lew @ 1998-08-12 11:50 UTC (permalink / raw)
  To: Zefram; +Cc: Paul Lew, zsh-workers

>>>>> "Zefram" == Zefram  <zefram@tao.co.uk> writes:

    Zefram> Paul Lew wrote:
    >> execl(shell, "sh", "-is", 0);

    Zefram> That's broken.  I suggest you fix it.  Alternatively, set
    Zefram> your SHELL to be the executable of this program:

    Zefram> [program segment deleted]

I know it is broken, the problem is this is system supplied command.
I can build my private copy, but lots of machine in our lab got reload
from the CD all the time and I will end up using their official
version.  I can file a bug report but this will take at least 6 months
because the release schedule.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-08-12 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-11 21:47 possible to disable zsh compatibility mode? Paul Lew
1998-08-12  2:54 ` Bart Schaefer
1998-08-12  8:53 ` Zefram
1998-08-12 11:50   ` Paul Lew

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).