From patchwork Mon May 10 19:53:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Storsjo X-Patchwork-Id: 433173 Delivered-To: patch@linaro.org Received: by 2002:a17:907:764d:0:0:0:0 with SMTP id kj13csp3459756ejc; Mon, 10 May 2021 12:53:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys5kDUUEtJvMs/JK/i7ea9Lwm9cojGpTjiSju+Xmg0DNiK7HC9HHBSX9GD4fWni3JbpLjZ X-Received: by 2002:a05:6402:40cb:: with SMTP id z11mr32701858edb.25.1620676439543; Mon, 10 May 2021 12:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620676439; cv=none; d=google.com; s=arc-20160816; b=KAGfHIcAb7LQUPZot97aVbGHbKzxqVE24p8hYVgjddh31eP+AoG1BSYXOsohVLrAuw cDyVj8OyzqUuk8pmQiowvPOpXXGZXqBK264NewaWRXqGkuAiuDDpvWPxdNw30fa586bk 80W5+wKqBFTdaBXz+ig/nN43ixfB5nMPnXZ4WrUY8We/j+gL1327wGyzz4SB6X1bvMhm 00Tz4FhbEaqqqHiyDL5xq4IOSUfM5VbsQ6AcbxggVC4H7WTwtV3fQKZdWs4PqwqI/BmI tceJc/bEOxOfvE74d9mw7dE27b5zDId0LIl1Xk4GiO4VMDLATTIoDQJGiGLwiCjwJsUY tsGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :dmarc-filter:delivered-to; bh=P/fL5L9Q/CezAdYuHGvbkiEGYWtGx+hoZjQOEmMwhpw=; b=xcNgAtupLoXE9wIW53JoeZDsNBXhGvCUwHmFUm1dQFltV95kefjZMf00PZ5fv/0Qd8 ibh1flpCFpR2BKOwISQhYDKF88DjmAHFs0pH5R4/5cMWM209Df54msNjYg6xaWj93Tqu ooFNduAl+dBqSEWuPtcEA4RgE5/RZSRsXRwWVb7/mxt4yJIEAqla53LUyZHANBvwuYBD SN96DSwciJGbACbPD7ZhbRwoilqtYrdugE/vAfhVjgTKB+vRnadLeXgFQFlF8nw4UJE2 ikBQRYdOuJBEc28JMbGWz/bRrLzLD4lCQaayWPIRt7SVQ1xiOrMXf+fp/iC4AD0BbZLd KUpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@martin-st.20150623.gappssmtp.com header.s=20150623 header.b=hAi3deaf; spf=pass (google.com: domain of binutils-bounces@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom=binutils-bounces@sourceware.org Return-Path: Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id q24si13998591eds.147.2021.05.10.12.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 12:53:59 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@martin-st.20150623.gappssmtp.com header.s=20150623 header.b=hAi3deaf; spf=pass (google.com: domain of binutils-bounces@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom=binutils-bounces@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31DDD38515F6; Mon, 10 May 2021 19:53:58 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id CAEBE3857C60 for ; Mon, 10 May 2021 19:53:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CAEBE3857C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=martin.st Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=martin@martin.st Received: by mail-lf1-x12d.google.com with SMTP id m11so8733129lfg.3 for ; Mon, 10 May 2021 12:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=P/fL5L9Q/CezAdYuHGvbkiEGYWtGx+hoZjQOEmMwhpw=; b=hAi3deaf/d+shEF/Jzb1Z5wZAann438YQrjggYrW0Dr8vOjUpEN306EKezV7HlNvkt I1JWamuHycKjyIaIXyViNLCuLdmU+tKM02QtZv6w1s1PIMbLQQ7xafLw8UnL/NB8TgCW LCkD493CBcnk6SxxlM6MNx+jWFWQuBhoNMf3x/eJMewxRomt9pKsw1SAcGjO0NChmNsd jnRXJFGuFGiFhjZaUlOVYLpeLfXr0z/9TOGFvLECJbI653jU1rwGeabxStzlCs2AQrN8 vyXz/Q0du2VsprcP2kNPtncKmJCQ7j07a4RYDbLuQAbD7e0n9EwdBYwt9XxuhUN1DIwZ hPXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=P/fL5L9Q/CezAdYuHGvbkiEGYWtGx+hoZjQOEmMwhpw=; b=buDZdRZrgzoAtG8XPPsm7m1Kp6RRQxnyMjTrgpUBLocvk3F8bV+4GsMPJ7l1Nf6qrp dIyp9yiN6Y6mQMtHUtGM7WSnPcFZFrYWSrY3qMY0UiwIJQwRQqI1Y/l1mKJ1gPK0LpUZ ApccjM5dwTSWIYzzPQQzNOgamWhKFqVKwpkITuc548Sf6aL9yyi0NyUetZ/Q/o8WoA96 VQULKM35mJlse99GveCselsLwN7ILmSa/VIvhJ0mMrNEXrNAPp8+xmyBio6tWpgLUnpN Sm2WozyvWDnZrBu7zqDAh2rjjp8OPMjgY/zB7AeAmMjFM29dVw8GG+Ux8TJIxVWo9iJ7 7zBg== X-Gm-Message-State: AOAM530A9CS33SjVVWSizYTH2IaQxuWoGJDxT+05EHezlQvCqBCSjH37 nTyotBkWAgIfXbkwmx1BRZl6WrNULesAl68U X-Received: by 2002:a05:6512:304b:: with SMTP id b11mr18356272lfb.327.1620676432636; Mon, 10 May 2021 12:53:52 -0700 (PDT) Received: from localhost.localdomain (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id y23sm953128lfg.21.2021.05.10.12.53.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 12:53:52 -0700 (PDT) From: Martin Storsjo To: binutils@sourceware.org Subject: [PATCH] Properly restore the old behaviour regarding the --preprocess option in windres Date: Mon, 10 May 2021 22:53:51 +0300 Message-Id: <20210510195351.376323-1-martin@martin.st> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces@sourceware.org Sender: "Binutils" 749c700282097cf679ff019a9674d7c762f48619 reverted the wrong change, reinstate the changes from cc3edc52747fd8b184ee48f1b0cc1ac0aca7832e, and revert 21c33bcbe36377abf01614fb1b9be439a3b6de20, which is the one that should have been reverted to restore the old behaviour of the --preprocessor argument. PR 4356 PR 26865 PR 27594 --- binutils/windres.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/binutils/windres.c b/binutils/windres.c index 2b626a29fb6..b37b40ef296 100644 --- a/binutils/windres.c +++ b/binutils/windres.c @@ -710,13 +710,37 @@ quot (const char *string) buf = (char *) xmalloc (buflen); } +#if defined (_WIN32) && !defined (__CYGWIN__) + /* For Windows shells, quote "like this". */ + { + bool quoted = false; + + dest = buf; + if (strchr (string, ' ')) + { + quoted = true; + *dest++ = '"'; + } + + for (src = string; *src; src++, dest++) + { + /* Escape-protect embedded double quotes. */ + if (quoted && *src == '"') + *dest++ = '\\'; + *dest = *src; + } + + if (quoted) + *dest++ = '"'; + } +#else for (src = string, dest = buf; *src; src++, dest++) { if (*src == '(' || *src == ')' || *src == ' ') *dest++ = '\\'; *dest = *src; } - +#endif *dest = 0; return buf; } @@ -884,13 +908,7 @@ main (int argc, char **argv) break; case OPTION_PREPROCESSOR: - if (strchr (optarg, ' ')) - { - if (asprintf (& preprocessor, "\"%s\"", optarg) == -1) - preprocessor = optarg; - } - else - preprocessor = optarg; + preprocessor = optarg; break; case OPTION_PREPROCESSOR_ARG: