From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.devel Subject: Small fix in `shell--unquote&requote-argument' - please review Date: Wed, 31 Aug 2016 02:24:52 +0300 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1472599530 26500 195.159.176.226 (30 Aug 2016 23:25:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Aug 2016 23:25:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 31 01:25:25 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1besPE-0006JK-9u for ged-emacs-devel@m.gmane.org; Wed, 31 Aug 2016 01:25:24 +0200 Original-Received: from localhost ([::1]:51626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1besPB-00050y-QS for ged-emacs-devel@m.gmane.org; Tue, 30 Aug 2016 19:25:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1besP2-0004zu-TL for emacs-devel@gnu.org; Tue, 30 Aug 2016 19:25:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1besOy-00080m-Kq for emacs-devel@gnu.org; Tue, 30 Aug 2016 19:25:11 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:42843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1besOw-0007vR-6z for emacs-devel@gnu.org; Tue, 30 Aug 2016 19:25:08 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B1D7920208 for ; Tue, 30 Aug 2016 19:24:55 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Tue, 30 Aug 2016 19:24:55 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= content-type:date:from:message-id:mime-version:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=VV4k7SX/PX4IWRXDNe2JSiFRUa0 =; b=fpItxvyXTmmCY13XujkcWODmYtAmI1E/hlA5TFCuxQSE06g+kSZ0tHHmXo+ Nxtb48ZpFCEkttbyhYdIyIgaZlY7QZUrpUlgjNTW7EAmMys0bY2oQDwLPfzkoUHr Wf8fcdtnONHxyQqlbclTZfqm+yKH/dqtvCD5ZEto1+nxw9dc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=VV 4k7SX/PX4IWRXDNe2JSiFRUa0=; b=mEaYhn/C5q9HEHJBnkzC/uDmftA2jFs2yV T9VEus/W969jwlmoM//EHGIKmfkUgtTJqeIwNhnkN3V4zU7BYcthWDKBEjg5KY/K YmPqCKjdIPBlwxUgFkZOUkOStm0EHxYqX3GO/jN2380gpsQoXGTcmUvkNy0ldE0J HdP6KC/rQ= X-Sasl-enc: kG5S9eZZtf94/BrZd/6gsIv/+UHbQc/ZT+gtUlYd2qJr 1472599495 Original-Received: from fgunbin.local (pppoe.178-66-147-1.dynamic.avangarddsl.ru [178.66.147.1]) by mail.messagingengine.com (Postfix) with ESMTPA id 0AEDECCE87 for ; Tue, 30 Aug 2016 19:24:54 -0400 (EDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207013 Archived-At: Hi, here's what this patch does: 1. match is always less than (length str), so I guess they meant `((< (1+ match) (length qstr))'. 2. If `string-match' searching for ending single quote failed, `(match-string 0)' is still called - be careful not to do this. Filipp diff --git a/lisp/shell.el b/lisp/shell.el index 1f019f2..1dc4d26 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -384,11 +384,13 @@ shell--unquote&requote-argument ((eq (aref qstr match) ?\") (setq dquotes (not dquotes))) ((eq (aref qstr match) ?\') (cond + ;; just text if inside double quotes (dquotes (funcall push "'" (match-end 0))) - ((< match (1+ (length qstr))) - (let ((end (string-match "'" qstr (1+ match)))) - (funcall push (substring qstr (1+ match) end) - (or end (length qstr))))) + ((< (1+ match) (length qstr)) + (let ((end (or (string-match "'" qstr (1+ match)) + (error "No matching single quote")))) + (funcall push (substring qstr (1+ match) end) end))) + ;; ignore if at the end of string (t nil))) (t (error "Unexpected case in shell--unquote&requote-argument!"))) (setq qpos (match-end 0)))