From patchwork Sun Jul 24 22:58:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabiano Furtado X-Patchwork-Id: 2073 Return-Path: Delivered-To: patchwork@archlinux.org Received: from mail.archlinux.org [95.216.189.61] by patchwork.archlinux.org with IMAP (fetchmail-6.4.30) for (single-drop); Sun, 24 Jul 2022 22:59:22 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id EPTBKsnO3WJHJQ8AK+/4rw (envelope-from ) for ; Sun, 24 Jul 2022 22:59:21 +0000 Received: from lists.archlinux.org (lists.archlinux.org [IPv6:2a01:4f9:c010:9eb4::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.archlinux.org (Postfix) with ESMTPS id 19541126F5B0; Sun, 24 Jul 2022 22:59:20 +0000 (UTC) Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id 7457B1243F38; Sun, 24 Jul 2022 22:59:19 +0000 (UTC) X-Original-To: pacman-dev@lists.archlinux.org Delivered-To: pacman-dev@lists.archlinux.org Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lists.archlinux.org (Postfix) with ESMTPS id 74BE91243F28 for ; Sun, 24 Jul 2022 22:59:17 +0000 (UTC) Received: by mail-yb1-xb34.google.com with SMTP id e81so67434ybb.5 for ; Sun, 24 Jul 2022 15:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=zPw1GHaj3nsE5dt91jD2Wkt5pHln4eibII4CuC+C4ik=; b=Cwgjb+7wOwkOh5c71CWd1KIbJfKI/0WofaZ2yAgX90TWwZE/LA6Ns/oJi9CXbQR4Cn Ag/rZPckXyXmiGcZwXfr8VvAuRkiF0/3fIVYPRknX4DabOZkD7x+u9K5AB2TfBxLZfBx pKuIk2Gxoh7VfsOkoSAwIspajkaGhAOfhAbJmnL0Qor/JVM7+NUqBHtniPxbbrp4qd6U DWxNvB1+ttSVB0sSQsaE9gvyl7xrak/kBuhSQSFGfgU/0Qf9ajFo+bLzZaxCowpryRvg /3O+xwP+sY/gImUebtHHnDi1PcVA+fUJMf6lnenAmo/Ub90uA9kRy8Gq6K0eX7Lb2Wc8 wotQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=zPw1GHaj3nsE5dt91jD2Wkt5pHln4eibII4CuC+C4ik=; b=dGkZq6TlnntuTAK7iQjqbDz7XlZCr952q4HyUsz/KKDIO6KBQZjp5WG/7CmYcL/CsK FO0BSFxJOct30WbKsK1Pk/8AvxwEtqOHD6ry5BypzkWso5QdIIfOLpS9hYoUf0Y6fpUd LUPn2wRoUK8ZflPSw09pfVuw2498UsJMO9OFuWT8tK2OEhz1yqBDT8ANbN1dZFzHYuWC 1KSI+CH+L80cnkTB4ERqmpRxv6ZjrxDaOWUkbaCcdcRBfi3+UFrg1xug2GCVMUSCu9ZL B1pBfUBIfL0oTEPOmS/Ceet+nfetGhSEbntJbGc6xQulqhVURdzKLh6X0SGm/lVX4hZ6 ZxxQ== X-Gm-Message-State: AJIora8x9CccB8jApdNs1uYEFmjMPY8+K8qIktkCrb5nOPANjhdGv721 mYZVhu2iMC6iNL3XCNc+m0Gksr81eadaW7797ezAq95+Te8= X-Google-Smtp-Source: AGRyM1tI87hGMs9jzvMeV/Z5DCbU/oXXBUcovjjXbrkWMXnkKggQXw1p97tmUnlPNmQz9qyud5PdBCYp8K6fYedE978= X-Received: by 2002:a25:d217:0:b0:670:9139:c537 with SMTP id j23-20020a25d217000000b006709139c537mr7073120ybg.100.1658703555027; Sun, 24 Jul 2022 15:59:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fabiano Furtado Date: Sun, 24 Jul 2022 19:58:17 -0300 Message-ID: Subject: Fwd: [PATCH] This simple patch allows comments in the middle of a line. To: pacman-dev@lists.archlinux.org X-BeenThere: pacman-dev@lists.archlinux.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pacman-dev-bounces@lists.archlinux.org Sender: "pacman-dev" X-Spamd-Result: default: False [-1.91 / 15.00]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; MAILLIST(-0.20)[mailman]; RCVD_IN_DNSWL_MED(-0.20)[2a01:4f9:c010:9eb4::1:from]; R_SPF_ALLOW(-0.20)[+ip6:2a01:4f9:c010:9eb4::1]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; PREVIOUSLY_DELIVERED(0.00)[pacman-dev@lists.archlinux.org]; ARC_NA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b34:received]; RCPT_COUNT_ONE(0.00)[1]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ASN(0.00)[asn:24940, ipnet:2a01:4f9::/32, country:DE]; NEURAL_HAM(-0.00)[-1.000]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_NONE(0.00)[]; FROM_NEQ_ENVFROM(0.00)[fabianofurtado@gmail.com,pacman-dev-bounces@lists.archlinux.org]; MID_RHS_MATCH_FROMTLD(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_TLS_LAST(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Server: mail.archlinux.org X-Rspamd-Queue-Id: 19541126F5B0 Authentication-Results: mail.archlinux.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Cwgjb+7w; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mail.archlinux.org: domain of pacman-dev-bounces@lists.archlinux.org designates 2a01:4f9:c010:9eb4::1 as permitted sender) smtp.mailfrom=pacman-dev-bounces@lists.archlinux.org From 4a87185f577d61f51c94e9b158d602460c795330 Mon Sep 17 00:00:00 2001 From: Fabiano Furtado gmail com> Date: Sun, 24 Jul 2022 16:44:31 -0300 Subject: [PATCH] As described in https://archlinux.org/pacman/pacman.conf.5.html#_description, "Comments are only supported by beginning a line with the hash (#) symbol. Comments cannot begin in the middle of a line.". This patch allows comments in the middle of a line. Example: LogFile = /tmp/pacman.log#/var/log/pacman.log Signed-off-by: Fabiano Furtado gmail com> --- src/common/ini.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.37.1 diff --git a/src/common/ini.c b/src/common/ini.c index 410a2843..4d09d844 100644 --- a/src/common/ini.c +++ b/src/common/ini.c @@ -60,14 +60,22 @@ int parse_ini(const char *file, ini_parser_fn cb, void *data) } while(safe_fgets(line, PATH_MAX, fp)) { - char *key, *value; + char *key, *value, *comment; size_t line_len; linenum++; + if(line[0] == '#') { + continue; + } + + if((comment = strchr(line,'#')) != NULL) { + *comment = '\0'; + } + line_len = strtrim(line); - if(line_len == 0 || line[0] == '#') { + if(line_len == 0) { continue; }