home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / programm / 5330 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  2.3 KB

  1. Xref: sparky comp.unix.programmer:5330 comp.sys.sun.misc:5312
  2. Path: sparky!uunet!ogicse!henson!n8743196
  3. From: n8743196@henson.cc.wwu.edu (Jeff Wandling)
  4. Newsgroups: comp.unix.programmer,comp.sys.sun.misc
  5. Subject: Re: Installing a shared library without screwing up.
  6. Keywords: libc.so replacing
  7. Message-ID: <1992Nov18.095017.14952@henson.cc.wwu.edu>
  8. Date: 18 Nov 92 09:50:17 GMT
  9. Article-I.D.: henson.1992Nov18.095017.14952
  10. References: <mark.722062866@coombs>
  11. Organization: Howling Dog
  12. Lines: 49
  13.  
  14. mark@coombs.anu.edu.au (Mark) writes:
  15.  
  16. >On SunOS 4.x.x:
  17. >I've heard a lot of horror stories about mistakes with libc.so replacing and
  18. >how dynamic library loading programs die real quick if you tamper with their
  19. >library.
  20.  
  21. >What is the right/best way to replace a libc.so with your site customised
  22. >version? I dont want to have to go find the installation tape everytime
  23. >I attempt it. Do I use 'cp' or 'cat mylib > /usr/lib/libc.so' or what? Im a
  24. >bit worried that a context switch will happen halfway through it and bugger
  25. >it all up.
  26.  
  27. >How would you guys replace it?
  28.  
  29. One way to test it without mucking up your system is to set the 
  30. environment variable LD_LIBRARY_PATH to the directory where your
  31. newly created libc.so lives.. Like:
  32.  
  33. example--
  34.  
  35. % cd /usr/lib/shlib.etc
  36. % setenv LD_LIBRARY_PATH `pwd`
  37.  
  38. Then you can run programs that will exercise the lib you've created.
  39.  
  40. If you find a problem with your lib, and are able to
  41.  
  42. % unsetenv LD_LIBRARY_PATH
  43.  
  44. you'll be using the default libs and running with a clean lib once again.
  45.  
  46. Once you are certain that aspects of your site-custom lib are ok, then you
  47. (as root) could cp it to /usr/lib, give it 755 perms and run ldconfig.
  48.  
  49. By using the environment variable, you can at least test your lib without
  50. worrying about trashing other users's processes. 
  51.  
  52. I don't recommend doing this at times where a "crash" would be a *bad
  53. thing*.  Also, keep track of the names of libc.so's in /usr/lib.  Once
  54. I had a bad lib and had to remove it in single user mode.  Leave the old
  55. libs alone. 
  56.  
  57. (See Also trace(1) and ldconfig(1))
  58.  
  59. -- 
  60. perl -e '$a="Japhuneasorcttlk h eae r r ,";$]=0;$s=$];while($s<4){do{$_ .= pack
  61. ("c",vec($a,$],8));$]+=4;}while($]<length($a)&&vec($a,$],8)!=32);$s++;$]=$s;$_
  62. .= ' ';}chop;print;' Jeff Wandling  <jdw@physics.wwu.edu>  "will hack for food"
  63.