Bug 53445 - use AS_IF, AS_CASE instead of if/fi and case/esac
Summary: use AS_IF, AS_CASE instead of if/fi and case/esac
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: Telepathy bugs list
URL:
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2012-08-13 16:19 UTC by Simon McVittie
Modified: 2012-08-27 09:47 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
1/3] configure.ac: don't rely on test -a (951 bytes, patch)
2012-08-13 16:19 UTC, Simon McVittie
Details | Splinter Review
2/3] configure.ac: use AS_IF instead of if/then/[else/]fi (6.08 KB, patch)
2012-08-13 16:19 UTC, Simon McVittie
Details | Splinter Review
3/3] configure.ac: use AS_CASE instead of case/esac (1.05 KB, patch)
2012-08-13 16:20 UTC, Simon McVittie
Details | Splinter Review

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.