Cyril Scetbon cscetbon.ext at orange-ftgroup.com
Wed Apr 22 12:57:21 PDT 2009
I think you should check if PGSHARE is defined, and if not use postgresql share directory as follows :

	if (strlen(PGSHARE)>0)
	{
		strcpy(share_path, PGSHARE);
	}
	else
	{
		get_share_path(myfull_path, share_path);
	}

Just in case of PGSHARE is set to ""



Christopher Browne wrote:
> Cyril Scetbon <cscetbon.ext at orange-ftgroup.com> writes:
>   
>> The error comes from the following code :
>>
>> if (find_my_exec(argv[0],myfull_path) < 0)
>> {
>>    strcpy(share_path, PGSHARE);
>> }
>> else
>> {
>>    get_share_path(myfull_path, share_path);
>> }
>>
>> that is if I use "slonik_init_cluster|/usr/bin/slonik" or
>> "slonik_init_cluster|slonik" it finds the exec file and does not use
>> PGSHARE as a share_path for slony1xxx.sql file. It should not use
>> get_share_path if PGSHARE is defined !
>>
>> to remember the issue : I compile slonik with
>> -DPGSHARE="\"/usr/share/slony1\"" but slonik searches for
>> slony1_base.sql (and other files) in /usr/share/postgresql/8.3/ and
>> not in PGSHARE
>>     
>
> Yes, that seems right...
>
> It looks to me as though the value provided by -DPGSHARE should
> *always* be used, so src/slonik/slonik.c should be patched thus:
>
> Index: slonik/slonik.c
> ===================================================================
> RCS file: /home/cvsd/slony1/slony1-engine/src/slonik/slonik.c,v
> retrieving revision 1.91
> diff -c -u -r1.91 slonik.c
> cvs diff: conflicting specifications of output style
> --- slonik/slonik.c	28 May 2008 18:23:13 -0000	1.91
> +++ slonik/slonik.c	22 Apr 2009 16:54:51 -0000
> @@ -43,7 +43,6 @@
>  int			parser_errors = 0;
>  int			current_try_level;
>  
> -static char myfull_path[MAXPGPATH];
>  static char share_path[MAXPGPATH];
>  
>  /*
> @@ -107,14 +106,7 @@
>  	/*
>  	 * We need to find a share directory like PostgreSQL. 
>  	 */
> -	if (find_my_exec(argv[0],myfull_path) < 0)
> -	{
> -		strcpy(share_path, PGSHARE);
> -	}
> -	else
> -	{
> -		get_share_path(myfull_path, share_path);
> -	}
> +	strcpy(share_path, PGSHARE);
>  
>  	if (optind < argc)
>  	{
>
> Does anyone see a reason to consider looking elsewhere than the
> autoconf-specified PGSHARE directory?
>   

-- 
Cyril SCETBON


More information about the Slony1-bugs mailing list