--describe-config crashes

Поиск
Список
Период
Сортировка
Искать

--describe-config crashes

От:
Zdenek Kotala <Zdenek.Kotala@Sun.COM>
Дата:
Function printMixedStruct calls printf with NULL argument. It causes 
segmentation fault. Please, apply it for 8.3 - 8.1 too.

			thanks Zdenek
Index: src/backend/utils/misc/help_config.c
===================================================================
RCS file: /zfs_data/cvs_pgsql/cvsroot/pgsql/src/backend/utils/misc/help_config.c,v
retrieving revision 1.19
diff -c -r1.19 help_config.c
*** src/backend/utils/misc/help_config.c	1 Jan 2008 19:45:54 -0000	1.19
--- src/backend/utils/misc/help_config.c	21 Feb 2008 17:48:00 -0000
***************
*** 117,123 ****
  
  		case PGC_STRING:
  			printf("STRING\t%s\t\t\t",
! 				   structToPrint->string.boot_val);
  			break;
  
  		default:
--- 117,123 ----
  
  		case PGC_STRING:
  			printf("STRING\t%s\t\t\t",
! 				   (structToPrint->string.boot_val == NULL) ? "(NULL)" : structToPrint->string.boot_val);
  			break;
  
  		default:

Re: --describe-config crashes

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Zdenek Kotala  writes:
> Function printMixedStruct calls printf with NULL argument. It causes 
> segmentation fault. Please, apply it for 8.3 - 8.1 too.

Ugh, I guess we've only tested --describe-config on platforms where
%s treats a NULL pointer the same as an empty string.

Since that's also effectively the way GUC handles it, I'm inclined
to think we should print NULL as "" not "(NULL)".  Otherwise,
will apply.

			regards, tom lane

Re: --describe-config crashes

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Tom Lane wrote:
> Zdenek Kotala  writes:
> > Function printMixedStruct calls printf with NULL argument. It causes 
> > segmentation fault. Please, apply it for 8.3 - 8.1 too.
> 
> Ugh, I guess we've only tested --describe-config on platforms where
> %s treats a NULL pointer the same as an empty string.
> 
> Since that's also effectively the way GUC handles it, I'm inclined
> to think we should print NULL as "" not "(NULL)".  Otherwise,
> will apply.

Tom has applied this patch to CVS HEAD and all relevant back-branches.

-- 
  Bruce Momjian          http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
FAQ