home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / Newsletters / GEnieUnixNews / unxnl-06.93 < prev    next >
Text File  |  1993-07-08  |  33KB  |  788 lines

  1.  
  2.           _  _  _   _  _   _
  3.          // // //| // // \//     N E W S
  4.         //_// // |// //  /\\     Vol 4, Issue 6 - June 1993
  5.       R o u n d T a b l e (tm)
  6.  
  7.    Items of interest to participants of the GEnie Unix RoundTable
  8.  
  9.  INDEX TO VOLUME 4, ISSUE 6:
  10.  ===========================
  11.  
  12.  ED: editor notes - (GARS) Gary Smith
  13.  --
  14.   - Unix Basics Tutorial RTC's resume
  15.   - 7000 files and counting
  16.   - Library Survey
  17.  NeXT Column (ERICTREMBLAY)  Eric "E.T." Tremblay
  18.  -----------
  19.   - Improv - Improving the Spreadsheet
  20.  Lock and Key Unix Security (SARAH)  Sarah Collier
  21.  ------------
  22.   - 1st Cut of Unix Security Lore
  23.  Foo.Bar!  Unix Humor:
  24.  --------
  25.   - Selecting a Programming Language Made Easy  (ANDY)  Andy Finkenstadt
  26.  Down and Dirty: Quick Scripts that do something useful  (GARS)  Gary Smith
  27.  --------------
  28.   - RNELM - Reply to news articles with ELM
  29.   - How to export variables from Child to parent
  30.  usr/local: Items (scripts and news) snarfed from various sources
  31.  ---------
  32.   - shell programming report (new version)  (GARS)  Gary Smith
  33.   -
  34.  TUTORIALS
  35.  ---------
  36.   - Reclaiming Lost Data  (MIKE.NOLAN)  Mike Nolan
  37.   - Rookie Review (JANS)  Janet McNeely
  38.     _
  39.  
  40.  eot ------
  41.  
  42.                 The RoundTable Staff is:
  43.       ANDY          Andy Finkenstadt  Chief SysOp
  44.       MIKE.NOLAN    Michael Nolan     Assistant SysOp
  45.       SARAH         Sarah Collier     Administrative Assistant
  46.       GARS          Gary Smith        Library Manager
  47.       MIKE.MC       Mike McCabe       Linux & 386BSD Support SysOp
  48.       JANS          Janet McNeely     Bulletin Board Manager
  49.       LRARK         Ricky Mobley      Network Comm Liaison
  50.       ERICTREMBLAY  Eric Tremblay     NeXT Support SysOp
  51.       DELPHI        Brian T. Riley    RTC Conference Manager
  52.       UNIX$         The Whole Crew
  53.  
  54.  
  55.  We strongly encourage you to contact any or all of us if you have -ANY-
  56.  comments or suggestions. This is -YOUR- RoundTable. We are here to make
  57.  your participation as pleasant and beneficial as possible.
  58.  
  59.  LIVE Help Desks (type  MOVE 400;4 and choose channel #4):
  60.  
  61.  LIVE in-person Conferences (select #2 on the menu):
  62.  
  63.  ED: editor notes - (GARS) Gary Smith
  64.  ==
  65.  
  66.     After a brief suspension, due to RTC SysOp Mike McCabe's business trip
  67.  to Japan, the Unix basics tutorial RTC's (Real Time Conferences) have
  68.  resumed on Sunday nights at 9pm Eastern.  If you have a need to learn
  69.  Unix commands this is your opportunity to get guru level hand-holding.
  70.  Gars recommends these with a BIG check mark for quality.
  71.  
  72.     We have achieved a bit of a landmark in the Unix Software Libraries. We
  73.  passed the 7000 "files posted" mark and are on a fast track to 7500. If
  74.  you haven't checked the files out lately, you are probably missing one or
  75.  two your system could benefit from.  If there's one you want, we have
  76.  somehow failed to post, drop us an e-mail. We'll be glad to do an archie
  77.  search and FTP it in here for you.
  78.  
  79.     I have posted the following note in the New Files area of the Bulletin
  80.  Board:
  81.  
  82.      Please take a moment to copy and respond to the following survey.
  83.      Your opinion is important. We are going to base our decision 100%
  84.      on user response.
  85.      At issue is the posting of new library uploads to the Bulletin
  86.      Board. This is one of the very few RoundTables that does so.
  87.      When we first began this practice it made some sense to make
  88.      all users aware of new files. With the rate of new file additions,
  89.      the ability of scripting programs to automatically capture such
  90.      lists, and the time it takes to filter through this information
  91.      if it is not of value make the continuance of the practice highly
  92.      questionable.
  93.       ------------------- clip here ----------------------
  94.      Do you wish to have the New Library Uploads Posted to the
  95.      Bulletin Board as is now the practice?   [Y/N]
  96.      Would you prefer No Listing, a Short Listing or a Long
  97.      Description?                             [N/S/L]
  98.      Mail your response to GARS.
  99.      The vote will only be tabulated by mail and only through
  100.      21 June 1993. At that time YOU will have made our decision.
  101.      Thank you for your interest and participation.
  102.  
  103.    If you managed to overlook the above, please clip and respond to it
  104.  as soon as possible.  Your opinion is important!
  105.  
  106.   Gary  gars@genie.geis.com
  107.         gars%glsdk@wolves.durham.nc.us
  108.  
  109.  eot ------
  110.  
  111.  NeXT Column  (ERICTREMBLAY)  Eric "E.T." Tremblay
  112.  ===========
  113.                      Improving the Spreadsheet
  114.                           April 9, 1993
  115.                       By Eric "E.T." Tremblay
  116.  
  117.      It all started in 1986 in the mind of a bright developer at
  118.  Lotus called Pito Salas. He's the one who came up with the basic
  119.  idea for Improv.Unfortunately the project was stalled for almost
  120.  a year until Lotus hired a hot programmer named Glenn Edelson,
  121.  whose job was to implement Salas's ideas. Improv was supposed to
  122.  be introduced to the world under the OS/2 and Microsoft's
  123.  Presentation Manager operating systems, but on October 1988 Steve
  124.  Jobs visited Lotus and changed the future.
  125.  
  126.      Steve Jobs came to Lotus to show off his new computer. After
  127.  a private meeting, the top management at Lotus decided to show
  128.  off its newest products under development. While seeing a demo of
  129.  Improv, Steve Jobs was getting more and more excited. Improv fit
  130.  right in with the vision he had of his new computer. A product
  131.  that was totally new and bold. Something that no one had seen
  132.  before on any computer. A software the would reflect his vision
  133.  of computing.
  134.  
  135.      Why did Lotus change their idea to developing Improv on the
  136.  NeXT instead of on the PC? Well, there are a couple of very good
  137.  reason for the switch.  The developers at Lotus were trying to
  138.  build a totally new spreadsheet application on top of a buggy
  139.  initial release of OS/2 and Presentation Manager, and having a
  140.  difficult time because of the instability of the operating
  141.  system. Plus, ever since the developers had seen the demo of the
  142.  NeXT, the black machine was constantly coming back in their
  143.  minds. They wanted to experiment with what the NeXT had to offer
  144.  and with the level of problems they were having with the PC
  145.  environment, the team finally decided to switch to the NeXT.
  146.  Another key factor for the move to the NeXTSTEP environment was
  147.  the lack of 1-2-3 spreadsheet available for the NeXT. Because
  148.  Improv was the only spreadsheet available at the time for the
  149.  NeXT, it would not interfere and be in conflict with 1-2-3 on the
  150.  PC platform and Lotus would not have to explain the differences
  151.  to it's customers. So they could take a chance with a new product
  152.  and not run the risk of hurting the PC sales of 1-2-3. Everyone
  153.  was a winner. Steve Jobs had a new generation of spreadsheets on
  154.  his new computer and Lotus had the opportunity to introduce a new
  155.  kind of spreadsheet without taking any risks.
  156.  
  157.      Improv is now available to the PC world under the Windows
  158.  platform, Lotus is currently selling Improv for Windows at a very
  159.  low introductory price. At this price it is a very good deal
  160.  believe me. Please be warned that Improv is a totally new way of
  161.  looking at spreadsheets and that the current spreadsheet experts
  162.  are going to look like beginners when faced with Improv.
  163.  
  164.      The best way to approach Improv is to forget everything you
  165.  know about spreadsheets and start over from scratch. Open the
  166.  documentation and do the exercises a couple of times. The best
  167.  way to learn Improv is to use it. I have been using Improv for
  168.  over a year now and I'm learning something new every week.
  169.  
  170.     I keep all my personal financial information in Improv and I
  171.  have over two years of daily financial reports for the family
  172.  business. A good way to start is to redo an old spreadsheet in
  173.  Improv. Please note that it is important to redo a spreadsheet
  174.  the Improv way and not simply import an old 1-2-3 spreadsheet and
  175.  fix it up after. A spreadsheet that is done from scratch will
  176.  really give you the Improv advantage.  Imported 1-2-3
  177.  spreadsheets work well, but when you import a 1-2-3 spreadsheet
  178.  you cannot take full advantage of all the features of direct
  179.  manipulation that Improv offers.
  180.  
  181.      Should you get Improv? Well that's up to you but would I
  182.  change my Improv for a 1-2-3? No, way! The transition is
  183.  difficult but when you are finally over the shock, the change is
  184.  for the better.  When you know how Improv works, you will look at
  185.  1-2-3 in a completely different way and only then will you
  186.  realize the power of Improv.
  187.  
  188.     If you wish to discuss Improv for the NeXT, come and visit
  189.  us in the Unix RT bulletin board category 16.  If you have Improv
  190.  for Windows, you can also discuss this in the Windows RT bulletin
  191.  board category 14 topic 7. There you will find many users of
  192.  Improv including myself that have the experience and knowledge to
  193.  help and guide you with Improv. Hope to see you there...
  194.  
  195.  eot ------
  196.  
  197.  Lock and Key  Unix Security:  (SARAH)  Sarah Collier
  198.  ============
  199.  
  200.  Questions on Unix Security
  201.    -- from the Security Digest, Volume 1, Number 063
  202.  
  203.  From:    bgt@cbnewsh.cb.att.com (barbara.tongue)
  204.  Subject: 1st Cut List of Unix Security Lore
  205.  Date:    Tue, 27 Apr 1993 17:26:06 GMT
  206.  
  207.  folks,
  208.  
  209.  if someone were to come to you and ask, what are the most crucial
  210.  aspects of unix networked security to know, what would you answer
  211.  and in what list of priority?  here's my cut:
  212.  
  213.  1.) secure from outside machines
  214.          a) ftp
  215.          b) telnet
  216.          c) nfs
  217.  
  218.  2.) secure from software holes
  219.          a) sendmail
  220.          b) setuid scripts
  221.  
  222.  3.) secure from users
  223.          a) educated
  224.          b) unknowing
  225.  
  226.  4.) ???
  227.  
  228.  i'm a tad new at this game, and decided that the best way
  229.  to start was to ask those in the know.
  230.  
  231.  thanx in advance,
  232.  
  233.  
  234.  --
  235.  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  236.  %%  The Speaking Tongue, AT&T  %%  C Code.  C Code Run.  Run, Code, RUN! %%
  237.  %%      bgt@hogpf.att.com      %%           PLEASE!!!!                   %%
  238.  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  239.  
  240.  ------------------------------
  241.  
  242.  From:    mjr@tis.com (Marcus J Ranum)
  243.  Subject: Re: 1st Cut List of Unix Security Lore
  244.  Date:    27 Apr 1993 21:54:20 GMT
  245.  
  246.  bgt@cbnewsh.cb.att.com (barbara.tongue) writes:
  247.  >if someone were to come to you and ask, what are the most crucial
  248.  >aspects of unix networked security to know, what would you answer
  249.  >and in what list of priority?
  250.  
  251.          I'd start off by looking at it at a higher level. First I'd
  252.  ask myself what the possible points of attack are. Then I'd ask myself
  253.  what security I have in place to protect each possible point of attack.
  254.  In some cases, it may be OK to have no security for a given service,
  255.  but you want to note that down as a form of security. ;)
  256.  
  257.          For example, if you do a 'netstat -a' on any system that might
  258.  come under attack via the network, you'll get a listing of all the
  259.  services you need to worry about. If you're running lots of SunRPC
  260.  services, you'll notice a lot of upd services, and it's hard to tell
  261.  what is what. That, in and of itself is a clue.
  262.  
  263.          Anyhow, so you get a list of services that you present to the
  264.  world, and then check them off one by one. Another fairly important
  265.  consideration for each service is who/what it runs as and whether
  266.  it's privileged already. For example: sendmail. I'd put a big purple
  267.  star opposite sendmail as a potential problem. ;)
  268.  
  269.  > here's my cut:
  270.  >
  271.  >1.) secure from outside machines
  272.  >       a) ftp
  273.  >       b) telnet
  274.  >       c) nfs
  275.  
  276.          mountd
  277.          NIS/yellow pages
  278.          rwalld (some versions of rwalld permit escape codes)
  279.          etc,
  280.          etc
  281.  
  282.          There's a long list. I have a (well deserved) reputation on the
  283.  net for being a paranoid. I believe that, depending on the level of
  284.  security you require, it's sometimes best to shut all network services
  285.  down and turn them on one by one, rather than the other way around.
  286.  
  287.          What kind of system you're going to run is a real important
  288.  question:
  289.          ** Is this for a firewall/gateway system, or is this for a
  290.          general use system?
  291.          ** Will it be exposed to external attack or only to internal attack?
  292.          ** How important is the data on it? How much will it cost if it is
  293.          destroyed, stolen, or modified?
  294.  
  295.          If the system is a general use system without very important data
  296.  on it, and it's on a private LAN, obviously your security concerns are
  297.  less than if it's a firewall system protecting a network with corporate
  298.  sensitive data from the Internet.
  299.  
  300.          Security, outside of the context of the level of threat you need
  301.  to deal with, and the level of risk you need to protect against, is
  302.  meaningless.
  303.  
  304.  >2.) secure from software holes
  305.  >       a) sendmail
  306.  >       b) setuid scripts
  307.  
  308.          Another approach is to try to identify the types of threats that
  309.  software holes pose, and then address those globally through policy. For
  310.  example, setuid shell scripts come into existence because they are easy
  311.  to write(apparently) and use. Approach a general solution by providing
  312.  a mechanism that is secure, and solves the problem, instead of fixing
  313.  holes. Sendmail has a bad rap because of the Morris worm. Part of the
  314.  problem, though, is that it's a big, complex program that runs with
  315.  privs. Depending on your mail requirements, maybe some kind of mailer
  316.  that doesn't require privs would work. I believe MMDF solves a number
  317.  of the security problems of sendmail, while retaining the bigness and
  318.  complexity.  ;)
  319.  
  320.  >3.) secure from users
  321.  >       a) educated
  322.  >       b) unknowing
  323.  
  324.          First formulate a statement of what your users should and should
  325.  not be able to do. Users always pose a threat. If that's OK, then figure
  326.  out what what the limits of the threat they should be able to pose is, and
  327.  figure out how to give them an environment that enforces that limit. This
  328.  is not an easy problem.
  329.  
  330.  >4.) ???
  331.  
  332.          IMHO, making a list isn't the best way to start. Figure out what
  333.  risks you're afraid of, and what the ground rules are. Figure out what you
  334.  need to protect against and what services you need to provide. The latter
  335.  two will be in conflict, so you have to decide which side of the spectrum
  336.  your policy favors. Only then do you have to start listing stuff, and
  337.  I'd approach that by splitting my paper down the middle and listing
  338.  user requirements on one side and security requirements on the other. Then
  339.  you're into slogging through the mud.
  340.  
  341.  mjr.
  342.  
  343.  ------------------------------
  344.  
  345.  eot ------
  346.  
  347.  Foo.Bar!  Unix Humor:
  348.  ========
  349.  
  350.  Item forwarded  by  ANDY         to GARS
  351.  Sub: Programming
  352.  
  353.                Selecting a Programming Language Made Easy
  354.                    Daniel Solomon & David Rosenblueth
  355.          Department of Computer Science, University of Waterloo
  356.                    Waterloo, Ontario, Canada N2L 3G1
  357.  
  358.     With such a large selection of programming languages it can be
  359.  difficult to choose one for a particular project. Reading the manuals to
  360.  evaluate the languages is a time consuming process. On the other hand,
  361.  most people already have a fairly good idea of how various automobiles
  362.  compare. So in order to assist those trying to choose a language, we
  363.  have prepared a chart that matches programming languages with comparable
  364.  automobiles.
  365.  
  366.  Assembler     - A Formula I race car. Very fast, but difficult to drive and
  367.                  expensive to maintain.
  368.  FORTRAN II    - A Model T Ford. Once it was king of the road.
  369.  FORTRAN IV    - A Model A Ford.
  370.  FORTRAN 77    - A six-cylinder Ford Fairlane with standard transmission and
  371.                  no seat belts.
  372.  COBOL         - A delivery van. It's bulky and ugly, but it does the work.
  373.  BASIC         - A second-hand Rambler with a rebuilt engine and patched
  374.                  upholstry. Your dad bought it for you to learn to drive.
  375.                  You'll ditch the car as soon as you can afford a new one.
  376.  PL/I          - A Cadillac convertible with automatic transmission, a two-
  377.                  tone paint job, white-wall tires, chrome exhaust pipes, and
  378.                  fuzzy dice hanging in the windshield
  379.  C             - A black Firebird, the all-macho car. Comes with optional
  380.                  seat belts (lint) and optional fuzz buster (escape to
  381.                  assembler).
  382.  ALGOL 60      - An Austin Mini. Boy, that's a small car.
  383.  Pascal        - A Volkswagon Beetle. It's small but sturdy. Was once
  384.                  popular with intellectuals.
  385.  Modula II     - A Volkswagon Rabbit with a trailer hitch.
  386.  ALGOL 68      - An Astin Martin. An impressive car, but not just anyone
  387.                  can drive it.
  388.  LISP          - An electric car. It's simple but slow. Seat belts are not
  389.                  available.
  390.  PROLOG/LUCID  - Prototype concept-cars.
  391.  Maple/MACSYMA - All-terrain vehicles.
  392.  FORTH         - A go-cart.
  393.  LOGO          - A kiddie's replica of a Rolls Royce. Comes with a real
  394.                  engine and a working horn.
  395.  APL           - A double-decker bus. Its takes rows and columns of
  396.                  passengers to the same place all at the same time. But, it
  397.                  drives only in reverse gear, and is instrumented in Greek.
  398.  Ada           - An army-green Mercedes-Benz staff car. Power steering,
  399.                  power brakes and automatic transmission are all standard.
  400.                  No other colors or options are available. If it's good
  401.                  enough for the generals, it's good enough for you.
  402.                  Manufacturing delays due to difficulties reading the
  403.                  design specification are starting to clear up.
  404.  
  405.  
  406.  eot ------
  407.  
  408.  Down and Dirty: Quick Scripts that do something useful  (GARS) Gary Smith
  409.  ==============
  410.  
  411.  RNELM - Reply to news articles with ELM
  412.  ---------------------------------------
  413.  From: ctuel@overpass.seng.calpoly.edu (Cliff Tuel)
  414.  Subject: Rnelm -- reply to news articles with ELM
  415.  
  416.  This is one of those "why didn't I think of that" programs: when
  417.  pressing 'R' or 'r' in rn or trn to reply to an article by mail,
  418.  you get thrown into ELM, instead of mail.  See the comments for
  419.  instructions.
  420.  
  421.  --- cut here ---
  422.  
  423.  : to unbundle, "sh" this file -- DO NOT use csh
  424.  :  SHAR archive format.  Archive created Mon May 17 16:57:36 1993
  425.  echo x - Rnelm
  426.  sed 's/^X//' > Rnelm <<'+FUNKY+STUFF+'
  427.  X#!/bin/sh
  428.  X#
  429.  X# Rnelm -- use ELM to reply to news articles
  430.  X# Cliff Tuel, ctuel@overpass.calpoly.edu
  431.  X# May 17, 1993
  432.  X#
  433.  X# To make (t)rn call this instead of Rnmail: setenv MAILPOSTER Rnelm
  434.  X#
  435.  X
  436.  Xletter={$DOTDIR-$HOME}/.letter
  437.  Xorig={$DOTDIR-$HOME}/.rnhead
  438.  X
  439.  Xumask 66
  440.  X
  441.  Xto=`grep "^To: " $orig | head -1 | sed -e 's/^To: //'`
  442.  Xsubject=`grep "^Subject: " $orig | head -1 | sed -e 's/^Subject: //'`
  443.  X
  444.  Xrm -f $letter
  445.  Xsed -e '1,/^$/d' < $orig >> $letter
  446.  Xelm -i "$letter" -s "$subject" $to
  447.  Xrm $letter
  448.  +FUNKY+STUFF+
  449.  echo '-rwxr-xr-x   1 ctuel    staff    480 May 17 1993  Rnelm    (as sent)'
  450.  chmod u=rwx,g=rx,o=rx Rnelm
  451.  ls -l Rnelm
  452.  exit 0
  453.  
  454.  
  455.  --
  456.  __o o__  Cliff Tuel, System Admin
  457.  \( v )/  Departments ARDFA, CE/ENVE      ART OF NOISE, YELLO mailing lists
  458.   /___\   Cal Poly, San Luis Obispo       aon-request@polyslo.calpoly.edu
  459.    ^ ^    ctuel@overpass.calpoly.edu      yello-request@polyslo.calpoly.edu
  460.  
  461.   eot ------
  462.  
  463.  How to export variables from Child to parent
  464.  --------------------------------------------
  465.  
  466.  From: SYST8103@RyeVm.Ryerson.Ca (Ron Wigmore)
  467.  Subject: Re: How to export variables from Child to parent
  468.  
  469.  >I am writing a small shall script. I want to invoke a child process by
  470.  > program and the program changes some of the variables.
  471.  >
  472.  >How can I check the changes variable. I can used exit # and check the # .
  473.  >If there is any other way to check the variables, please send me a note ...
  474.  
  475.  This is easy to handle if you are using Bourne/Korn shells.  Simply use
  476.  shell functions instead of separate shell scripts. eg.
  477.  
  478.  grand_daughter() {
  479.  echo Hi ma!   Hi grandma!
  480.  daughter
  481.  mother
  482.  }
  483.  daughter() {
  484.  echo Hi ma!  Hi daughter!
  485.  }
  486.  mother() {
  487.  echo Hi children!
  488.  }
  489.  mother
  490.  daughter
  491.  grand_daughter
  492.  exit
  493.  
  494.  Functions really make shell programming easier, although they are
  495.  not supported by all shells.  The "{" and "}" are actually the curly
  496.  braces that VM likes to display as hypens!  Functions act a lot like
  497.  "Call Routines" in REXX ie. you do not have to worry about "results"
  498.  not being passed to the "caller", since a new process is not created
  499.  when the shell function is invoked, everything available to the "caller"
  500.  is available to the function and visa versa.  You don't have to worry
  501.  about exporting variables either.  :-)
  502.  
  503.  Ron,,,
  504.  
  505.  
  506.   eot ------
  507.  
  508.  usr/local: Items (scripts and news) snarfed from various sources
  509.  =========
  510.  
  511.  shell programming report (new version) (GARS)  Gary Smith
  512.  -------------------------------------
  513.  
  514.  From: mario@wdc.sps.mot.com (Mario Nigrovic)
  515.  Subject: Re: shell programming report (new version)
  516.  
  517.  In article <1993May7.031135*Harald.Eikrem@delab.sintef.no>,
  518.                               Harald.Eikrem@delab.sintef.no writes:
  519.  !  I got many answers for my answers, thank you all. follow is my report:
  520.  !
  521.  !  1. rm output
  522.  !     exec > output     ******** only this works ***********
  523.  !
  524.  !       report: work under "sh", dont work under "csh"
  525.  !               "csh" told me:   exec: too few arguments
  526.  !
  527.  !  2. cp /dev/null output
  528.  !       report: dont work under "csh" & "sh"
  529.  !               the file output will be filled by NULL, so size still large
  530.  !
  531.  !  3. > output
  532.  !       report: dont work under "csh" & "sh"
  533.  !               the file output will be filled by NULL, so size still large
  534.  !
  535.  !  4. rm output
  536.  !     touch output
  537.  !       report: dont work under "sh" and "csh"
  538.  !
  539.  !
  540.  ! So,it is obvious that there is a command just work under sh.Unfortunately,
  541.  !I use "csh".... Any one have solution using "csh"??  Or I have to change
  542.  !the shell I use...
  543.  
  544.  |>
  545.  |> To bad people that responds doesn't seem to know better.  If I remember
  546.  |> the thread correctly, the issue were about nulling out a file, and the
  547.  |> following should work globally (in whatever *ix shell):
  548.  |>
  549.  |>    : >file
  550.  |>
  551.  |>
  552.  |>   ~~h
  553.  
  554.  Anyone else just a little curious about (2) above?  That seemed to me to
  555.  be the way to solve the problem, too.  But, trying it, I realized that no
  556.  matter what you do, you can't reset the csh's write pointer into it's
  557.  output stream.
  558.  
  559.  Still, writing past the end of a file is the conventional way to create
  560.  holes  in a file.  This has been done as copy-protection by sun in the
  561.  past.
  562.  
  563.  Conclusion: (2) works, but doesn't look like it.
  564.  
  565.  Explanation:  Unix can create files with large apparent sizes but
  566.  minimal allocated sizes.  When any program attempts to read an
  567.  un allocated section of the file, it gets... nulls.  The only way I
  568.  know to directly determine the allocated size of a 'holed' file is
  569.  via dump.  Consider the following script:
  570.  
  571.  #! /bin/csh -f
  572.  
  573.  @ count=1
  574.  
  575.  while ( $count < 2000 )
  576.     if ( $count % 25 == 0 ) cp /dev/null output
  577.     echo "$count this is a large amount of text.  Please let me know."
  578.     @ count++
  579.  end
  580.  
  581.  This produces a seemingly large output file:
  582.  
  583.  % ls -l output
  584.   -rw-rw-r--  1 mario      114835 May 10 12:36 output
  585.  
  586.  But the difference in 'df .' before and after is only 24K!
  587.  
  588.  To verify, I ran 'dump':
  589.  
  590.  % dump 0f output.dump output   # (Yes 'mario' is in group 'operator')
  591.    DUMP: Date of this level 0 dump: Mon May 10 12:40:00 1993
  592.    DUMP: Date of last level 0 dump: the epoch
  593.    DUMP: Dumping /dev/rsd0d (/local) to output.dump
  594.    DUMP: mapping (Pass I) [regular files]
  595.    DUMP: mapping (Pass II) [directories]
  596.    DUMP: estimated 118 blocks (59KB) on 0.00 tape(s).
  597.    DUMP: dumping (Pass III) [directories]
  598.    DUMP: dumping (Pass IV) [regular files]
  599.    DUMP: Tape rewinding
  600.    DUMP: 96 blocks (48KB) on 1 volume
  601.    DUMP: DUMP IS DONE
  602.  
  603.  Unix 'cp' is not as smart as dump at avoiding 'holes', so to
  604.  verify, I copied the file and ran dump again...
  605.  
  606.  % cp output output2
  607.  % dump 0f output2.dump output2
  608.    DUMP: Date of this level 0 dump: Mon May 10 12:41:59 1993
  609.    DUMP: Date of last level 0 dump: the epoch
  610.    DUMP: Dumping /dev/rsd0d (/local) to output2.dump
  611.    DUMP: mapping (Pass I) [regular files]
  612.    DUMP: mapping (Pass II) [directories]
  613.    DUMP: estimated 296 blocks (148KB) on 0.00 tape(s).
  614.    DUMP: dumping (Pass III) [directories]
  615.    DUMP: dumping (Pass IV) [regular files]
  616.    DUMP: Tape rewinding
  617.    DUMP: 304 blocks (152KB) on 1 volume
  618.    DUMP: DUMP IS DONE
  619.  
  620.  Quite a difference, eh?  Looking at the dump outputs...
  621.  
  622.  % ls -l *dump
  623.  -rw-rw-r--  1 mario       40960 May 10 12:40 output.dump
  624.  -rw-rw-r--  1 mario      153600 May 10 12:42 output2.dump
  625.  
  626.  So we may reasonably conclude that, while apparently large,
  627.  the output file's data could potentially be small.
  628.  
  629.  The only limit here is that the apparent size has a limit of
  630.  2GB or so, totally independent of the size of the actual data.
  631.  
  632.  Oh, yes.  Make sure you use dump(8) for backups, not any
  633.  program which will expand all those nulls!
  634.  
  635.                                                  Mario      **NEW**
  636.                                                               \|/
  637.  Mario Nigrovic <mario@wdc.sps.mot.com>    *NEW* voice: (602) 814-4264
  638.  Motorola Western MCU Design Center        *NEW* fax:   (602) 814-4058
  639.  *  -  -  -  -  -  -  -  -  -  -  -*-  -  -  -  -  -  -  -  - /|\ -  *
  640.  "I just need enough to tide me over until I need more."
  641.         -- Bill Hoest
  642.  *  -  -  -  -  -  -  -  -  -  -  -*-  -  -  -  -  -  -  -  -  -  -  *
  643.  
  644.  
  645.  eot ------
  646.  
  647.  UnixNews  (DELPHI)  Brian T. Riley
  648.  --------
  649.  
  650.  eot ------
  651.  
  652.  TUTORIALS
  653.  =========
  654.  
  655.  Reclaiming Lost Data, or, Oops!  (MIKE.NOLAN)  Mike Nolan
  656.  -------------------------------
  657.  
  658.  There are certain commands in Unix that are so powerful that they are
  659.  downright dangerous.  'rm' is one of them.
  660.  
  661.  Recently I was trying to create some additional file space on a tight
  662.  system by cleaning up some old unused directories and did 'rm -rf *' to
  663.  delete all the files in one directory tree.  This removed all the
  664.  non-hidden files, leaving files like .profile, .newsrc, etc.
  665.  
  666.  So, without thinking much, I typed 'rm -rf .*'.  Unfortunately, this not
  667.  only deletes the files in the current directory tree, but in the
  668.  parent ('..') directory tree as well.  I figured it out before it deleted
  669.  the ENTIRE parent directory (which was /home, the primary user directory
  670.  in SVR4), but it did manage to delete around 120MB of data files.
  671.  
  672.  A quick check of the unix FAQ (in news.answers) confirmed my suspicion
  673.  that the data was not easily recoverable.   However, the FAQ goes on to
  674.  suggest that if the system can be halted IMMEDIATELY it might be possible
  675.  to reclaim some of the data.  Although I think this comment is tied to
  676.  halting the system without rewriting the superblock (where the inode
  677.  information is stored), it did get me to thinking about HOW Unix stores
  678.  (and deletes) files.
  679.  
  680.  Although the particulars vary depending on what filesystem type you have
  681.  (UFS, BFS, System V, etc.), in general files in a Unix filesystem are
  682.  identified by their inode number, and there are links to these inodes
  683.  that indicate where the file is placed in the directory tree structure and
  684.  what the file name is.  An active inode has at least one link entry to it,
  685.  and can have many more.  When a file is deleted, the link and inode
  686.  information is deleted, but the data contents of the file are not erased.
  687.  (This may not be true on secure systems.)
  688.  
  689.  So, my 120MB of data was still out there, and as long as I didn't write on
  690.  those blocks there was a chance I could reclaim the data, or at least some
  691.  of it.  So, I disconnected this system from the rest of the network, to
  692.  prevent most file activity.
  693.  
  694.  The first step was to figure out HOW to access the deleted data.  Unix
  695.  devices are accessible two ways, by blocks or as streams of characters.
  696.  In the /dev directory, block special files are identifiable by a 'b' in
  697.  the first position of the long (ls -l) entry, and character special files
  698.  by a 'c'.  A character special file is also sometimes called a 'raw' file
  699.  because Unix will consider it as a continuous stream of characters.
  700.  
  701.  So, I wrote the entire raw disk image to a streamer tape. (I used the
  702.  command: 'dd if=/dev/rroot of=/dev/rmt/c0t3d0s0')  This took about two
  703.  hours, because the partition involved had 700,000 blocks on it, and
  704.  streamer tapes are generally not noted for their speed.
  705.  
  706.  Now that I had a copy of the data in a non-volatile form, I had to figure
  707.  out how to locate and reclaim the missing information.  (By this time I
  708.  had determined that at least 90MB of the missing data was sample data for
  709.  a project I'm working on, easily regenerable.  However, most of my programs
  710.  and shell scripts would be much harder to reproduce.  This system is not
  711.  yet in production mode, so we had not yet set up a meaningful backup
  712.  schedule.)
  713.  
  714.  Using an existing program as a starting point, I developed 'reclaim', which
  715.  takes the information from the streamer tape, processes it in 512 character
  716.  blocks, and looks for my missing data.  Two keys to making this work was
  717.  having some idea of what was IN the missing files, and the realization that
  718.  since only TEXT blocks needed to be examined, I could skip any blocks that
  719.  were non-text.
  720.  
  721.  Reclaim examines each block to see if it has non-ascii characters in it.
  722.  (IE, greater than 177 octal, or below 040 octal, except for new line, tab,
  723.  new page, and perhaps a few others.)  Within a valid text block, reclaim
  724.  searches for specific character strings that would be part of the data.
  725.  (The search strings are currently hard coded into the program, although it
  726.  would be possible to have them input from the keyboard or from a data file.)
  727.  The output consists of the block number, followed by the 512 characters of
  728.  text.
  729.  
  730.  Each pass with reclaim takes me at least 90 minutes, more if it finds lots
  731.  of data.  Some forethought needs to go into determining what characters
  732.  sequences to search for.  (One would NOT want to search for the string
  733.  'char',  for example, but 'char my_weird_variable_name' might work.
  734.  
  735.  I quickly determined that for the most part my programs and scripts tended
  736.  to be in consecutive blocks, and so added to reclaim the option to save
  737.  text blocks that are 'close' to blocks with matching  character strings. It
  738.  also helps to specify more than one string that will appear in a target
  739.  file, because the first string might overlap two blocks.  An additional
  740.  refinement that could be added to reclaim would be a regular expression
  741.  search, but that is a LOT more work!
  742.  
  743.  Anyway, the good news is I've been able to reclaim the most important parts
  744.  of my lost data, and I'm holding on to the tape for a while.
  745.  
  746.  The current version of 'reclaim' has been uploaded to the Unix RoundTable
  747.  library, and will be available as file # 7136.  I hope nobody ever needs to
  748.  use it, though!
  749.  
  750.  eot ------
  751.  
  752.  Rookie Review  (JANET.S)  Janet McNeely
  753.  -------------
  754.  Part 5 of a continuing series
  755.  
  756.  
  757.  eot ------
  758.  
  759.   ---------------
  760.   REMINDER - This newsletter is being sent to you 'by request'. If you do
  761.  not wish to keep receiving it, e-mail a stop notice to GARS. On the other
  762.  hand, we would very much appreciate it if you would pass the word that we
  763.  do distribute this item near the tenth (10th) of the month of issue to any-
  764.  one on GEnie who requests it.
  765.    P L E A S E  also remember contributions are most welcome. Please e-mail
  766.  items and/or suggestions to GARS.
  767.  
  768.  etx ------
  769.  
  770.  
  771.  Trademark and Copyright notices:
  772.  Unix is a Trademark  of UNIX System Laboratories, Inc.; GEnie, LiveWire, and
  773.  RoundTable are Trademarks of General Electric Information Services  Company;
  774.  Xenix and ms-dos are Trademarks of  Microsoft  Corporation; NeXT NeXTstation
  775.  and NeXTstep  are Trademarks  of  NeXT Computer Systems, Inc., Coherent is a
  776.  Trademark of Mark Williams Company, Sun, SPARC, SunOS are Trademarks of  Sun
  777.  Microsystems, Inc., SCO is a Trademark of  Santa Cruz Operations, Telebit is
  778.  a Trademark of Telebit Corporation, Hayes  and  Smartmodem are Trademarks of
  779.  Hayes Microcomputer Products, Inc.
  780.  
  781.  The contents of this newsletter are copyright(c) 1992 and may be copied whole
  782.  or in part only if original  credit is included. The GEnie UNIX RoundTable is
  783.  not affiliated with AT&T or UNIX System Laboratories, Inc.
  784.  
  785.  eof ------
  786.  
  787.  
  788.