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

Re: Bugfix: zsh crashes if invoked with unset PATH



I posted this a few days ago:
> 
> If PATH is not set in the environment, zsh dumps core the first time it
> attempts to execute an external command without an absolute path. That is
> because in init.c newcmdnamtable() is called before the path is initialised.
> 
> % unset PATH ; ./zsh -fc 'ls'            
> zsh: 5275 segmentation fault (core dumped)  ./zsh -fc 'ls'
> 
> Because of this bug one of my boot scripts faild (that's almost the only place
> where PATH is unset).
> 
> Here is the patch to fix that. It applies with fuzz 2 to the baseline zsh as I
> added /usr/local/bin to the default path in my release.

Unfortunately, I forgot to include the patch to fix that. It's funny that
noone complained.

Here it is now.

Bye,
  Zoltan

rcsdiff -qc -kk -r1.7 -r1.8 Src/init.c
*** Src/init.c
--- Src/init.c	1995/07/05 11:39:28
***************
*** 452,458 ****
  
      newreswdtable();    /* create hash table for reserved words */
      newaliastable();    /* create hash table for aliases        */
-     newcmdnamtable();   /* create hash table for commands       */
      newcompctltable();  /* create hash table for compctls       */
  
      initxbindtab();  /* initialize key bindings */
--- 452,457 ----
***************
*** 542,548 ****
      path[3] = ztrdup("/usr/local/bin");
      path[4] = NULL;
  
!     inittyptab();     /* initialize the ztypes table */
      initlextabs();
  
      /* We cache the uid so we know when to *
--- 541,548 ----
      path[3] = ztrdup("/usr/local/bin");
      path[4] = NULL;
  
!     newcmdnamtable();   /* create hash table for commands       */
!     inittyptab();       /* initialize the ztypes table          */
      initlextabs();
  
      /* We cache the uid so we know when to *



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