FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 12-22-2011, 12:18 PM
Dave Reisner
 
Default Allow comments after repo section header in pacman.conf

On Thu, Dec 22, 2011 at 05:49:47PM +1000, Allan McRae wrote:
> Pacman assumes that the final character of a line specifing a repo
> in pacman.conf is a "]". But it did not clean whitespace from the
> line after removing any comments. So lines like:
>
> [allanbrokeit] # could break system
>
> caused pacman not to recognize the repo. Adjust config parsing to
> strip comments before trimming whitespace from the end of the string.
>
> Signed-off-by: Allan McRae <allan@archlinux.org>
> ---
> src/pacman/conf.c | 12 +++++++-----
> 1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/pacman/conf.c b/src/pacman/conf.c
> index 6703243..117aecd4 100644
> --- a/src/pacman/conf.c
> +++ b/src/pacman/conf.c
> @@ -720,17 +720,19 @@ static int _parseconfig(const char *file, struct section_t *section,
> size_t line_len;
>
> linenum++;
> - strtrim(line);
> - line_len = strlen(line);
>
> /* ignore whole line and end of line comments */
> - if(line_len == 0 || line[0] == '#') {
> - continue;
> - }
> if((ptr = strchr(line, '#'))) {
> *ptr = '';
> }
>
> + strtrim(line);
> + line_len = strlen(line);

I must have been dreaming... I could have sworn that we refactored one
(or both) of our strtrim functions to return the length of the trimmed
string, rather than repeating returning the same pointer as exists in
our outvar.

> +
> + if(line_len == 0) {
> + continue;
> + }
> +
> if(line[0] == '[' && line[line_len - 1] == ']') {
> char *name;
> /* only possibility here is a line == '[]' */
> --
> 1.7.8.1
>
>
 

Thread Tools




All times are GMT. The time now is 09:30 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org