From: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org, Kenichi Handa <handa@m17n.org>
Subject: Re: [PATCH] Unbreak `make install' in leim/ when leim's ${INSTALLDIR} doesn't exist
Date: Thu, 12 Oct 2006 14:52:26 +0200 [thread overview]
Message-ID: <85odshn1bp.fsf@lola.goethe.zz> (raw)
In-Reply-To: <20061012123556.GA89997@gothmog.pc> (Giorgos Keramidas's message of "Thu\, 12 Oct 2006 15\:35\:56 +0300")
Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
> I just pulled the changes from CVS.
>
> It seems to include this part:
>
> + if [ ! -d ${INSTALLDIR} ] ; then \
> + ${srcdir}/${dot}${dot}/mkinstalldirs ${INSTALLDIR}; \
> + else true; fi
>
> We don't really *need* to have an else branch in all statements. We can
> write this as:
>
> + if [ ! -d ${INSTALLDIR} ] ; then \
> + ${srcdir}/${dot}${dot}/mkinstalldirs ${INSTALLDIR}; \
> + fi
This disagrees with
(info "(autoconf) Limitations of Builtins")
`if'
[...]
There are shells that do not reset the exit status from an `if':
$ if (exit 42); then true; fi; echo $?
42
whereas a proper shell should have printed `0'. This is especially
bad in Makefiles since it produces false failures. This is why
properly written Makefiles, such as Automake's, have such hairy
constructs:
if test -f "$file"; then
install "$file" "$dest"
else
:
fi
Note that you can often use `||' instead of `if', then this is not as
ugly. Also note that `:' may actually more portable than `true'
according to the same source:
`true'
Don't worry: as far as we know `true' is portable. Nevertheless,
it's not always a builtin (e.g., Bash 1.x), and the portable shell
community tends to prefer using `:'. This has a funny side
effect: when asked whether `false' is more portable than `true'
Alexandre Oliva answered:
In a sense, yes, because if it doesn't exist, the shell will
produce an exit status of failure, which is correct for
`false', but not for `true'.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
next prev parent reply other threads:[~2006-10-12 12:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-11 23:22 [PATCH] Unbreak `make install' in leim/ when leim's ${INSTALLDIR} doesn't exist Giorgos Keramidas
2006-10-12 0:31 ` Giorgos Keramidas
2006-10-12 5:59 ` Kenichi Handa
2006-10-12 12:35 ` Giorgos Keramidas
2006-10-12 12:47 ` Andreas Schwab
2006-10-12 13:12 ` Giorgos Keramidas
2006-10-12 12:52 ` David Kastrup [this message]
2006-10-12 13:10 ` Kenichi Handa
2006-10-12 13:13 ` Giorgos Keramidas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85odshn1bp.fsf@lola.goethe.zz \
--to=dak@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=handa@m17n.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.