From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 554E3C433DB for ; Mon, 18 Jan 2021 16:12:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29E0C222F9 for ; Mon, 18 Jan 2021 16:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406378AbhARQM3 (ORCPT ); Mon, 18 Jan 2021 11:12:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406302AbhARQMV (ORCPT ); Mon, 18 Jan 2021 11:12:21 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73B79C061574 for ; Mon, 18 Jan 2021 08:11:41 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id q18so17014807wrn.1 for ; Mon, 18 Jan 2021 08:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3+pQ8FC1IEfCP/ThigNsi6mzzJzfKR4Vs/WKN8S/kpA=; b=M3JNNTUqETq45F8BEuTsN9ahzaDdUtO/eTCCUwBRRmsUXVm1G0w01n1/SuIH+BaoIZ gctgJ3jyKrSzONZ7wnskBpIcDZcQw7lfjoNUFKE+217EqJrdXTXgJoGfhOtrj1ePjnqx uRfqi2gemCil0xe/BwJHjpwakF4WCeuaIT/zJhOljw5jGWIncCK8vzkFCxQMikn2Awrj yv4GBJ+cLl5GL92eKRDtvpRSgT6ip0iAnrxoS1IVNxq1eI2VZE+4C6dQh0SHnG3qIFaR nHapY+ZPwlnBLOllMQ7IyF6AdsIVNy+ZLviQ8KMYi6etUQrw4ayD5+ces70DjWyIgB+2 xEaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3+pQ8FC1IEfCP/ThigNsi6mzzJzfKR4Vs/WKN8S/kpA=; b=a02a+fQIZqf06c+AoeuERKnEgux0m7EtPDwAUFZJBdRkRXlTExE9x5+heLkUJr+PCa t19B5X2r5CwOpWP+oYZqd5DoRz7tJ49QU34OsRMhb4fsfJwoHtKy+bt7OVnKBnQXB8EC zhIMICJi3zSWUTJD35Spd/3mVdGryjtPp2m8C++0/1saT0ypjJPg8n5xLbBfac3jssp6 EqcyElWEwXmnxSxmmAVlULI9JgnUR46AS5+Gxqj8b2QtvYC2Rt8vGC8RJaM17L9vFIwB CpVtfDogb+VTy/V2gk53g4wA1BNSpLN+nKXH4HQFybiBibEfsej6P2nOmb8WIi1WCfM6 PPAw== X-Gm-Message-State: AOAM531AQfZNkrI4z2nmC47/YUtS5VYWX2Gw85OLAuGbaGIme3H6wy/V cmYuO60aHVB2LckYl7Ue+Pjm0lkybGc= X-Google-Smtp-Source: ABdhPJxmQldGeAIpyR+oajYoMvBrT1M5anqszrJIJUJKx/6IjO9/xvLtJZuINmU8GyyqRihAk3aGsg== X-Received: by 2002:adf:b257:: with SMTP id y23mr169100wra.371.1610986300244; Mon, 18 Jan 2021 08:11:40 -0800 (PST) Received: from [192.168.1.143] ([170.253.51.130]) by smtp.gmail.com with UTF8SMTPSA id f14sm31161032wre.69.2021.01.18.08.11.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Jan 2021 08:11:39 -0800 (PST) Subject: Re: Ping: [PATCH v4] system.3: Document bug and workaround when the command name starts with a hypen To: "Michael Kerrisk (man-pages)" Cc: linux-man@vger.kernel.org References: <20210104180420.74092-1-alx.manpages@gmail.com> <20210108142209.61938-1-alx.manpages@gmail.com> <99aa567a-67d5-d7c1-ddf3-de4141f3c1ff@gmail.com> From: "Alejandro Colomar (man-pages)" Message-ID: <9c00f2b3-bd56-0f75-0053-ef17bec26085@gmail.com> Date: Mon, 18 Jan 2021 17:11:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org On 1/18/21 4:58 PM, Michael Kerrisk (man-pages) wrote: > Hi Alex, > > On 1/18/21 4:45 PM, Alejandro Colomar (man-pages) wrote: >> [removed some CCs] >> >> On 1/18/21 4:37 PM, Michael Kerrisk (man-pages) wrote: >>> On 1/18/21 4:28 PM, Alejandro Colomar (man-pages) wrote: >>>> Hi Michael, >>>> >>>> Ping! >>>> >>>> And now I noticed a typo in the subject: >>>> s/hypen/hyphen/ >>> >>> D'oh! I missed that. >>> >>> In cases like these, where there's already two amendments to the patch, >>> perhaps better is a new complete patch, rather than a ping :-). >> >> >> Yup, I considered that for a moment... >> Should've listened to myself :/ >> >> BTW, I don't understand why you ffixed to use .RS/.RE. > > > Cause that's what we do around code blocks. See man-pages(7), > and all of the other pages :-). > > The conclusion of the mail thread on this topic was that .RS/RE don't > do correct relative indents, IIRC. Ahhh, I read the diff the other way. I thought you changed .in -> .RS. But you did .RS -> .in. So forget what I said :-) Thanks, Alex > > Thanks, > > Michael > > >> See >> https://lore.kernel.org/linux-man/eaee2c6e-cbb7-94b2-f6c4-9039d184e129@gmail.com/T/ >> >> Thanks, >> >> Alex >> >>> >>> Thanks, >>> >>> Michael >>> >>> >>>> On 1/8/21 3:28 PM, Alejandro Colomar (man-pages) wrote: >>>>> >>>>> >>>>> On 1/8/21 3:22 PM, Alejandro Colomar wrote: >>>>>> man-pages bug: 211029 >>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=211029 >>>>>> >>>>>> Complete workaround >>>>> >>>>> Maybe a bit more readable: >>>>> Complete workaround example >>>>> >>>>> >>>>>> (it was too long for the page, but it may be useful here): >>>>>> >>>>>> ...... >>>>>> >>>>>> $ sudo ln -s -T /usr/bin/echo /usr/bin/-echo; >>>>>> $ cc -o system_hyphen -x c - ; >>>>>> #include >>>>>> >>>>>> int >>>>>> main(void) >>>>>> { >>>>>> system(" -echo Hello world!"); >>>>>> exit(EXIT_SUCCESS); >>>>>> } >>>>>> >>>>>> $ ./system_hyphen; >>>>>> Hello world! >>>>>> >>>>>> Reported-by: Ciprian Dorin Craciun >>>>>> Cc: Florian Weimer >>>>>> Signed-off-by: Alejandro Colomar >>>>>> --- >>>>>> >>>>>> D'oh! >>>>>> >>>>>> man3/system.3 | 20 ++++++++++++++++++++ >>>>>> 1 file changed, 20 insertions(+) >>>>>> >>>>>> diff --git a/man3/system.3 b/man3/system.3 >>>>>> index 753d46f7d..ead35ab30 100644 >>>>>> --- a/man3/system.3 >>>>>> +++ b/man3/system.3 >>>>>> @@ -255,6 +255,26 @@ are not executed. >>>>>> Such risks are especially grave when using >>>>>> .BR system () >>>>>> from a privileged program. >>>>>> +.SH BUGS >>>>>> +.\" [BUG 211029](https://bugzilla.kernel.org/show_bug.cgi?id=211029) >>>>>> +.\" [Glibc bug](https://sourceware.org/bugzilla/show_bug.cgi?id=27143) >>>>>> +.\" [POSIX bug](https://www.austingroupbugs.net/view.php?id=1440) >>>>>> +If the command name starts with a hyphen, >>>>>> +.BR sh (1) >>>>>> +interprets the command name as an option, >>>>>> +and the behavior is undefined. >>>>>> +(See the >>>>>> +.B \-c >>>>>> +option to >>>>>> +.BR sh (1).) >>>>>> +To work around this problem, >>>>>> +prepend the command with a space as in the following call: >>>>>> +.PP >>>>>> +.RS 4 >>>>>> +.EX >>>>>> + system(" \-unfortunate\-command\-name"); >>>>>> +.EE >>>>>> +.RE >>>>>> .SH SEE ALSO >>>>>> .BR sh (1), >>>>>> .BR execve (2), >>>>>> >>>>> >>>> >>>> >>> >>> >> >> > > -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/