2002 02 08


                    LINUX NEWS
        Resources & Links From CramSession.com
            Thursday, February 7, 2002


TABLE OF CONTENTS

1) Sean’s Notes

2) Linux News

E\*Trade Moves to Linux Servers
Not Quite Top 40, but...
Solaris 9: Major Advance
GNOME and .NET? Say it Ain't So!

3) Linux Resources

How To Create The Favorite Icon
Beginner's Guide to Armoring Linux
Solaris NIS+ FAQ
Automate Command Line FTP
IPv6 For Linux

4) App o’ the Week

~~~~~~~~~~~~~~~~~~~~~~ ADVERTISEMENT ~~~~~~~~~~~~~~~~~~~~~~~

Try Our IT Certification Courses FREE! SmartCertify Direct gives you classroom-quality IT training at a fraction of the cost of traditional courses. You’ll get 24-hour online mentoring from certified advisors, hands-on interactive exercises, the popular Test Prep exams and more! Choose from MCSE, Cisco, A+, CIW, Linux, and many other courses. Click below to try them all FREE and register to WIN a state of the art Dell PC!

http://ad.brainbuzz.com/?RC06&AIH28







For information on how to advertise in this newsletter
please contact mailto:adsales@CramSession.com or visit
http://cramsession.com/marketing/default.asp

-------------------------
1) Sean's Notes
-------------------------

Unix, as you may have observed, heavily promotes the sharing
of source code.  Its command line interface also lends itself
to plain text-based documents.  Thus, it should be no surprise
that Unix has a rich set of text processing commands.

One of the more useful utilities is the diff and patch
combination.  "diff" returns the difference between a set of
files (confusingly referred to as a "diff"), and patch applies
the changes specified in the diff to a file or files.

Programmers, authors, and web programmers love this.  If
you've got 5,000 lines of text, and change three lines, you
can produce a diff of perhaps only a dozen lines.  This diff
can be sent around and applied with patch.  Not only does it
save space, but the diffs themselves are easily read so the
changes stand out.  Another situation, where two people make
changes in different parts of the document, is also handled
with diff/patch.  Both diffs can be applied, and the document
is current.  If each person were to send out copies of their
modified document, there is no way to tell which is current.

>From /tmp, I'm going to make a two copies of my services file:

$ cp /etc/services test.orig
$ cp /etc/services test

(the services file lists the port->service mappings, such as
TCP port 25 is SMTP.  A very handy reference)

Then, I'll make a change to test by adding a line to the end:

$ echo "sometest     1234/tcp    #testing" >> test

And then I'll run diff:

$ diff test.orig test
512a513
> sometest     1234/tcp    #testing

When using diff and patch, remember that the original file goes
first, and the new file goes second (in the case of diff).

The '>' symbol tells me that a line was added, and the numbers
above say that it was at line 513.  The problem with this type
of diff is that there is no context, just an instruction to
add in a new line.  The unified diff format takes care of this,
and a few more problems:

$ diff -u test.orig test
--- test.orig	Wed Feb  6 18:34:38 2002
+++ test	Wed Feb  6 18:39:29 2002
@@ -510,3 +510,4 @@

 # Local services
 test		34343/tcp	#test
+sometest     1234/tcp    #testing

Here you can see that some of the text surrounding the change
has been included.  Thus, multiple patches can be applied to
the same file without a great worry of collision.  The unified
diff format isn't perfect, though.  Sometimes, especially in
source code, you may have to make a couple of the patches by
hand, because the amount of context included wasn't enough
for patch to figure out where it should be.

I'm going to run that last one into a file, which I'll call
test.diff:

$ diff -u test.orig test > test.diff

test.diff is what I'd distribute as my diff, had I needed
to send around this patch.

Now, I'd like to patch test.orig to be at the same level
as test:

$ patch test.orig test.diff
patching file test.orig

The easiest use of patch is to pass it the file name, and
then the name of the diff.  I can verify that it worked by
comparing test.orig and test:

$ diff test.orig test
$

In the real world, you may have multiple files, with multiple
directories.  The unified format handles this nicely,
packaging all the patches into one directory:

$ diff -uNr directory.orig directory.changed > difffile

-N tells diff to recognize the creation of new files in
directory.changed, and -r specifies that it should descend
into directories recursively.

With a big patch file like difffile, I can send it directly
to patch with:

$ patch -p0 < difffile

Note the direction of the arrow this time.  We're sending
the contents of difffile to the standard input of patch.
We could have also done the same thing with

$ cat difffile | patch -p0

What's -p0 do, though?  Recall that we executed diff from
the directory above "directory.changed".  Thus, if we're
reflecting a change in a file called README, it's actually
directory.changed/README within the diff.  To apply the
patch, we must also be in the same directory relative to
our unpatched code.  The -p option tells patch how many
directories to strip off the top (in this case, none).
Had we been in directory.orig, we'd need -p1.  You can
usually tell that you're in the wrong directory (or need
to play with the values of -p) if you see the following:

$ patch -p0 < /tmp/test.diff
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- test.orig	Wed Feb  6 18:34:38 2002
|+++ test	Wed Feb  6 18:39:29 2002
--------------------------
File to patch:


Hit ^C (control-C) to abort, and fix your directory problem.

Diff and patch are easy and efficient ways of sending out
changes to source code, or almost any type of document.
Being able to patch will save you time downloading kernel
updates for sure!  If you've ever made a contribution to an
Open Source project (even if it's just correcting some
spelling, or fixing documentation), the project team will
surely appreciate your contribution in the form of a
unified diff.

Long live the Penguin,

Sean
mailto:swalberg@cramsession.com

-------------------------
2) Linux News
-------------------------

-------------------------------
E\*Trade Moves to Linux Servers
-------------------------------
"The online brokerage is moving its computer systems over to
IBM servers that run the operating system. In a statement,
E\*Trade cited cost savings and performance as reasons for
switching to Linux." This is the first I've heard of
someone in the financial sector doing this!

http://www.newswire.ca/releases/January2002/31/c7527.html

-------------------------
Not Quite Top 40, but...
-------------------------
This online radio station (and on air, in some locations)
is going to read the Linux source code on the air. All of it.
I couldn't seem to get a connection when I tried, but out
of curiosity I'll continue to try to give it a whirl.

http://radioqualia.va.com.au/freeradiolinux/

-------------------------
Solaris 9: Major Advance
-------------------------
This news report tells of some of the features we can expect
to see in Solaris 9. SSH and Kerberos are now standard, plus
difficult-to-secure applications like telnet and NFS can be
left out of the install. Besides a lot of new enhancements,
Solaris 9 is supposed to have Linux-compatibility features.
GNOME has been left out of this one, but it's supposed to be
an add-on.

http://www.eweek.com/article/0,3658,s%253D701%2526a%253D21767,00.as
p

----------------------------------
GNOME and .NET?  Say it Ain't So!
----------------------------------
GNOME leader Miguel de Icaza says that GNOME will start to
use Microsoft's .NET in the future. I'm no expert on .NET,
but I'm still pretty skeptical.

http://theregister.co.uk/content/4/23919.html

-------------------------
3) Linux Resources
-------------------------

--------------------------------
How To Create The Favorite Icon
--------------------------------
Until Mozilla started supporting the "favorite icon" feature,
I ignored it. Basically, Internet Explorer tries to download
a file called "/favicon.ico" from every website you hit. If
a file is returned, it's used next to the site's name in the
Favorites menu. Here's how to create a "favorite icon" using
the GNU tools.

http://www.mavetju.org/unix/favicon.php

-----------------------------------
Beginner's Guide to Armoring Linux
-----------------------------------
Lance Spitzner is a big name in Unix security. Here are his
guidelines for securing Linux servers that want to play on
the Internet. Though this document is somewhat dated, all of
the concepts are sound.

http://www.enteract.com/~lspitz/linux.html

-----------------
Solaris NIS+ FAQ
-----------------
NIS+ is a way of synchronizing passwords between Solaris
servers, and to a limited extent, Linux servers. If you're
the one responsible for the NIS+ server, this FAQ will be
right up your alley. I can't count the number of times I
referred to it when I was in that role.

http://www.eng.auburn.edu/users/rayh/solaris/NIS+_FAQ.html

--------------------------
Automate Command Line FTP
--------------------------
The command line client for FTP is more powerful than you
might think. From the .netrc file, you can have it login to
sites for you, and execute frequently-used command sequences.
This page has a description of what can be done, along with
several examples.

http://www.mavetju.org/unix/netrc.php

---------------
IPv6 For Linux
---------------
Linux has supported IPv6, the next generation Internet
Protocol, for some time now. The Internet doesn't support it
as a whole, so you have to tunnel it. This site, based in
Canada, allows you to join a global tunnel, and get started
into IPv6.

http://www.freenet6.net/

-------------------------
4) App o' the week
-------------------------

You're probably familiar with filename completion in the
shell... Hit tab, and you get a list of all the filenames
that begin with what you've typed so far. If there is
only one, it finishes it off for you. But wouldn't it be
great if this extended to other programs? Type "ssh TAB"
and you get a list of all the hosts you regularly SSH to?
Or pull up a list of NFS shares when you type in a hostname?
Here you go.

http://www.caliban.org/bash/index.shtml#completion

-------------------------
(C) 2002 BrainBuzz.com, Inc. All Rights Reserved.
-------------------------
-------------------------

         This message is from CramSession.com.

You are currently subscribed to the
   Hottest Linux News and Resources
   as: sean@ertw.com

To un-subscribe from this newsletter by e-mail:
   send a blank email message to:
   mailto:leave-linuxnews-3825955Y@list.cramsession.com

-------------------------------------------------------

To Subscribe to this newsletter by e-mail:
   send a blank email message to:
   mailto:join-linuxnews@list.cramsession.com
-------------------------