Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15601

Re: Issues with history substitution and its documentation

Path csiph.com!weretis.net!feeder6.news.weretis.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Issues with history substitution and its documentation
Date Mon, 18 Nov 2019 10:34:47 -0500
Lines 50
Approved bug-bash@gnu.org
Message-ID <mailman.1845.1574091294.13325.bug-bash@gnu.org> (permalink)
References <CA+VKLw-WX8zUz06MZ9ThuMhUuW97aJ5ted8oSfJSvrVJBLW3hA@mail.gmail.com> <aafb3106-1401-47b7-ced3-92af6ea3acd4@case.edu>
Reply-To chet.ramey@case.edu
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1574091294 17016 209.51.188.17 (18 Nov 2019 15:34:54 GMT)
X-Complaints-To action@cs.stanford.edu
Cc chet.ramey@case.edu
To Jim Monte <jim.monte01@gmail.com>, bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1574091289; bh=LO5Jx+XfuX5qhQQcQSSZcUtNbG0EZeYbaz2+GnzKzwQ=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=XEIBbZW9MQpxBas3ZcPgMfXoI+U1dKG7zJh4UxfZbSnsEgAtsHl4oHf+nVvueFfNwF 8IYSaUtz4lLhCLLRUcUfqVh0eToJO/Df6mdxo589tWBkrhNYFi2mpKYAiLVPjknOk/D VzG5xuCr77ixB/amXHSvcBvBjUSOEJHJAdBIXSBb4EmuJMO0SWI1+KZSHYphcYf8Txl tI9evaYU6r1JrYSwTF4wk5ThRcMYv7Eoim/pz2yk8KfQthxuATpJ7cEVrRkcrbcsPdk yx2Fh8Z1z8W2ZNvpT+7JSGQQLYxToxMl2CWXyA+R94bGCCT4N4ylxb/5XIw0/f6N+T/ UjhTKF4Q==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1574091288; bh=2P8UlCFMvPd/5cctO7SmZbBxxRQa0ZneUopiXXRAQ4I=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=LqDJfVCS/SlmTZbcItspHUs3ws/h2gxQzibopuclLcxyPv2q7lpNUVQmtCG3vQIBw/ l41PRFMelGlXpYSomsiJCHXYRubZRG5D+I46cJWfrNemcbFpJ4hdLlmsWvrRdPira9S 14Z4Pgv0QzlgXe7cvZonaiBaVNOhup5IDZvnUlhaXM1PCQ7ShD13Tk6UHm6pz0iuuRL TmCgaeKK24kSLyrMeo5jN/61vJIe6nvKn5FLp4Qk54EKV1Gta8wzQ/P334BsZzaPfFD WWZPif1Lw7vw8WYnE8WNaPBeSAuHO5uP9lCdSiUSqN7mxwCn+XjvZc4//8Me55GcUzM 1IeAQ6hg==
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.2.2
In-Reply-To <CA+VKLw-WX8zUz06MZ9ThuMhUuW97aJ5ted8oSfJSvrVJBLW3hA@mail.gmail.com>
Content-Language en-US
X-Junkmail-Status score=7/90, host=mpv1-2015.case.edu
X-Junkmail-PrAS-Raw score=7/90, refid=2.7.2:2019.11.18.143617:17:7.944, ip=, rules=DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __PHISH_SPEAR_SUBJ_ALERT, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_MAILTO, __HTTPS_URI, __URI_WITH_PATH, URI_ENDS_IN_HTML, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __MULTIPLE_URI_TEXT, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __BODY_NO_MAILTO, __NO_HTML_TAG_RAW, BODY_SIZE_1900_1999, BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy]
X-Received-From 129.22.103.226
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <aafb3106-1401-47b7-ced3-92af6ea3acd4@case.edu>
X-Mailman-Original-References <CA+VKLw-WX8zUz06MZ9ThuMhUuW97aJ5ted8oSfJSvrVJBLW3hA@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15601

Show key headers only | View raw


On 10/3/19 6:19 PM, Jim Monte wrote:

> Description:
> =============================================================================
> Documentation of quick substitution is incorrect (or does not match
> behavior).
> 
> I believe this issue is an error with the documentation of history
> "Quick Substitution" that has existed since the first snapshot available at
> web.archive.org in 2007 at
> 
> https://web.archive.org/web/20071223174140/http://www.gnu.org/software/bash/manual/html_node/Event-Designators.html
> 
> At the least it is true that bash does not behave as the documentation
> states,
> but it does act in a way that is more reasonable (to me) than what is
> written.
> 
> The documentation states that ^string1^string2^ is equivalent to
> !!:s/string1/string2/. However, bash treats it as equivalent to
> !!:s^string1^string2^.

This is correct, and I changed the documentation.

> =============================================================================
> Behavior of empty "old" string in a substitution is undefined.
> 
> The earlier example also shows a related but different issue with the
> !!:s//a/b/ command, where the string to locate is empty.
> It causes /a to be replaced by a and the b/ is appended.

It's not, actually. It's documented in the man page, but due to an
oversight the text doesn't appear in the texinfo manual.


> =============================================================================
> BUG
> If an event designator has a leading - character, it is ignored.

It's treated as an offset with value 0, and otherwise ignored. If it's not
followed by a digit string, it should be treated as part of a search
string.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Issues with history substitution and its documentation Chet Ramey <chet.ramey@case.edu> - 2019-11-18 10:34 -0500

csiph-web