[PLUG] tool for finding bracket errors?

Karl M. Hegbloom karlheg at microsharp.com
Sat Mar 23 01:21:54 UTC 2002


>>>>> "Derek" == Derek Loree <derek at infotects.com> writes:

    Derek> I have this annoying error while trying to install a custom
    Derek> rolled kernel package, and would like to know if anyone has
    Derek> any ideas for fixing it.  The error looks like:

 I've seen this also; it's a bug in that version of "kernel-package".
 See if there's an update, then run the "make-kpkg ... kernel_image"
 agian (no need to clean; it should use what's already built if you
 use the same command line) and see if it installs correctly.

 I also know how to find a missing brace, paren (slotski) or bracket,
 and how to fix that particular script....

    Derek> Setting up kernel-image-2.4.18 (10.00.Custom) ...
    Derek> Missing right curly or square bracket at
    Derek> /var/lib/dpkg/info/kernel-image-2.4.18.postinst line 1685,
    Derek> at end of
    Derek> line
    Derek> syntax error at
    Derek> /var/lib/dpkg/info/kernel-image-2.4.18.postinst line
    Derek> 1685, at EOF
    Derek> Execution of /var/lib/dpkg/info/kernel-image-2.4.18.postinst
    Derek> aborted due
    Derek> to compilation errors.

    Derek> I've looked at the postinst script and found out 3 things:

    Derek> 1) it is a Perl script (and I don't know Perl)
    Derek> 2) it is very large for a human to poke through looking for
    Derek> pairs of brackets
    Derek> 3) there are lots of curly brackets in there.

 Yes.

    Derek> I tried just adding a curly bracket (then another and
    Derek> another) at the end, same error.

 Nope. That would take way too long.  But you are trying to fix it.
 Did you try to run "reportbug" and see if a similar bug has already
 been reported?

    Derek> My question is, is there a tool that will match pairs of
    Derek> brackets and find the dangler(s)?

 XEmacs or GNU Emacs, of course.  Since it's a right brace or bracket
 that is missing, start at the end of the file.  Use `backward-sexp':

8<----------------------------------------------------------------->8
M-left runs `backward-sexp'

`backward-sexp' is an interactive compiled Lisp function
  -- loaded from "/usr/local/src/karlheg/XEmacs/run-in-place.mule/lisp/lisp.elc"
(backward-sexp &optional ARG)

Documentation:
Move backward across one balanced expression (sexp).
With argument, do it that many times.  Negative arg -N means
move forward across N balanced expressions.
8<----------------------------------------------------------------->8

 Just hold down M-left (meta key and left keypad arrow) until it runs
 into a left brace or bracket that it cannot cross.  The
 <direction>-sexp movements only cross entire blocks of code -- a
 symbol, a parenthesized block, a string...  (in contrast to
 <direction>-word, which move a word at a time and can move out of a
 brace set...)

 Once you find the left brace that has a missing right brace, you must
 eyeball the code and try to figure out where the right brace belongs.

 If there's no update in "unstable", try pulling the one from
 "testing", ok?  Unless you figure out where to stick that brace.

-- 
mailto: (Karl M. Hegbloom) karlheg at microsharp.com
Free the Software  http://www.debian.org/social_contract
http://www.microsharp.com
phone://USA/WA/360-260-2066




More information about the PLUG mailing list