Gen_fmgrtab.sh fails with LANG=et_EE
I recently changed locale in my machine and PostgreSQL build broke.
The reason is that Gen_fmgrtab.sh uses [^A-Z] expression to sed
and the GNU people in their infinite wisdom made that locale-dependant.
As the script uses the complicated pipeline only for fmgroids.h -> FMGROIDS_H
conversion, it seems simpler to just make it explicitly set, instead to
try to work around GNU sed.
I grepped around source and did not find other instances of this.
The A-Z experssion was only in perl scripts or in configure and
configure should be fine as it explicitly resets locale.
--
marko
Attachments:
genfmgrtab.difftext/x-patch; charset=ANSI_X3.4-1968; name=genfmgrtab.diffDownload
Index: src/backend/utils/Gen_fmgrtab.sh
===================================================================
RCS file: /opt/cvs/pgsql/src/backend/utils/Gen_fmgrtab.sh,v
retrieving revision 1.32
diff -u -c -r1.32 Gen_fmgrtab.sh
*** src/backend/utils/Gen_fmgrtab.sh 5 Mar 2006 15:58:40 -0000 1.32
--- src/backend/utils/Gen_fmgrtab.sh 5 Sep 2006 08:45:55 -0000
***************
*** 62,69 ****
fi
SORTEDFILE="$$-fmgr.data"
- OIDSFILE=fmgroids.h
TABLEFILE=fmgrtab.c
trap 'echo "Caught signal." ; cleanup ; exit 1' 1 2 15
--- 62,70 ----
fi
SORTEDFILE="$$-fmgr.data"
TABLEFILE=fmgrtab.c
+ OIDSFILE=fmgroids.h
+ OIDSFILE_DEFINE=FMGROIDS_H
trap 'echo "Caught signal." ; cleanup ; exit 1' 1 2 15
***************
*** 89,95 ****
fi
- cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | sed -e 's/[^A-Z]/_/g'`
#
# Generate fmgroids.h
--- 90,95 ----
***************
*** 116,123 ****
*
*-------------------------------------------------------------------------
*/
! #ifndef $cpp_define
! #define $cpp_define
/*
* Constant macros for the OIDs of entries in pg_proc.
--- 116,123 ----
*
*-------------------------------------------------------------------------
*/
! #ifndef $OIDSFILE_DEFINE
! #define $OIDSFILE_DEFINE
/*
* Constant macros for the OIDs of entries in pg_proc.
***************
*** 147,153 ****
cat >> "$$-$OIDSFILE" <<FuNkYfMgRsTuFf
! #endif /* $cpp_define */
FuNkYfMgRsTuFf
#
--- 147,153 ----
cat >> "$$-$OIDSFILE" <<FuNkYfMgRsTuFf
! #endif /* $OIDSFILE_DEFINE */
FuNkYfMgRsTuFf
#
"Marko Kreen" <markokr@gmail.com> writes:
I grepped around source and did not find other instances of this.
The A-Z experssion was only in perl scripts or in configure and
configure should be fine as it explicitly resets locale.
Why not do the same in Gen_fmgrtab.sh? A quick LANG=C seems less
invasive than this.
regards, tom lane
Tom Lane wrote:
"Marko Kreen" <markokr@gmail.com> writes:
I grepped around source and did not find other instances of this.
The A-Z experssion was only in perl scripts or in configure and
configure should be fine as it explicitly resets locale.Why not do the same in Gen_fmgrtab.sh? A quick LANG=C seems less
invasive than this.
Well, the line of code is
cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | sed -e 's/[^A-Z]/_/g'`
so it ought to be pretty obvious what the correct solution for the
problem "character ranges are locale-dependent" is.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
Peter Eisentraut <peter_e@gmx.net> writes:
Well, the line of code is
cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | sed -e 's/[^A-Z]/_/g'`
so it ought to be pretty obvious what the correct solution for the
problem "character ranges are locale-dependent" is.
Doh. Patched that way.
Curiously, I couldn't replicate the failure on Fedora 5 --- Marko's
platform must have different locale behavior for et_EE.
regards, tom lane
On 9/5/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Peter Eisentraut <peter_e@gmx.net> writes:
Well, the line of code is
cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | sed -e 's/[^A-Z]/_/g'`
so it ought to be pretty obvious what the correct solution for the
problem "character ranges are locale-dependent" is.Doh. Patched that way.
Curiously, I couldn't replicate the failure on Fedora 5 --- Marko's
platform must have different locale behavior for et_EE.
Did you add it to locale-gen config and ran it?
Btw, I removed all the pipeline in my patch, because I felt
such messy pipeline for such a tiny thing is ugly. Especially
as the filename wont change that much. Thus I though it would
be cleaner to just put the symbol together with filename definition.
--
marko