[arch-projects] [ABS] [PATCH v3 6/7] vcs prototypes: consistent coding style

Linus Arver linusarver at gmail.com
Wed Nov 9 23:10:42 EST 2011


On Wed, Nov 09, 2011 at 03:09:09PM +0100, Sebastian Schwarz wrote:
> On 2011-11-08 at 21:56 -0800, Linus Arver wrote:
> > Some vcs prototypes do
> > 
> >     cd repo && update
> > 
> > while others do it like
> > 
> >     cd repo
> >     update
> > 
> > to update an existing repo. It makes sense to have them all do it the
> > first way (there's nothing wrong with it, and it has better form).
> 
> I agree with the consistency issue, but not with using the first
> way. makepkg is executed with `/bin/bash -e`[1].  Whenever
> a command returns a non zero exit status makepkg exits
> immediately.  See bash(1) or set(1p).  Thus conditional checks
> on single commands with && and || are seldomly required[2].
> Even in the second case the "update" step is never reached.
> 
> I personally find the second form easier to read, as one does
> not have to think about why the && was mixed in, and if this
> makes sense.
> 
> [1]: http://projects.archlinux.org/pacman.git/commit/?id=b69edc1c3532816576198995675dd6ad53df74df
> [2]: http://projects.archlinux.org/pacman.git/commit/?id=2710b256cc260db6a0805c83fb3fcf9e32aa3d86

Hmm, I did not realize that makepkg behaved in that manner. This changes
the whole underlying assumption about what is "good form".

I've verified the behavior with a quick test in a sample PKGBUILD of
mine; indeed, if "cd repo" itself fails, makepkg will abort the build()
function.

I will revert back to the second form, as in the first version of the
patch series.

-Linus


More information about the arch-projects mailing list