Thread: old pgindent change

old pgindent change

From
"Nigel J. Andrews"
Date:
There was a simple change commited in revision 1.47 of pgindent, listed as
being "More updates for GNU indent".

The questions are: why? and surely I can't be the only one whose hit this
problem since November 2001?

On a debian (woody or potato, which ever one had a 2.2 series kernal) using
GNU bash 2.03.0 via /bin/sh (in the pgindent script) I get:


which indent = /usr/local/bin/indent
indent -version = Berkeley indent 5.17

status = 0
You do not appear to have 'indent' installed on your system.

By adding appropiate echo commands before and after the indent -version line in
the script, I've attached my slightly modified version for completeness. I can
never remember the way around the test of $? succeds or fails but the above
experiment plus a look at the near by tests of $? in pgindent seem to show that
there is a problem here.

A simple test of 2.05a.0 on a newer system using:

ls
if [ $? -eq 0 ]; then echo success aaa; fi
lls
if [ $? -eq 0 ]; then echo success bbb; fi

shows that the lls (non-existant executable) status fails the test as expected
while the plain ls status passes.

I'm obviously missing something very significant here or there's a very strange
oddity that's been there, and specifically placed there, for nearly 2 years.


-- 
Nigel J. Andrews

Re: old pgindent change

From
"Nigel J. Andrews"
Date:
On Mon, 22 Sep 2003, Nigel J. Andrews wrote:

> 
> There was a simple change commited in revision 1.47 of pgindent, listed as
> being "More updates for GNU indent".
> 
> The questions are: why? and surely I can't be the only one whose hit this
> problem since November 2001?
> 
> ...

I also had to apply the following change in order to avoid an awk compilation
error:

*** pgindent    Mon Sep 22 23:54:40 2003
--- pgindent.new    Mon Sep 22 23:54:27 2003
***************
*** 65,71 ****                 line1 !~ "^typedef" &&                 line1 !~ "^extern[     ][     ]*\"C\"" &&
       line1 !~ "=" &&
 
!                 line1 ~ ")")                 print "int    pgindent_func_no_var_fix;";             line1 = line2;
   }
 
--- 65,71 ----                 line1 !~ "^typedef" &&                 line1 !~ "^extern[     ][     ]*\"C\"" &&
       line1 !~ "=" &&
 
!                 line1 ~ "\)")                 print "int    pgindent_func_no_var_fix;";             line1 = line2;
    }
 


The changed line was also added in November 2001, in revision 1.48 this time.

awk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan

and again with /bin/sh being a link to bash 2.03.0


-- 
Nigel J. Andrews



Re: old pgindent change

From
Bruce Momjian
Date:
I have applied the following patch to allow newer BSD indents to work
with pgindent.  Thanks.

---------------------------------------------------------------------------

Nigel J. Andrews wrote:
>
> There was a simple change commited in revision 1.47 of pgindent, listed as
> being "More updates for GNU indent".
>
> The questions are: why? and surely I can't be the only one whose hit this
> problem since November 2001?
>
> On a debian (woody or potato, which ever one had a 2.2 series kernal) using
> GNU bash 2.03.0 via /bin/sh (in the pgindent script) I get:
>
>
> which indent = /usr/local/bin/indent
> indent -version = Berkeley indent 5.17
>
> status = 0
> You do not appear to have 'indent' installed on your system.
>
> By adding appropiate echo commands before and after the indent -version line in
> the script, I've attached my slightly modified version for completeness. I can
> never remember the way around the test of $? succeds or fails but the above
> experiment plus a look at the near by tests of $? in pgindent seem to show that
> there is a problem here.
>
> A simple test of 2.05a.0 on a newer system using:
>
> ls
> if [ $? -eq 0 ]; then echo success aaa; fi
> lls
> if [ $? -eq 0 ]; then echo success bbb; fi
>
> shows that the lls (non-existant executable) status fails the test as expected
> while the plain ls status passes.
>
> I'm obviously missing something very significant here or there's a very strange
> oddity that's been there, and specifically placed there, for nearly 2 years.
>
>
> --
> Nigel J. Andrews

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(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) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/tools/pgindent/pgindent
===================================================================
RCS file: /cvsroot/pgsql-server/src/tools/pgindent/pgindent,v
retrieving revision 1.62
diff -c -c -r1.62 pgindent
*** src/tools/pgindent/pgindent    30 Aug 2003 14:59:34 -0000    1.62
--- src/tools/pgindent/pgindent    28 Sep 2003 00:20:31 -0000
***************
*** 14,20 ****
      echo "Then run $0 again."
      exit 1
  fi
! indent -version </dev/null >/dev/null 2>&1
  if [ "$?" -ne 1 ]
  then    echo "You do not appear to have 'indent' installed on your system." >&2
      exit 1
--- 14,20 ----
      echo "Then run $0 again."
      exit 1
  fi
! indent -? </dev/null >/dev/null 2>&1
  if [ "$?" -ne 1 ]
  then    echo "You do not appear to have 'indent' installed on your system." >&2
      exit 1

Re: old pgindent change

From
Bruce Momjian
Date:
Great.  Patch applied.  Nice to see someone else using pgindent.

---------------------------------------------------------------------------

Nigel J. Andrews wrote:
> 
> On Mon, 22 Sep 2003, Nigel J. Andrews wrote:
> 
> > 
> > There was a simple change commited in revision 1.47 of pgindent, listed as
> > being "More updates for GNU indent".
> > 
> > The questions are: why? and surely I can't be the only one whose hit this
> > problem since November 2001?
> > 
> > ...
> 
> I also had to apply the following change in order to avoid an awk compilation
> error:
> 
> *** pgindent    Mon Sep 22 23:54:40 2003
> --- pgindent.new    Mon Sep 22 23:54:27 2003
> ***************
> *** 65,71 ****
>                   line1 !~ "^typedef" &&
>                   line1 !~ "^extern[     ][     ]*\"C\"" &&
>                   line1 !~ "=" &&
> !                 line1 ~ ")")
>                   print "int    pgindent_func_no_var_fix;";
>               line1 = line2;
>           }
> --- 65,71 ----
>                   line1 !~ "^typedef" &&
>                   line1 !~ "^extern[     ][     ]*\"C\"" &&
>                   line1 !~ "=" &&
> !                 line1 ~ "\)")
>                   print "int    pgindent_func_no_var_fix;";
>               line1 = line2;
>           }
> 
> 
> The changed line was also added in November 2001, in revision 1.48 this time.
> 
> awk -W version
> mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
> 
> and again with /bin/sh being a link to bash 2.03.0
> 
> 
> -- 
> Nigel J. Andrews
> 
> 
> ---------------------------(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)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073