old-www/LDP/LG/issue70/lg_mail70.html

557 lines
19 KiB
HTML

<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.3F.a">
<TITLE>Linux Gazette Mailbag LG #70</TITLE></HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#3366FF" VLINK="#A000A0">
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<P> <hr>
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_bytes70.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</p>
<!-- HELP WANTED : Article Ideas SECTION ================================ -->
<!-- endcut ======================================================= -->
<center>
<H1><A NAME="wanted"><IMG ALIGN=MIDDLE ALT="" SRC="../gx/mailbox.gif">
The Mailbag</A></H1> <BR>
<!-- BEGIN wanted -->
</center>
<P> <hr> <P>
<!-- =================================================================== -->
<center><H3><font color="maroon">HELP WANTED : Article Ideas</font></H3></center>
<P>
<P> Send tech-support questions, answers and article ideas to The Answer Gang
&lt;<A HREF="mailto:linux-questions-only@ssc.com"
>linux-questions-only@ssc.com</A>&gt;. Other mail (including
questions or comments about the <EM>Gazette</EM> itself) should go to
&lt;<A HREF="mailto:gazette@ssc.com">gazette@ssc.com</A>&gt;. All material
sent to either of these addresses will be considered for publication in the
next issue. <EM>Please send answers to the original querent too, so that s/he
can get the answer without waiting for the next issue.</EM>
<P> Unanswered questions might appear here. Questions with
answers -- or answers only -- appear in The Answer Gang, 2-Cent Tips, or here,
depending on their content. There is no guarantee that questions will
<em>ever</em> be answered, especially if not related to Linux.
<P> <STRONG>Before asking a question, please check the
<A HREF=../faq/index.html><I>Linux Gazette</I> FAQ</A> to see if it has been
answered there.</STRONG>
<P> <HR> <P>
<!--====================================================================-->
<!-- BEGIN HELP WANTED : Article Ideas -->
<UL>
<!-- index_text begins -->
<li><A HREF="#wanted/1"
><strong>Arcane information ...</strong></a>
<li><A HREF="#wanted/3"
><strong>Portals</strong></a>
<li><A HREF="#wanted/5"
><strong>Migrating to SAGU</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted/1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Arcane information ...</FONT></H3>
<P><em>
Bryan Anderson wrote an article in August 2001 Linux
Gazette titled 'Make your Virtual Console Log In Automatically'.
</em></P>
<P><STRONG>
Many years ago, before the Web when terminals mattered a lot more, I
spent many hours combing through kernel code and experimenting to
figure out process groups, sessions, controlling terminals, job
control, SIGINT, SIGHUP, and the like. I could write a long article on
it, but I think it's really arcane information.
</STRONG></P>
<p>Thu, 2 Aug 2001 16:39:28 -0700
<BR>brad harder (<a href="mailto:linux-questions-only@ssc.com">bharder from methodlogic.net</a>)</p>
<P>
I'd be interested to read what Bryan has to say about this subject ...
</P>
<P>
-bch
</P>
<p>Thu, 16 Aug 2001 13:27:50 +0200
<BR>Yann Droneaud (<a href="mailto:linux-questions-only@ssc.com">ydroneaud from meuh.eu.org</a>)
<P>
Hi,
</P>
<P>
I read the article written by Bryan Anderson in August 2001 Linux
Gazette titled 'Make your Virtual Console Log In Automatically'. The
last section about process groups and controlling terminal was too short
for me.
</p><p>
I would be happy if Bryan could write a technical article about this
subject as it's suggested by him and the editor.
I'm wondering his knowledge could help me.
</p><p>PS: my currently knowledge is based on a approxmilty reading of bash
source code and the GNU libc manual (info).
</P>
<P>
--
Yann Droneaud
</P>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted/3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Portals</FONT></H3>
Tue, 14 Aug 2001 22:44:16 -0500
<BR>Vic Ward (<a href="mailto:linux-questions-only@ssc.com">vward from uswest.net</a>)
<P>
What combination of open source software should be used to create a
portal site? How could a beginner build and test such a site?
</P>
<p><em>A handful of the Answer Gang are just starting to give him links
to some related software, but an article from someone out there
who has already had the experience would be even better.</em></p>
<!-- end 3 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted/5"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Migrating to SAGU</FONT></H3>
Wed, 22 Aug 2001 02:11:23 -0300 (EST)
<BR>Cesar Brod (<a href="mailto:linux-questions-only@ssc.com?cc=cesar@brod.com.br">cesar from brod.com.br</a>)
<P>
I work as technology consultant for a small University Centre in the South
of Brazil ... we have migrated all of our academic/administrative system
into Free Software, developing the SAGU system.
</p>
<P>
BTW, I am a guest speaker at the Annual Linux Showcase, where I will be
presenting our SAGU system.
</P>
<P>
Well, let me know if you like the idea and I will produce an article.
</P>
<p><em>Thanks, Cesar, we'd love to see your article. It falls solidly into
the "real life experiences" category defined in our
<a href="http://www.linuxgazette.com/faq/index.html#questions_author"
>author guidelines</a>. You should look there for the
upcoming deadlines, and submit to
<a href="mailto:gazette@ssc.com">gazette@ssc.com</a>.
</em></p>
<p>You may find also interesting we host a "Source Forge" site at
"<A HREF="http://codigoaberto.org.br"
>http://codigoaberto.org.br</A>"
where we have more than 80 hosted projects, from people all over Brazil.
</P>
<P>
Cesar Brod
<br>Univates/Brod Tecnologia
</P>
<p><em>
Gentle Readers: If you have broad reaching projects that you
think make Linux fun and more useful, we encourage you to
consider submitting an arttcle too!
</em></P>
<!-- end 5 -->
<P> <hr> </p>
<a name="mailbag"></a>
<!-- =================================================================== -->
<center><H3><font color="maroon">GENERAL MAIL</font></H3></center>
<P> <HR> <P>
<!--====================================================================-->
<!-- BEGIN GENERAL MAIL -->
<UL>
<!-- index_text begins -->
<li><A HREF="#mailbag/1"
><strong>Re: Mistake regarding CUP</strong></a>
<li><A HREF="#mailbag/11"
><strong>more on CUP</strong></a>
<li><A HREF="#mailbag/16"
><strong>Thank you everyone</strong></a>
<li><A HREF="#mailbag/18"
><strong>Learning Perl, part 5 (LG #69)</strong></a>
<li><A HREF="#mailbag/19"
><strong>[wls@wwco.com: Learning Perl: thank you]</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag/1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Re: Mistake</FONT></H3>
Thu, 2 Aug 2001 10:12:54 -0700
<BR>Michael P. Plezbert and Xavier Prat
<p><em>This is an exchange regarding CUP
<ul>
<li><a href="../issue69/lg_mail69.html#gaz/1">The letter "Mistake"
and its script</a> published in last month's Mailbag
<li>The original article: <a href="../issue41/lopes/lopes.html"
>Compiler Construction Tools, Part III</a>
by Christopher Lopes, in 1999
</ul>
<br>
Michael has taught the compiler course at Washington Univeersity, and
programming languages is one of his areas of study.
<br>
</em></p>
<P><STRONG>
On Thu, 28 Jun 2001 18:16:59 +0100 Xavier wrote:
</STRONG></P>
<FONT COLOR="#000066"><EM>
<P><STRONG>
I just look at your issue 41 (I know that is not really recent ...) but
in the article of Christopher Lopes which is talking about CUP, there is
a mistake...
</STRONG></P>
<P><STRONG>
I tested it and I see that it didn't walk correctly for all the cases. In
fact it is necessary to put a greater priority to the operator ' - ' if
not, we have 8-6+9 = -7 because your parsor realizes initially (6+9 = 15)
and after (8-15= -7). To solve this problem it is enough to create a
state between expr and factor which will represent the fact that the
operator - has priority than it +.
</STRONG></P>
<P><STRONG>
Cordially.
<br>Xavier Prat.
</STRONG></P>
</EM></FONT>
<P>
On Wed, Aug 01, 2001 at 05:56:21PM -0500, Michael P. Plezbert wrote:
</P>
<P><STRONG>
I just couldn't let this slip by.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</STRONG></P>
<P><STRONG><BLOCKQuote>
You do NOT want to give the minus operator a greater priority than the
plus operator, because then expressions like a+b-c would parse as a+(b-c),
which generally is not what you want. (Algebraically, plus and minus are
usually given the same priority, so a+b-c means (a+b)-c.)
</BLOCKQuote></STRONG></P>
<P><STRONG>
In fact, giving the minus operator a higher priority in the CUP file
(using CUP's priority capability) will not change anything given the
grammar as written in the original article, since the grammar is
unambiguous with regard to plus and minus.
</STRONG></P>
<P><STRONG>
The problem is that the lines in the grammar
</STRONG></P>
<Pre>
expr ::= factor PLUS expr
| factor MINUS expr
</Pre>
<P><STRONG>
cause the plus and minus operators to be right-associative, when we want
them to be left-associative.
</STRONG></P>
<P><STRONG>
The fix is to changes the lines to be
</STRONG></P>
<Pre>
expr ::= expr PLUS factor
| expr MINUS factor
</Pre>
<P><STRONG>
This will make the grammar associate the plus and minus operators in the
usual way.
</STRONG></P>
<P><STRONG>
(This may have been what the author of the previous mail meant, but the
text was unclear and the link to the CUP file was broken.)
</STRONG></P>
<p><STRONG>
Michael
</STRONG></P>
<p><em>That broken link had been my fault (sorry) but it was fixed immediately
when you let us know. Thanks! -- Heather</em></p>
<!-- end 1 -->
<P>
Michael is right...
The fix is just to transform the rules of expr for PLUS and MINUS become
left-associative. Thing which I had made in my preceding fix, but it's true
that to give a higher priority to MINUS is, in fact, totaly useless...
</P>
<P>
thanks.
<br>Xavier PRAT.
</P>
<!-- end 10 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag/11"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Re: Mistake ...</FONT></H3>
Fri, 10 Aug 2001 08:40:29 -0700
<BR>Waldemar Olenycz
</P>
<P><STRONG>
Eh folks !!
</STRONG></P>
<P><STRONG>
Why don't you just remove all the factor productions (which is
clearly school boy junk ...)
and leave nothing between &lt;expressions&gt; and &lt;terms&gt; so that the
precedence directives
can work freely, and there will be no problem :
</STRONG></P>
<P><STRONG><BLOCKQuote>
ex.
</BLOCKQuote></STRONG></P>
<P><STRONG>
precedence left MINUS, PLUS;
precedence left TIMES, DIVIDE;
</STRONG></P>
<P><STRONG>
and
</STRONG></P>
<Pre>
expr ::= term
| expr MINUS expr
| expr PLUS expr
| expr TIMES expr
| expr DIVIDE expr
</Pre>
<p><em>We needed a bit more clarity, originally we weren't sure what he was
replying to:</em></p>
<blockquote>
<P>
Generally the examples given along with developement
packages or with teaching-manuals, should be merely
considered as simple hints and if used 'as-is', extreme
care should be taken ...
</P>
<P>
In the case of modern LALR parser generators with
the feature of precedence-directives :
</P>
<P><ol>
<li> the factor-type productions often present in examples
(in grammars with expression-productions),
are error prone and uselessly over-clobber
grammars.
<li> thus factor-type productions should simply be left out
so that precedence rules can work freely as expected.
</ol>
</blockquote>
<P><STRONG>
Enjoy
<br>Waldemar
</STRONG></P>
<!-- end 11 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag/16"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Thank you everyone</FONT></H3>
Fri, 10 Aug 2001 13:39:29 -0700
<BR>Lindsey Seaton (<a href="mailto:gazette@ssc.com">hetshepsut from yahoo.com</a>)
<P>
On Fri, Aug 10, 2001 at 01:34:54PM -0700, Lindsey Seaton wrote:
</P>
<P><STRONG>
Thank you everyone who helped to answer my question. The web page that was
linked in one of the e-mails was very helpful and added to my "favorites"
list for future referance.
</STRONG></P>
<P>
Thanks for letting us know. And when you know a bit more about Linux and
are able to answer this question for somebody else, please do so. That's
what keeps the Linux community active.
</P>
<!-- sig -->
<!-- sig -->
<!-- end 16 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag/18"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Learning Perl, part 5 (LG #69)</FONT></H3>
Sat, 25 Aug 2001 13:11:48 -0400
<BR>Paulo Jorge (<a href="mailto:gazette@ssc.com?cc=paulojjs@yahoo.com">paulojjs from yahoo.com</a>)
<br>Reply from Ben Okopnik
<STRONG>
<P>
I was reading your article in the Linux Gazette about programming perl
and I have a little problem in a simple script.
This is the script that should open <TT>/var/log/messages</TT> and search for
some text:
</P>
<Pre>
#!/usr/bin/perl -w
use strict
open(MESS, "&lt;/var/log/messages") or die "Cannot open file: $!\n";
while(&lt;MESS&gt;) {
print "$_\n" if /(fail|terminat(ed|ing)|no)/i;
}
close MESS;
</pre>
<P>
when I run the script the result is the following:
<p><code>
$ ./logs.pl
<br>syntax error at ./logs.pl line 4, near ") or"
<br>Execution of ./logs.pl aborted due to compilation errors.
</code></P>
<P>
Do you have a clue about what's going on?
</P>
<P>
I have a RedHat Linux with perl 5.6.0
</P>
</STRONG></P>
<P>
I believe I've actually mentioned this type of error in one of the
articles. It's a very deceptive one... and yet shared by <EM>all</EM> languages
that ignore whitespace, due to the way the parser has to look at the
code.
</P>
<P>
Look at line 4 carefully. Look at it again. Can't find anything wrong?
That's because there isn't anything. Instead, take a look at the
previous line of code, line 2 - it's missing a semicolon at the end!
When that happens, Perl figures that you simply continued your statement
further down - so, what it sees is
</P>
<P><tt>use strict open(MESS, "&lt;/var/log/messages")</tt></P>
<P>
at which point it realizes "Uh-oh. We've gone past anything that looks
like valid syntax for the 'use' function - PANIC TIME!"
</P>
<P>
The lack of a terminator on a previous line is always an error on the
<EM>current</EM> line.
</P>
<!-- end 18 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag/19"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Learning Perl: thank you</FONT></H3>
Mon, 27 Aug 2001 08:39:07 +0000
<BR>Walt Stoneburner (<A HREF="mailto:gazette@ssc.com?cc=wls@wwco.com"
>wls from wwco.com</A>)
<P>
Hey,
</P>
<P>
Just wanted to drop a quick line and say thank you for your Learning
Perl series in Linux Gazette. I very much enjoyed your writing style,
technical depth, and approach ... I picked up a lot of useful tips, and
I've been using Perl for quite a while.
</P>
<P>
Keep up the excellent work.
</P>
<P>
--
Walt Stoneburner
</P>
<!-- end 19 -->
<P> <hr> </p>
<a name="gaz"></a>
<!-- =================================================================== -->
<center><H3><font color="maroon">GAZETTE MATTERS</font></H3></center>
<P> <HR> <P>
<!--====================================================================-->
<!-- BEGIN GAZETTE MATTERS -->
<UL>
<!-- index_text begins -->
<li><A HREF="#gaz/1"
><strong>Mirror searches</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="gaz/1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Mirror searches</FONT></H3>
Wed, 29 Aug 2001 11:40:54 -0700
<BR>Mike Orr (<a href="mailto:gazette@ssc.com">LG Editor</a>)
<P>
Per the request of one of our mirrors in Germany, I have added a
provision for our mirror sites who want to run their own search
engine. Starting with this issue, the Search link on the home page
and the TOC page has changed from "Search" to "Search (www.linuxgazette.com)".
</P>
<P>
Mirrors with their own search engine may replace the text between
</P>
<blockquote><pre>&lt;!-- *** BEGIN mirror site search link *** --&gt;
</pre></blockquote>
<P>
and
</P>
<blockquote><pre>&lt;!-- *** END mirror site search link *** --&gt;
</pre></blockquote>
<P>
with a link to "<TT>(SITE.COM mirror)</TT>" on the TOC page, and
"Search <TT>(SITE.COM mirror)</TT>" on the home page.
</P>
<!-- sig -->
<!-- end 1 -->
<P> <hr> </p>
<!-- *** BEGIN copyright *** -->
<H5 align="center">This page edited and maintained by the Editors
of <I>Linux Gazette</I>
<a href="http://www.linuxgazette.com/copying.html"
>Copyright &copy;</a> 2001
<BR>Published in issue 70 of <I>Linux Gazette</I> September 2001</H5>
<H6 ALIGN="center">HTML script maintained by
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H6>
<!-- *** END copyright *** -->
<!--startcut ======================================================= -->
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<P>
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_bytes70.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</p>
</BODY></HTML>
<!--endcut ========================================================= -->