From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.devel Subject: Re: Question about start-process and argument list Date: Fri, 03 Feb 2023 20:24:52 +0100 Message-ID: <63dd5f91.050a0220.1f3dc.df39@mx.google.com> References: <87r0v7wgrp.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38066"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jean Louis , Eric Abrahamsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 03 20:26:04 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pO1hE-0009f6-Nc for ged-emacs-devel@m.gmane-mx.org; Fri, 03 Feb 2023 20:26:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pO1gb-0000i8-3J; Fri, 03 Feb 2023 14:25:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pO1gZ-0000hZ-4w for emacs-devel@gnu.org; Fri, 03 Feb 2023 14:25:23 -0500 Original-Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pO1gJ-0002To-K4 for emacs-devel@gnu.org; Fri, 03 Feb 2023 14:25:09 -0500 Original-Received: by mail-wm1-x32a.google.com with SMTP id o36so4651442wms.1 for ; Fri, 03 Feb 2023 11:25:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=VsJc4V5rDZTDb+nUD1igOvckwF56FMsG8G5yRtGxGCY=; b=SP8c5r4H0RAexqgjWIXdrLYYO0bDO2xchUT+l5Gt1caEiId6l1Q2f8u2IiKd7ef0q7 TArXmW7GLTge9Jg6Xg1vhTPb/6VtViAPkxH16QgA/LJUKk20Q/MFiGjRvgZCCtPBAcJ2 fMK0g35Bho1JFJvMP3WjaUy8ZcVnQEtrQEecgRbjES3APO6VS0BtxAeyfvjVozfKOxmH W9l4fGRgKk8u3r9ZhkMreHqjuF2J40pBS+BHwEHR5ME4Y8uIZWf6ftoQ/kmkzpQbnrXB riZaenRKQ8P0S9oK7c7z314utl7IYxQzrXSrCzvCgn0coxjYeUnCkgcAmeIFKotBw2jG R5SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VsJc4V5rDZTDb+nUD1igOvckwF56FMsG8G5yRtGxGCY=; b=HdvpV2uwk9B/GYKCPqzHiC2xm/VivSw0iWwIcIK1MSIYCcxhZkXu2TQropVPT+J9Oi hthdURA4lR4dN8ZN7417ttV5X7v41dQ0agFTLwXLkG1xaYRb7LusiK1HjGSq5NhU57Ra zAcFqhy4JLmIY4sQSucCBTGWZlyVWSFGw+M0E8bMdaPqUdIEx9nuvb9gaQJFBZEcnABG v+0lfEYbTRdwkP3KEGsoQIo0ZFYXF2pACTNkb6Lcj9mG0oISLtvBkh1uqs034eVNsD3n b2vYOjSSBy1bbBaZIHBnBKWdymP1f0NJZ5slwwwI3+fNB7lmE91RGQk8EOhAMmaHX0kl DWWw== X-Gm-Message-State: AO0yUKXR68zkfgyOW6TAJbNPsMudv5PBbw21shcSjEDgcmO+8522jQUF Qy+4fy4tZLbFftOnIN2bKlkVlYENDeI= X-Google-Smtp-Source: AK7set9KpeM6nyvPaEaL45IUoA31SLMKMPDkpY8k6mD184Ob/VNMtmQaNqDustz/gI5cLDK2Ga973w== X-Received: by 2002:a7b:ca51:0:b0:3db:3e8:feca with SMTP id m17-20020a7bca51000000b003db03e8fecamr5104542wml.15.1675452305586; Fri, 03 Feb 2023 11:25:05 -0800 (PST) Original-Received: from tosh-laptop ([2a01:e0a:505:3460:1a16:a0c4:3f89:c0d9]) by smtp.gmail.com with ESMTPSA id u16-20020a05600c19d000b003dd1b00bd9asm3781959wmq.32.2023.02.03.11.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 11:25:05 -0800 (PST) Original-Received: by tosh-laptop (sSMTP sendmail emulation); Fri, 03 Feb 2023 20:24:52 +0100 In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=brubar.cs@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302931 Archived-At: Jean Louis writes: > * Eric Abrahamsen [2023-02-03 09:37]: >> >> 1. What does the program actually see, in this case? Is the first >> example above, is it the equivalent of (on the command line) wrapping >> the query in double quotes? > > It has same effect. Maybe I didn't understand the question, but I don't think it has the same effect nor that it should. Here is what I'm seeing on my POSIX system: ("--rcfile" config-file "-r" "another-arg" "from:bob subject:lunch") 1: '--rcfile' 2: 'config-file' 3: '-r' 4: 'another-arg' 5: 'from:bob subject:lunch' ("--rcfile" config-file "-r" "another-arg" "from:bob" "subject:lunch") 1: '--rcfile' 2: 'config-file' 3: '-r' 4: 'another-arg' 5: 'from:bob' 6: 'subject:lunch' showargs --rcfile config-file -r another-arg "from:bob subject:lunch" 1: '--rcfile' 2: 'config-file' 3: '-r' 4: 'another-arg' 5: 'from:bob subject:lunch' showargs --rcfile config-file -r another-arg from:bob subject:lunch 1: '--rcfile' 2: 'config-file' 3: '-r' 4: 'another-arg' 5: 'from:bob' 6: 'subject:lunch' >> 2. Should I be using `start-process-shell-command' instead? The docs >> mention that the main difference is that it will use shell features, >> which aren't really relevant here, but maybe it's the right thing to >> do, semantically. > > Rather no, as that becomes unsafe. Yes, it would invoke shell and > some environment and the program line. But for programing purposes is > unsafe. Right, I would advise you, like Jean, to stay with `start-process'. And, the search query should probably be only one argument (except if you accept to restrict you query syntax to something that's compatible with any possible way to quote and parse arguments on a command line on any possible OS, including sign like '-', '"', ')', etc.). Just my 2c. Bruno > -- > Jean > > Take action in Free Software Foundation campaigns: > https://www.fsf.org/campaigns > > In support of Richard M. Stallman > https://stallmansupport.org/