Recent change to read.c

2010-01-07 Thread despen

The recent change to the read logic causes a problem for me.
Here's a part of my .fvwm2rc:

read .fvwmrc.tile
read .fvwmrc.mouse

Those really are relative paths...



Re: Recent change to read.c

2010-01-07 Thread Thomas Adam
2010/1/7  des...@verizon.net:

 The recent change to the read logic causes a problem for me.
 Here's a part of my .fvwm2rc:

 read .fvwmrc.tile
 read .fvwmrc.mouse

 Those really are relative paths...

Indeed -- I am at work, so attaching a patch with this email.  I can't
reproduce the problem myself, but does the patch attached fix it?  If
so, I'll clean it up later.

-- Thomas Adam
Index: fvwm/read.c
===
RCS file: /home/cvs/fvwm/fvwm/fvwm/read.c,v
retrieving revision 1.65
diff -u -r1.65 read.c
--- fvwm/read.c	5 Jan 2010 19:34:39 -	1.65
+++ fvwm/read.c	7 Jan 2010 15:29:05 -
@@ -203,15 +203,16 @@
 int run_command_file(
 	char *filename, const exec_context_t *exc)
 {
-	char *full_filename;
-	FILE* f;
+	char *full_filename = NULL;
+	FILE* f = NULL;
 
 	if (filename[0] == '.' || filename[0] == '/')
 	{ /* if absolute path */
 		f = fopen(filename,r);
 		full_filename = filename;
 	}
-	else
+	
+	if (f == NULL)
 	{ /* else its a relative path */
 		full_filename = CatString3(fvwm_userdir, /, filename);
 		f = fopen(full_filename, r);
@@ -222,6 +223,7 @@
 			f = fopen(full_filename, r);
 		}
 	}
+
 	if (f == NULL)
 	{
 		return 0;


Re: Recent change to read.c

2010-01-07 Thread despen
Thomas Adam thomas.ada...@gmail.com writes:

 2010/1/7  des...@verizon.net:

 The recent change to the read logic causes a problem for me.
 Here's a part of my .fvwm2rc:

 read .fvwmrc.tile
 read .fvwmrc.mouse

 Those really are relative paths...

 Indeed -- I am at work, so attaching a patch with this email.  I can't
 reproduce the problem myself, but does the patch attached fix it?  If
 so, I'll clean it up later.

There's no hurry on my part to fix it.
I've got a local fix in place.

I'm not sure why you made the change.

Doesn't fopen FVWM_DATADIR/./file work?



Re: Recent change to read.c

2010-01-07 Thread Thomas Adam
2010/1/7  des...@verizon.net:
 Thomas Adam thomas.ada...@gmail.com writes:

 2010/1/7  des...@verizon.net:

 The recent change to the read logic causes a problem for me.
 Here's a part of my .fvwm2rc:

 read .fvwmrc.tile
 read .fvwmrc.mouse

 Those really are relative paths...

 Indeed -- I am at work, so attaching a patch with this email.  I can't
 reproduce the problem myself, but does the patch attached fix it?  If
 so, I'll clean it up later.

 There's no hurry on my part to fix it.
 I've got a local fix in place.

 I'm not sure why you made the change.

 Doesn't fopen FVWM_DATADIR/./file work?

I am sure it would do -- but since -f passing on the command line
just uses Read internally, you can't do:

fvwm -f some_file

or:

fvwm -f ./some_file

... and mean CWD -- since FVWM assumes that to be relative to
FVWM_USERDIR -- that's fine.  But that check should still happen, as
it's cumbersome having to keep doing:

fvwm -f $(pwd)/somefile

It's been annoying me now for about a year.

-- Thomas Adam



Re: Recent change to read.c

2010-01-07 Thread despen
Thomas Adam thomas.ada...@gmail.com writes:

 2010/1/7  des...@verizon.net:
 Thomas Adam thomas.ada...@gmail.com writes:

 2010/1/7  des...@verizon.net:

 The recent change to the read logic causes a problem for me.
 Here's a part of my .fvwm2rc:

 read .fvwmrc.tile
 read .fvwmrc.mouse

 Those really are relative paths...

 Indeed -- I am at work, so attaching a patch with this email.  I can't
 reproduce the problem myself, but does the patch attached fix it?  If
 so, I'll clean it up later.

 There's no hurry on my part to fix it.
 I've got a local fix in place.

 I'm not sure why you made the change.

 Doesn't fopen FVWM_DATADIR/./file work?

 I am sure it would do -- but since -f passing on the command line
 just uses Read internally, you can't do:

 fvwm -f some_file

 or:

 fvwm -f ./some_file

 ... and mean CWD -- since FVWM assumes that to be relative to
 FVWM_USERDIR -- that's fine.  But that check should still happen, as
 it's cumbersome having to keep doing:

 fvwm -f $(pwd)/somefile

 It's been annoying me now for about a year.

I see.

I don't think using CWD is part of documented behavior...

Making CWD the new default...hmm.

All of my config files start with a dot.

At first I thought testing for './' or '../' would
be the right fix.  Does that seem right to you?





Re: Recent change to read.c

2010-01-07 Thread Viktor Griph
2010/1/7 Thomas Adam thomas.ada...@gmail.com:
 On Thu, Jan 07, 2010 at 11:25:29AM -0500, des...@verizon.net wrote:
 I don't think using CWD is part of documented behavior...

 Hmm -- Do What I Mean (DWIM) approach here.  It doesn't say it isn't part of
 documented behaviour either.  :P

 Making CWD the new default...hmm.

 Not the default unless specified as such, see below.

I think that a better approach would be to add the CWD to the begining
of the search path when processing command line arguments, but not
from the config files. From config files, the DWIM approach would be
to have it look for files relative to the curently read file, and not
for the CWD of fvwm, but for that we have $., so it's not really
needed.

/Viktor