zsh-workers
 help / color / mirror / code / Atom feed
* zsh for root
@ 1999-10-22  7:58 Tatsuo Furukawa
  1999-10-22  9:09 ` Zefram
  0 siblings, 1 reply; 3+ messages in thread
From: Tatsuo Furukawa @ 1999-10-22  7:58 UTC (permalink / raw)
  To: zsh-workers


Hello, zsh developers.

I am using HP-UX 10.20.  I want to make "zsh for root".  To do this, I
must make zsh with static link.  But HP-UX's setlocale() depends
/usr/lib/libdld.sl, so I can't.

I think that if zsh doesn't use setlocale(), I can build static linked
zsh.  To do this, I added following to zsh.h:

--- zsh.h.orig  Fri Oct 22 16:36:11 1999
+++ zsh.h       Fri Oct 22 16:36:14 1999
@@ -1414,6 +1414,8 @@
 /* Shared header files */
 /***********************/
 
+#undef LC_ALL
+
 #include "version.h"
 #include "signals.h"
 #include "globals.h"

Finally, I got static linked zsh.

Then, I have a question.  Is my local change is OK?  I am Japanese, so
I set LC_* to ja_JP.SJIS.  But as root, I think that root does'nt have
to set locale.  So, I think this does't cause any problem.

But I know that changing root's shell may cause serious problem.  So I
want to know more information.

-- 
---------------------------------------------------------------
[(hp)]  KID R/D  Engeneering Productivity
        Tatsuo Furukawa ( Dragon )    tatsuo@kobe.hp.com


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

* Re: zsh for root
  1999-10-22  7:58 zsh for root Tatsuo Furukawa
@ 1999-10-22  9:09 ` Zefram
  1999-10-22 12:49   ` Tatsuo Furukawa
  0 siblings, 1 reply; 3+ messages in thread
From: Zefram @ 1999-10-22  9:09 UTC (permalink / raw)
  To: Tatsuo Furukawa; +Cc: zsh-workers

Tatsuo Furukawa wrote:
>I am using HP-UX 10.20.  I want to make "zsh for root".  To do this, I
>must make zsh with static link.  But HP-UX's setlocale() depends
>/usr/lib/libdld.sl, so I can't.

This calls for a configure test.  Actually, two.

If setlocale() is actually unavailable when linking statically, that needs
to be detected by configure, and disable the locale stuff.  If it's just a
case of setlocale() doing stuff that you don't want a root zsh doing, that
needs to be manually configurable.  This patch does both of these things.

-zefram

diff -cr ../zsh-3.1.6-bart-7.old/Src/main.c ./Src/main.c
*** ../zsh-3.1.6-bart-7.old/Src/main.c	Fri Oct 22 09:22:03 1999
--- ./Src/main.c	Fri Oct 22 09:44:59 1999
***************
*** 35,41 ****
  main(int argc, char **argv)
  {
      char **t;
! #ifdef LC_ALL
      setlocale(LC_ALL, "");
  #endif
  
--- 35,41 ----
  main(int argc, char **argv)
  {
      char **t;
! #ifdef USE_LOCALE
      setlocale(LC_ALL, "");
  #endif
  
diff -cr ../zsh-3.1.6-bart-7.old/Src/params.c ./Src/params.c
*** ../zsh-3.1.6-bart-7.old/Src/params.c	Fri Oct 22 09:22:03 1999
--- ./Src/params.c	Fri Oct 22 09:45:40 1999
***************
*** 146,152 ****
  IPDEF2("IFS", ifsgetfn, ifssetfn, PM_DONTIMPORT),
  IPDEF2("_", underscoregetfn, nullsetfn, PM_READONLY),
  
! #ifdef LC_ALL
  # define LCIPDEF(name) IPDEF2(name, strgetfn, lcsetfn, PM_UNSET)
  IPDEF2("LANG", strgetfn, langsetfn, PM_UNSET),
  IPDEF2("LC_ALL", strgetfn, lc_allsetfn, PM_UNSET),
--- 146,152 ----
  IPDEF2("IFS", ifsgetfn, ifssetfn, PM_DONTIMPORT),
  IPDEF2("_", underscoregetfn, nullsetfn, PM_READONLY),
  
! #ifdef USE_LOCALE
  # define LCIPDEF(name) IPDEF2(name, strgetfn, lcsetfn, PM_UNSET)
  IPDEF2("LANG", strgetfn, langsetfn, PM_UNSET),
  IPDEF2("LC_ALL", strgetfn, lc_allsetfn, PM_UNSET),
***************
*** 162,168 ****
  # ifdef LC_TIME
  LCIPDEF("LC_TIME"),
  # endif
! #endif
  
  #define IPDEF4(A,B) {NULL,A,PM_INTEGER|PM_READONLY|PM_SPECIAL,BR((void *)B),SFN(nullsetfn),GFN(intvargetfn),stdunsetfn,10,NULL,NULL,NULL,0}
  IPDEF4("!", &lastpid),
--- 162,168 ----
  # ifdef LC_TIME
  LCIPDEF("LC_TIME"),
  # endif
! #endif /* USE_LOCALE */
  
  #define IPDEF4(A,B) {NULL,A,PM_INTEGER|PM_READONLY|PM_SPECIAL,BR((void *)B),SFN(nullsetfn),GFN(intvargetfn),stdunsetfn,10,NULL,NULL,NULL,0}
  IPDEF4("!", &lastpid),
***************
*** 2444,2450 ****
  
  /* Functions to set value of special parameters `LANG' and `LC_*' */
  
! #ifdef LC_ALL
  static struct localename {
      char *name;
      int category;
--- 2444,2450 ----
  
  /* Functions to set value of special parameters `LANG' and `LC_*' */
  
! #ifdef USE_LOCALE
  static struct localename {
      char *name;
      int category;
***************
*** 2511,2517 ****
  	if (!strcmp(ln->name, pm->nam))
  	    setlocale(ln->category, x ? x : "");
  }
! #endif
  
  /* Function to get value for special parameter `HISTSIZE' */
  
--- 2511,2517 ----
  	if (!strcmp(ln->name, pm->nam))
  	    setlocale(ln->category, x ? x : "");
  }
! #endif /* USE_LOCALE */
  
  /* Function to get value for special parameter `HISTSIZE' */
  
diff -cr ../zsh-3.1.6-bart-7.old/Src/system.h ./Src/system.h
*** ../zsh-3.1.6-bart-7.old/Src/system.h	Fri Oct 22 09:22:03 1999
--- ./Src/system.h	Fri Oct 22 09:44:42 1999
***************
*** 632,634 ****
--- 632,640 ----
  #undef ESRCH
  #define ESRCH EINVAL
  #endif /* BROKEN_KILL_ESRCH */
+ 
+ /* Can we do locale stuff? */
+ #undef USE_LOCALE
+ #if defined(CONFIG_LOCALE) && defined(HAVE_SETLOCALE) && defined(LC_ALL)
+ # define USE_LOCALE 1
+ #endif /* CONFIG_LOCALE && HAVE_SETLOCALE && LC_ALL */
diff -cr ../zsh-3.1.6-bart-7.old/acconfig.h ./acconfig.h
*** ../zsh-3.1.6-bart-7.old/acconfig.h	Fri Oct 22 09:21:58 1999
--- ./acconfig.h	Fri Oct 22 09:38:37 1999
***************
*** 163,168 ****
--- 163,171 ----
   * By default this is defined.                               */
  #undef RESTRICTED_R
  
+ /* Define if you want locale features.  By default this is defined. */
+ #undef CONFIG_LOCALE
+ 
  /* Define to 1 if your termcap library has the ospeed variable */
  #undef HAVE_OSPEED
  /* Define to 1 if you have ospeed, but it is not defined in termcap.h */
diff -cr ../zsh-3.1.6-bart-7.old/configure.in ./configure.in
*** ../zsh-3.1.6-bart-7.old/configure.in	Fri Oct 22 09:21:58 1999
--- ./configure.in	Fri Oct 22 09:40:23 1999
***************
*** 201,206 ****
--- 201,215 ----
  AC_DEFINE(RESTRICTED_R)
  )
  
+ dnl Do you want to disable use of locale functions
+ AC_ARG_ENABLE([locale],
+ [  --disable-locale           turn off locale features],
+ [if test x$enableval = xyes; then
+   AC_DEFINE(CONFIG_LOCALE)
+ fi],
+ AC_DEFINE(CONFIG_LOCALE)
+ )
+ 
  undefine([fndir])dnl
  AC_ARG_ENABLE(fndir,
  [  --enable-fndir=DIR        where functions go (default DATADIR/zsh/functions)],
***************
*** 766,772 ****
                sigprocmask setuid seteuid setreuid setresuid setsid strerror \
                nis_list initgroups fchdir cap_get_proc readlink nice \
  	      getgrgid getgrnam getpwent getpwnam getpwuid setpgrp \
! 	      fseeko ftello mmap munmap msync ftruncate)
  
  dnl ---------------
  dnl CHECK FUNCTIONS
--- 775,781 ----
                sigprocmask setuid seteuid setreuid setresuid setsid strerror \
                nis_list initgroups fchdir cap_get_proc readlink nice \
  	      getgrgid getgrnam getpwent getpwnam getpwuid setpgrp \
! 	      fseeko ftello mmap munmap msync ftruncate setlocale)
  
  dnl ---------------
  dnl CHECK FUNCTIONS
*** ../zsh-3.1.6-bart-7.old/INSTALL	Fri Oct 22 09:21:58 1999
--- ./INSTALL	Fri Oct 22 10:06:34 1999
***************
*** 358,360 ****
--- 358,361 ----
       function-subdirs    # if functions will be installed into subdirectories
       dynamic             # allow dynamically loaded binary modules
       lfs                 # allow configure check for large files
+      locale              # allow use of locale library
END


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

* Re: zsh for root
  1999-10-22  9:09 ` Zefram
@ 1999-10-22 12:49   ` Tatsuo Furukawa
  0 siblings, 0 replies; 3+ messages in thread
From: Tatsuo Furukawa @ 1999-10-22 12:49 UTC (permalink / raw)
  To: zefram, zsh-workers


Hi, Zefram.

Zefram> This calls for a configure test.  Actually, two.
    (snip)
Zefram> This patch does both of these things.

I applied this patch and it works well.  Thank you.

I am using zsh 3.0.7.  I applied this patch, and it also works well.

I hope that this feature will be included next release (both 3.1.X and
3.0.X)!!

-- 
---------------------------------------------------------------
[(hp)]  KID R/D  Engeneering Productivity
        Tatsuo Furukawa ( Dragon )    tatsuo@kobe.hp.com


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

end of thread, other threads:[~1999-10-22 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-22  7:58 zsh for root Tatsuo Furukawa
1999-10-22  9:09 ` Zefram
1999-10-22 12:49   ` Tatsuo Furukawa

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