Subject: Re: bug in fvwm24_convert of version 2.4.0

From: Moritz Barsnick <[email-masked]>
Date: Tue, 10 Jul 2001 13:34:41 +0200

Hi,

I'm not on the list and can't followup properly ("In-Reply-To:" because
no message IDs are displayed in the web archive.

Werner wrote:

> At least with my perl 5.005_03, $HOME isn't defined within the script
> (but is set in my environment).

Perl has a different syntax. This patch should work:

--snip--
--- /opt/proj/WDM/tools/bin/fvwm24_convert      Tue Jul 10 11:08:39 2001
+++ ./fvwm24_convert    Tue Jul 10 11:59:12 2001
@@ -12,7 +12,7 @@
 ($source,$dest) = @ARGV;
 $dest2 = "$dest.pass1";
 if ( $source eq "") {
-  $source = "$$HOME/.fvwm2rc";
+  $source = "$ENV{'HOME'}/.fvwm2rc";
 }
 if ( ! -e $source ) {
   die "Can't find source file $source, giving up.\n";
--snip--

Furthermore, I get this error:

--snip--
eedmoba@sun18:/tmp > truss -f -o ./perl.trace perl ./fvwm24_convert 
Input from /home/eedmoba/.fvwm2rc, output to /.fvwm/.fvwm2rc

Can't redirect stdout to .pass1 at ./fvwm24_convert line 65.
--snip--

Well, I really don't know why it can't do so, but part of the problem
is in the first message: I will not be able to create the output file
in the root directory.  ;-) This is because the script uses this
argument parsing:

($source,$dest) = @ARGV;

makeing $dest empty if you don't pass the script two arguments.
If you do pass two args, things go well.

So there should be an

$ARGV = 2 || die "$ARGV[0] requires two arguments";

in there, or something, because the defaults don't work out of the
box..

Thanks for listening,
now I'll finally try all those nifty new features (on Solaris),
Moritz
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 10 Jul 2001 13:18:49 +0000

> no message IDs are displayed in the web archive.

You may find all needed information to create manually both "In-Reply-To:"
and "References:" in the html source if you like to be nice to others. :-)

> Perl has a different syntax. This patch should work:

I already applied more full patch on Date: Sun, 08 Jul 2001 04:46:21 -0500.

I now see another problem when less than 2 params given. I will fix it.

> $ARGV = 2 || die "$ARGV[0] requires two arguments";

This line has 3 perl bugs. :) The correct syntax would be:

  @ARGV == 1 || die "$0 requires two arguments";

But it was intended to have 0, 1 or 2 arguments anyway, not only 0 and 2.
It should work now as intended.

Regards,
Mikhael.

---

From: Moritz Barsnick <[email-masked]>
Date: Tue, 10 Jul 2001 15:35:36 +0200

Hi Mikhael, hi workers!

> and "References:" in the html source if you like to be nice to others. :-)

I should've guessed! Or should I?  ;-)

> I already applied more full patch on Date: Sun, 08 Jul 2001 04:46:21 -0500.

That's CVS, I guess? Fine. I will stick with 2.4.0 vanilla right know,
it seems to work fine. But nice to see you've acknowledged it. :)

>   @ARGV == 1 || die "$0 requires two arguments";

I stand corrected.  :) I was too lazy to write: "You'll either have to
handle the arguments correctly, providing proper defaults, or at least
check for their existance."

BTW (OT), I thought it was now desired to always prefix a '$' when
accessing a variable as a scalar. Or was that the "context" thing? It's
so long back that I read the Camel book. :)

Happy working (take a rest, guys'n'gals!),
greetings from Germany,
Moritz

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 10 Jul 2001 13:52:47 +0000

On 10 Jul 2001 15:35:36 +0200, Moritz Barsnick wrote:
> accessing a variable as a scalar.

Only when accessing a single array element: $ARGV[0]. The arguments are
passed using array @ARGV. Without braces an undefined scalar $ARGV is used.

Regards,
Mikhael.