Message ID | 20170325203650.24464-1-straubem@gmx.de |
---|---|
State | Accepted, archived |
Headers | show |
On 26/03/17 06:36, Michael Straube wrote: > If a comment in an INSTALL file contains the name of a valid > INSTALL file function but the function itself is not present, > pacman tries to execute that function. That leads to an error. > > Ignore comments in the grep function in libalpm/trans.c to > avoid such erros. > > Signed-off-by: Michael Straube <straubem@gmx.de> This is fine. We really need to improve this area to do better than a grep... Puled to my patchqueue with typo in commit message fixed. A
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 60114882..7689079b 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -305,6 +305,7 @@ void _alpm_trans_free(alpm_trans_t *trans) static int grep(const char *fn, const char *needle) { FILE *fp; + char *ptr; if((fp = fopen(fn, "r")) == NULL) { return 0; @@ -314,6 +315,9 @@ static int grep(const char *fn, const char *needle) if(safe_fgets(line, sizeof(line), fp) == NULL) { continue; } + if((ptr = strchr(line, '#')) != NULL) { + *ptr = '\0'; + } /* TODO: this will not work if the search string * ends up being split across line reads */ if(strstr(line, needle)) {
If a comment in an INSTALL file contains the name of a valid INSTALL file function but the function itself is not present, pacman tries to execute that function. That leads to an error. Ignore comments in the grep function in libalpm/trans.c to avoid such erros. Signed-off-by: Michael Straube <straubem@gmx.de> --- lib/libalpm/trans.c | 4 ++++ 1 file changed, 4 insertions(+)