Re: support for POSIX 1003.1-2001 hosts - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: support for POSIX 1003.1-2001 hosts |
Date | |
Msg-id | 200203111705.g2BH5HT16987@candle.pha.pa.us Whole thread Raw |
In response to | support for POSIX 1003.1-2001 hosts (Paul Eggert <eggert@twinsun.com>) |
Responses |
Re: support for POSIX 1003.1-2001 hosts
|
List | pgsql-patches |
This is an interesting patch, but have not heard anyone else have this problem and am hesitant to add more cost to fix something that may not be broken. Sorry. --------------------------------------------------------------------------- Paul Eggert wrote: > The new POSIX standard is now official (IEEE Std 1003.1-2001), and it > has removed support for some obsolete utility options that PostgreSQL > uses in a few places. Basically, the new POSIX has removed > digit-string options (e.g., "tail -1") and options beginning with "+" > (e.g., "sort +1"). It also requires 'sort -o foo foo' rather than > 'sort foo -o foo'. I'm using an experimental environment that insists > on the new standard, so I tend to run into these problems before other > people do. > > Here is a proposed patch, relative to PostgreSQL 7.2. I've done this > by code inspection; I haven't actually run the tests. The biggest > pain is with "sort", since I assume you still want to run on ancient > hosts that do not support the POSIX "sort -k" syntax; the patches > below fall back on the traditional syntax if the POSIX syntax does > not seem to work. > > 2002-02-24 Paul Eggert <eggert@twinsun.com> > > Port to POSIX 1003.1-2001 hosts. > > * doc/src/sgml/runtime.sgml, configure.in: Don't use head -1. > > * src/test/regress/expected/select.out, > src/test/regress/expected/select_distinct.out, > src/test/regress/sql/select.sql, > src/test/regress/sql/select_distinct.sql, > src/tools/make_keywords: Don't assume sort +N. > > =================================================================== > RCS file: doc/src/sgml/runtime.sgml,v > retrieving revision 7.2 > diff -pu -r7.2 doc/src/sgml/runtime.sgml > --- doc/src/sgml/runtime.sgml 2002/01/20 22:19:56 7.2 > +++ doc/src/sgml/runtime.sgml 2002/02/25 06:47:43 > @@ -2395,7 +2395,7 @@ default:\ > <filename>postmaster.pid</filename> in the data directory. So for > example, to do a fast shutdown: > <screen> > -$ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput> > +$ <userinput>kill -INT `sed q /usr/local/pgsql/data/postmaster.pid`</userinput> > </screen> > </para> > <para> > =================================================================== > RCS file: src/test/regress/expected/select.out,v > retrieving revision 7.2 > diff -pu -r7.2 src/test/regress/expected/select.out > --- src/test/regress/expected/select.out 2001/07/16 05:07:00 7.2 > +++ src/test/regress/expected/select.out 2002/02/25 06:49:50 > @@ -2,7 +2,7 @@ > -- SELECT > -- > -- btree index > --- awk '{if($1<10){print;}else{next;}}' onek.data | sort +0n -1 > +-- awk '{if($1<10){print;}else{next;}}' onek.data | (sort -k 1,1n 2>/dev/null || sort +0n -1) > -- > SELECT onek.* WHERE onek.unique1 < 10 > ORDER BY onek.unique1; > @@ -21,7 +21,7 @@ SELECT onek.* WHERE onek.unique1 < 10 > (10 rows) > > -- > --- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 > +-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | (sort -k 1,1nr 2>/dev/null || sort +0nr -1) > -- > SELECT onek.unique1, onek.stringu1 > WHERE onek.unique1 < 20 > @@ -51,7 +51,7 @@ SELECT onek.unique1, onek.stringu1 > (20 rows) > > -- > --- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 > +-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | (sort -k 2,2d 2>/dev/null || sort +1d -2) > -- > SELECT onek.unique1, onek.stringu1 > WHERE onek.unique1 > 980 > @@ -82,7 +82,7 @@ SELECT onek.unique1, onek.stringu1 > > -- > -- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | > --- sort +1d -2 +0nr -1 > +-- (sort -k 2,2d -k 1,1nr 2>/dev/null || sort +1d -2 +0nr -1) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 > 980 > @@ -113,7 +113,7 @@ SELECT onek.unique1, onek.string4 > > -- > -- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | > --- sort +1dr -2 +0n -1 > +-- (sort -k 2,2dr -k 1,1n 2>/dev/null || sort +1dr -2 +0n -1) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 > 980 > @@ -144,7 +144,7 @@ SELECT onek.unique1, onek.string4 > > -- > -- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | > --- sort +0nr -1 +1d -2 > +-- (sort -k 1,1nr -k 2,2d 2>/dev/null || sort +0nr -1 +1d -2) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 < 20 > @@ -175,7 +175,7 @@ SELECT onek.unique1, onek.string4 > > -- > -- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | > --- sort +0n -1 +1dr -2 > +-- (sort -k 1,1n -k 2,2dr 2>/dev/null || sort +0n -1 +1dr -2) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 < 20 > @@ -212,7 +212,7 @@ SELECT onek.unique1, onek.string4 > -- > ANALYZE onek2; > -- > --- awk '{if($1<10){print $0;}else{next;}}' onek.data | sort +0n -1 > +-- awk '{if($1<10){print $0;}else{next;}}' onek.data | (sort -k 1,1n 2>/dev/null || sort +0n -1) > -- > SELECT onek2.* WHERE onek2.unique1 < 10; > unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even| stringu1 | stringu2 | string4 > @@ -230,7 +230,7 @@ SELECT onek2.* WHERE onek2.unique1 < 10; > (10 rows) > > -- > --- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 > +-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | (sort -k 1,1nr 2>/dev/null || sort +0nr -1) > -- > SELECT onek2.unique1, onek2.stringu1 > WHERE onek2.unique1 < 20 > @@ -260,7 +260,7 @@ SELECT onek2.unique1, onek2.stringu1 > (20 rows) > > -- > --- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 > +-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | (sort -k 2,2d 2>/dev/null || sort +1d -2) > -- > SELECT onek2.unique1, onek2.stringu1 > WHERE onek2.unique1 > 980; > @@ -365,7 +365,7 @@ SELECT p.name, p.age FROM person* p; > -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data | > -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data | > -- awk 'BEGIN{FS=" ";}{if(NF!=1){print $4,$5;}else{print;}}' - stud_emp.data | > --- sort +1nr -2 > +-- (sort -k 2,2nr 2>/dev/null || sort +1nr -2) > -- > SELECT p.name, p.age FROM person* p ORDER BY age using >, name; > name | age > =================================================================== > RCS file: src/test/regress/expected/select_distinct.out,v > retrieving revision 7.2 > diff -pu -r7.2 src/test/regress/expected/select_distinct.out > --- src/test/regress/expected/select_distinct.out 2000/01/06 06:40:54 7.2 > +++ src/test/regress/expected/select_distinct.out 2002/02/25 06:47:43 > @@ -43,7 +43,7 @@ SELECT DISTINCT string4 FROM tmp; > > -- > -- awk '{print $3,$16,$5;}' onek.data | sort -d | uniq | > --- sort +0n -1 +1d -2 +2n -3 > +-- (sort -k 1,1n -k 2,2d -k 3,3n 2>/dev/null || sort +0n -1 +1d -2 +2n -3) > -- > SELECT DISTINCT two, string4, ten > FROM tmp > =================================================================== > RCS file: src/test/regress/sql/select.sql,v > retrieving revision 7.2 > diff -pu -r7.2 src/test/regress/sql/select.sql > --- src/test/regress/sql/select.sql 2001/07/16 05:07:00 7.2 > +++ src/test/regress/sql/select.sql 2002/02/25 06:47:43 > @@ -3,20 +3,20 @@ > -- > > -- btree index > --- awk '{if($1<10){print;}else{next;}}' onek.data | sort +0n -1 > +-- awk '{if($1<10){print;}else{next;}}' onek.data | (sort -k 1,1n 2>/dev/null || sort +0n -1) > -- > SELECT onek.* WHERE onek.unique1 < 10 > ORDER BY onek.unique1; > > -- > --- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 > +-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | (sort -k 1,1nr 2>/dev/null || sort +0nr -1) > -- > SELECT onek.unique1, onek.stringu1 > WHERE onek.unique1 < 20 > ORDER BY unique1 using >; > > -- > --- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 > +-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | (sort -k 1,1d 2>/dev/null || sort +1d -2) > -- > SELECT onek.unique1, onek.stringu1 > WHERE onek.unique1 > 980 > @@ -24,7 +24,7 @@ SELECT onek.unique1, onek.stringu1 > > -- > -- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | > --- sort +1d -2 +0nr -1 > +-- (sort -k 2,2d -k 1,1nr 2>/dev/null || sort +1d -2 +0nr -1) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 > 980 > @@ -32,7 +32,7 @@ SELECT onek.unique1, onek.string4 > > -- > -- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | > --- sort +1dr -2 +0n -1 > +-- (sort -k 2,2dr -k 1,1n 2>/dev/null || sort +1dr -2 +0n -1) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 > 980 > @@ -40,7 +40,7 @@ SELECT onek.unique1, onek.string4 > > -- > -- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | > --- sort +0nr -1 +1d -2 > +-- (sort -k 1,1nr -k 2,2d 2>/dev/null || sort +0nr -1 +1d -2) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 < 20 > @@ -48,7 +48,7 @@ SELECT onek.unique1, onek.string4 > > -- > -- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | > --- sort +0n -1 +1dr -2 > +-- (sort -k 1,1n -k 2,2dr 2>/dev/null || sort +0n -1 +1dr -2) > -- > SELECT onek.unique1, onek.string4 > WHERE onek.unique1 < 20 > @@ -63,19 +63,19 @@ SELECT onek.unique1, onek.string4 > ANALYZE onek2; > > -- > --- awk '{if($1<10){print $0;}else{next;}}' onek.data | sort +0n -1 > +-- awk '{if($1<10){print $0;}else{next;}}' onek.data | (sort -k 1,1n 2>/dev/null || sort +0n -1) > -- > SELECT onek2.* WHERE onek2.unique1 < 10; > > -- > --- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 > +-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | (sort -k 1,1nr 2>/dev/null || sort +0nr -1) > -- > SELECT onek2.unique1, onek2.stringu1 > WHERE onek2.unique1 < 20 > ORDER BY unique1 using >; > > -- > --- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 > +-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | (sort -k 2,2d 2>/dev/null || sort +1d -2) > -- > SELECT onek2.unique1, onek2.stringu1 > WHERE onek2.unique1 > 980; > @@ -99,7 +99,7 @@ SELECT p.name, p.age FROM person* p; > -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data | > -- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data | > -- awk 'BEGIN{FS=" ";}{if(NF!=1){print $4,$5;}else{print;}}' - stud_emp.data | > --- sort +1nr -2 > +-- (sort -k 2,2nr 2>/dev/null || sort +1nr -2) > -- > SELECT p.name, p.age FROM person* p ORDER BY age using >, name; > > =================================================================== > RCS file: src/test/regress/sql/select_distinct.sql,v > retrieving revision 7.2 > diff -pu -r7.2 src/test/regress/sql/select_distinct.sql > --- src/test/regress/sql/select_distinct.sql 2000/01/06 06:41:55 7.2 > +++ src/test/regress/sql/select_distinct.sql 2002/02/25 06:47:43 > @@ -19,7 +19,7 @@ SELECT DISTINCT string4 FROM tmp; > > -- > -- awk '{print $3,$16,$5;}' onek.data | sort -d | uniq | > --- sort +0n -1 +1d -2 +2n -3 > +-- (sort -k 1,1n -k 2,2d -k 3,3n 2>/dev/null || sort +0n -1 +1d -2 +2n -3) > -- > SELECT DISTINCT two, string4, ten > FROM tmp > =================================================================== > RCS file: src/tools/make_keywords,v > retrieving revision 7.2 > diff -pu -r7.2 src/tools/make_keywords > --- src/tools/make_keywords 2001/11/26 22:41:58 7.2 > +++ src/tools/make_keywords 2002/02/25 06:47:43 > @@ -9,5 +9,6 @@ keywords. Here is what I used: > > sdif /tmp/pgkeywords tools/SQL_keywords |\ > sed 's/</ /' | sed 's/>/ /'|sed 's/|/\ > - /' | sort -b +0 > + /' |\ > +(sort -b -k 1 2>/dev/null || sort -b +0) > END > =================================================================== > RCS file: configure.in,v > retrieving revision 7.2 > diff -pu -r7.2 configure.in > --- configure.in 2002/02/03 21:04:12 7.2 > +++ configure.in 2002/02/25 06:47:43 > @@ -297,7 +297,7 @@ AC_SUBST(GCC) > > # Create compiler version string > if test x"$GCC" = x"yes" ; then > - cc_string="GCC `${CC} --version | head -1`" > + cc_string="GCC `${CC} --version | sed q`" > else > cc_string=$CC > fi > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
pgsql-patches by date: