Bug 53445

Summary: use AS_IF, AS_CASE instead of if/fi and case/esac
Product: Telepathy Reporter: Simon McVittie <smcv>
Component: tp-glibAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard: review+
i915 platform: i915 features:
Attachments: 1/3] configure.ac: don't rely on test -a
2/3] configure.ac: use AS_IF instead of if/then/[else/]fi
3/3] configure.ac: use AS_CASE instead of case/esac

Description Simon McVittie 2012-08-13 16:19:04 UTC
Ordinary shell conditionals with "if" or "case" aren't actually safe in configure.ac; it's sometimes necessary to use AS_IF, AS_CASE. Ideally, we should do that consistently across all projects.

Here's a start on that: making that change to just telepathy-glib.
Comment 1 Simon McVittie 2012-08-13 16:19:29 UTC
Created attachment 65501 [details] [review]
1/3] configure.ac: don't rely on test -a

test EXPR -a EXPR is a common extension (present in bash, dash etc.), but
is not guaranteed by POSIX.
Comment 2 Simon McVittie 2012-08-13 16:19:55 UTC
Created attachment 65502 [details] [review]
2/3] configure.ac: use AS_IF instead of if/then/[else/]fi

AS_IF is always safe, whereas if/fi usually works in practice, but
sometimes fails to do the right thing with Autoconf macro dependencies.

See <https://bugzilla.gnome.org/show_bug.cgi?id=681413> for more
information.
Comment 3 Simon McVittie 2012-08-13 16:20:11 UTC
Created attachment 65503 [details] [review]
3/3] configure.ac: use AS_CASE instead of case/esac

This is the same as AS_IF, but for "case". It's safer for the same
reasons.
Comment 4 Simon McVittie 2012-08-13 16:37:01 UTC
I've edited http://telepathy.freedesktop.org/wiki/Style to recommend AS_IF, AS_CASE.
Comment 5 Jonny Lamb 2012-08-20 13:14:10 UTC
Hilarious.

┏━╸┏━┓   ┏━┓╻ ╻┏━╸┏━┓╺┳┓
┃╺┓┃ ┃   ┣━┫┣━┫┣╸ ┣━┫ ┃┃
┗━┛┗━┛   ╹ ╹╹ ╹┗━╸╹ ╹╺┻┛
Comment 6 Simon McVittie 2012-08-27 09:47:00 UTC
Fixed in git for 0.19.7, thanks. I've opened many clones for our other non-obsolete Autotools projects.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.