[Nix-dev] Style question git expression

Marc Weber marco-oweber at gmx.de
Sun Jun 15 02:25:44 CEST 2008


The git expression contains:

   + ''# Install man pages and Info manual
       make PERL_PATH="${perl}/bin/perl" cmd-list.made install install-info \
         -C Documentation ''               # <<<<<<<<<<<<<<<<<<<<<<<<<< 2

   + (if guiSupport then ''
       # Wrap Tcl/Tk programs
       for prog in gitk git-gui git-citool
       do
         wrapProgram "$out/bin/$prog"                   \
                     --set TK_LIBRARY "${tk}/lib/tk8.4" \
                     --prefix PATH : "${tk}/bin"
       done
     '' else "")

   + ''# Wrap `git-clone'                 # <<<<<<<<<<<<<<<<<<<<<<<<<<< 1
       wrapProgram $out/bin/git-clone                   \
                   --prefix PATH : "${cpio}/bin" '';

What I don't like here is that 1 could disturb 2 which is not that easy
to see. Why? Imagine removing the traingling space after Documentation
(while adding some different lines or changing order whatsoever)
Then the resulting script looks like:

Documentation# Wrap `git-clone'

Now what happens? don't ask me why, but Documentation# is seen as
executable which is not found, ` does no longer belong to a comment and
has no matching ending `. Then git happily installs without any of those
lines having been executed :( I don't know yet why it doesn't stop.
You have to carefully watch the log to see the one line unmatched `
error

Do you prefer either using
        ''
        # comment definitely at a new line

or 
        '' # space before the # 
as well?

both ways ensuring it can't change behaviour of 2

This damn string quoting in this expression has bitten me the second
time.

Does someone mind me adding this space or newline?

Marc



More information about the nix-dev mailing list