From: Michael Andres Date: Tue, 27 Jan 2009 12:10:40 +0000 (+0100) Subject: Ignore trailing whitespace in content file parser. X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~8^2~1 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=aa65b495798827af832c70ed7a3dfe4a0d56acac;p=thirdparty%2Flibsolv.git Ignore trailing whitespace in content file parser. --- diff --git a/tools/repo2solv.sh b/tools/repo2solv.sh index 104b8ae0..0995d330 100755 --- a/tools/repo2solv.sh +++ b/tools/repo2solv.sh @@ -5,7 +5,7 @@ # tries to detect the repo type and generate one SOLV file on stdout get_DESCRDIR () { - local d=$(grep '^DESCRDIR' content | sed 's/^DESCRDIR[[:space:]]\+\(.*\)[[:space:]]*$/\1/') + local d=$(grep '^DESCRDIR' content | sed 's/^DESCRDIR[[:space:]]\+\(.*[^[:space:]]\)[[:space:]]*$/\1/') if test -z "$d"; then echo suse/setup/desc else diff --git a/tools/repo_content.c b/tools/repo_content.c index be0b5bbf..4c71c428 100644 --- a/tools/repo_content.c +++ b/tools/repo_content.c @@ -251,7 +251,9 @@ repo_add_content(Repo *repo, FILE *fp, int flags) linep += strlen(linep); if (linep == line || linep[-1] != '\n') continue; - *--linep = 0; + while ( --linep > line && ( linep[-1] == ' ' || linep[-1] == '\t' ) ) + ; /* skip trailing ws */ + *linep = 0; linep = line; /* expect "key value" lines */