[152522] contrib/mp-buildbot/mpbb

larryv at macports.org larryv at macports.org
Sun Sep 11 18:58:48 PDT 2016


Revision: 152522
          https://trac.macports.org/changeset/152522
Author:   larryv at macports.org
Date:     2016-09-11 18:58:48 -0700 (Sun, 11 Sep 2016)
Log Message:
-----------
mpbb: Don't automatically exit on error

`set -e` is only useful in simple scripts in which exiting immediately
is the only real response to a failed command. In a program as complex
as mpbb, it's more trouble than it's worth.

- Simple commands frequently have to be suffixed with visual noise like
  `|| true` or `|| return` to keep the shell from exiting when it
  doesn't have to or when we don't want it to.

- `set -e` disallows some useful behavior. For instance, the exit status
  of `if`/`else` and `for` commands might be the exit status of the last
  command executed within. This means these commands can "fail", which
  we can sometimes take advantage of. With `set -e`, we have to do
  something silly like `|| { rc=$?; true }` to save the status and
  prevent the shell from exiting.

- `set -e` has several gotchas that can change from shell version to
  shell version [*].

- If a command returns a nonzero status silently, the shell simply exits
  with no indication of which command was at fault.

I think it's better to just explicitly handle errors ourselves.

[*]: http://mywiki.wooledge.org/BashFAQ/105

Modified Paths:
--------------
    contrib/mp-buildbot/mpbb

Modified: contrib/mp-buildbot/mpbb
===================================================================
--- contrib/mp-buildbot/mpbb	2016-09-12 01:48:27 UTC (rev 152521)
+++ contrib/mp-buildbot/mpbb	2016-09-12 01:58:48 UTC (rev 152522)
@@ -1,8 +1,8 @@
 #!/bin/bash
 # -*- coding: utf-8; mode: sh; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=sh:et:sw=4:ts=4:sts=4
 
-# Abort on error and undefined variables. Enable debug output
-set -eu
+# Abort on undefined variables.
+set -u
 
 ## Options and their defaults
 option_default_archive_site=https://packages.macports.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160911/a8dd2408/attachment.html>


More information about the macports-changes mailing list