Package: ghc6
Version: 6.10.1+dfsg1-5

Investigating bug #514085, I noticed that the debian/rules in ghc6
from experimental does not always handle errors well.  Not all errors
are trapped, sometimes because of missing "set -e" statements (see
policy 4.6) and sometimes because of backtick substitution.

So please consider the following changes. The same changes are
represented in the attached patch.

 1) On lines 134-143, instead of

        PACKAGE=` ... `; \
          { echo something involving $PACKAGE; \
          } >> debian/ghc6.substvars; \
          { echo something else involving $PACKAGE; \
          } >> debian/ghc6-prof.substvars; \
        [et cetera]

write

        set -e; \
          { utils/ghc-pkg/install-inplace/bin/ghc-pkg list -f \
                debian/tmp/usr/lib/ghc-$(ProjectVersion)/package.conf.shipped |\
            perl -ne 'print if $$foo; $$foo = 1 if /^debian/' | \
            tr '\n,A-Z' '  a-z' | \
            sed -e "s/([^)]*)//g" -e "s/-[0-9]\+\(\.[0-9]\+\)*//g" \
                -e "s/^ *//" -e "s/ *$$//" -e "s/  */, /g"; \
            echo; \
          } | \
          { read PACKAGE; \
            { echo -n "provided-devs="; \
              echo "$$PACKAGE" | \
              sed -e "s/\([a-z0-9.-]\+\)/libghc6-\1-dev/g"; \
            } >> debian/ghc6.substvars; \
            { echo -n "provided-devs="; \
              echo "$$PACKAGE" | \
              sed -e "s/\([a-z0-9.-]\+\)/libghc6-\1-prof/g"; \
            } >> debian/ghc6-prof.substvars; \
            { echo -n "provided-devs="; \
              echo "$$PACKAGE" | \
              sed -e "s/\([a-z0-9.-]\+\)/libghc6-\1-doc/g"; \
            } >> debian/ghc6-doc.substvars; \
          }

The added "echo;" is there because "read" requires a newline to work.
The "read" trick is meant to get around a sad truth: "sh -e -c 'echo
`false`'" does not result in nonzero status.

  2) On lines 147 and 152 (the 2nd and 7th lines after the "Sort out
the binaries" comment), add "set -e;" before "cd
debian/tmp/usr/lib/ghc-$(ProjectVersion)/bin"

  3) On line 170 (the third line after "# manpages"), add "set -e; "
before "for m in ghci6"

Attachment: ghc6-set-e.diff
Description: Binary data

Reply via email to