[pacman-dev] [PATCH] hooks: warn if reassignment overwrites previous setting

Allan McRae allan at archlinux.org
Sat Jan 14 22:42:53 UTC 2017


On 15/01/17 00:39, Andrew Gregory wrote:
> On 01/02/17 at 04:19pm, Stefan Klinger wrote:
>> hooks: complain if multiple Exec options in alpm hook
>>
>> hooks: test for reassign Exec
>>
>> hook: Make reassignment to Exec yield a warning
>>
>> hooks: more consistency checks in hook definition
>>
>> hooks: fixed typo in test descriptions
>>
>> hooks: refactored warnings into one common message
>>
>> hooks: using tabs for indentation
>>
>> fixed 2 space leaks when overwriting hook definitions
>>
>> hook: better macro definitions, more consistent usage of them
>> Signed-off-by: Stefan Klinger <git at stefan-klinger.de>
>> ---
>>  lib/libalpm/hook.c                           | 58 ++++++++++++++--------------
>>  test/pacman/tests/TESTS                      |  4 ++
>>  test/pacman/tests/hook-description-reused.py | 23 +++++++++++
>>  test/pacman/tests/hook-exec-reused.py        | 22 +++++++++++
>>  test/pacman/tests/hook-type-reused.py        | 22 +++++++++++
>>  test/pacman/tests/hook-when-reused.py        | 22 +++++++++++
>>  6 files changed, 123 insertions(+), 28 deletions(-)
>>  create mode 100644 test/pacman/tests/hook-description-reused.py
>>  create mode 100644 test/pacman/tests/hook-exec-reused.py
>>  create mode 100644 test/pacman/tests/hook-type-reused.py
>>  create mode 100644 test/pacman/tests/hook-when-reused.py
>>
>> diff --git a/lib/libalpm/hook.c b/lib/libalpm/hook.c
>> index 4ec2a906..fdb6d475 100644
>> --- a/lib/libalpm/hook.c
>> +++ b/lib/libalpm/hook.c
>> @@ -30,6 +30,10 @@
>>  #include "trans.h"
>>  #include "util.h"
>>  
>> +
>> +#define error(...) do { _alpm_log(handle, ALPM_LOG_ERROR, __VA_ARGS__); return 1; } while (0)
>> +#define warning(...) _alpm_log(handle, ALPM_LOG_WARNING, __VA_ARGS__)
> 
> The error macro was written specifically for the section of code where
> it was used.  Using it elsewhere causes those functions to return
> early.  They were specifically written not to so that we could present
> all relevant errors to the user at once.
> 

In addition, please label resubmitted patches as "v2" in the subject
line, and don't expand the scope of the patch in a revision (unless
specifically asked to).  Two patches would have been better, because I
could have accepted the first one with the fixes I had asked for.

Allan


More information about the pacman-dev mailing list