[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rerun
From: |
Bruno Haible |
Subject: |
Re: rerun |
Date: |
Fri, 11 Jun 2010 21:42:50 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Ralf,
> Wouldn't build-aux/rerun be a good candidate for a new gnulib module?
No, why would it? Packages don't ship 'rerun'. Only maintainers have it in
their PATH somewhere.
I haven't initiated moving 'git-merge-changelog' out of gnulib, where it
doesn't belong, just to repeat the same mistake with 'rerun'.
> Wrt. portability, this line:
>
> diff -u "$cachefile".old - | sed -e '1,2d' -e
> '/^-/{s/^-/-'"$color_blue"'/;s/$/'"$color_off"'/}' -e
> '/^+/{s/^+/+'"$color_red"'/;s/$/'"$color_off"'/}'
>
> could profit from a quick test whether diff supports -u
The quality of the output depends on unified diff format. If the maintainer
does not have it installed, he needs to install it first.
> and the sed script something like
>
> sed -e '1,2d' \
> -e '/^-/{' -e 's/^-/-'"$color_blue"'/' -e 's/$/'"$color_off"'/' -e '}' \
> -e '/^+/{' -e 's/^+/+'"$color_red"'/' -e 's/$/'"$color_off"'/' -e '}'
No, it violates POSIX to pass several incomplete sed scripts as separate -e
arguments. You need to pass only complete sed scripts as -e arguments, if
necessary with newline. Quoting
<http://www.opengroup.org/onlinepubs/9699919799/utilities/sed.html>:
"-e script
Add the editing commands specified by the script
option-argument to the end of the script of editing commands.
The script option-argument shall have the same properties as
the script operand, described in the OPERANDS section."
Since you must not call
sed '/^-/{'
you cannot use
sed ... -e '/^-/{' ...
Yes I know GNU sed accepts this.
> then a --version option, and the script would be in pretty good shape
> already. Maybe if the exit status could be nonzero if either the diff
> is nonempty or the $command failed, that would be neat.
Feel free to improve the script in any way you like!
Bruno