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


Groups > gnu.bash.bug > #16424

Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.

Path csiph.com!xmission!news.snarked.org!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: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.
Date Sun, 21 Jun 2020 12:26:03 -0400
Organization ITS, Case Western Reserve University
Lines 53
Approved bug-bash@gnu.org
Message-ID <mailman.217.1592756772.2574.bug-bash@gnu.org> (permalink)
References <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt> <c2a567ac-2c9c-4ebf-f769-3aed25e679cb@iki.fi> <6BF29BAB-6F57-4D88-85BC-56E1AA14F29F@larryv.me> <4c262650-3c37-923f-53f1-358df8c0f9a1@case.edu> <1592695979.4387.27.camel@16bits.net> <262f1d13-be7c-ee68-387b-53c39a5ad304@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
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1592756772 14849 209.51.188.17 (21 Jun 2020 16:26:12 GMT)
X-Complaints-To action@cs.stanford.edu
Cc chet.ramey@case.edu
To Ángel <angel@16bits.net>, 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=1592756767; bh=PzjzRXvg6ER0HfP+PbPyIIgDpR5lKCr6EiJj2wQyas8=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=1C2IugAYLWpQofNlRbGNkf3TeCZisyieE5t7nMSKAmtJKDQIQ3B84aL3ysgSVaSTc2 Skg9g7fvsfzlTYxypKLEIackU+zI9OHvAkYp86j1qfmAdmEpy+il81TxApwYzgeJZGS HhIRw3DBuo91tQKV6L/tbfwlHTqWxK6pK4G0Dec6RtWNRt6zrPK0ing/hPd+RoDLaBC 6HHjI7oTlTVepPnwzFaRLTxkZzgQsntGwnVqvlElW341NTpjQQ2Re/g5I/7dxkHfyWE ph5Rpfa6y4I0B49PE+SvW8FDh7Uhmiz46gqbPWof4McqnXb8LckJz4NXYqVU/407evG 2NuUJEYw==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1592756766; bh=/ADre7Jkhrl56Q8h1gdOuumzPqlZpYISvvP8Rw6C7fU=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=vY1z14O2ujaOteGcL++pwClF4L47zHUmyiWAwUbY8I2ipRjKe2CqbJER2DhPPfNSMI kjaCia1UCIG+rQlJ6H71Ns/poA44nDeYKOaJB/ni9DvTXqnH/4bOk0BcnTOqlzJaqb9 kA4OAU0lexB5by7ciffbnQbwXqfz1/4wfuzIkbwBr3wb+D5uhsF0+ZAleO+M6vvKdNQ z0VZ0eBi1yzcSWh+JXR5MrGklWNGkPHg1OL9aUur2ejh7Xiq6Cwk6BNeBu2wIVlzOWn 1tHWlFijsYg+n0BrCpvxYWFyQ/mE8grXoqQ1q6rs9thtH2AJnyAe7VgFAn2YDG25DHb 92bO+F9w==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=g-case; h=reply-to:cc:subject:to:references:from:autocrypt:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/ADre7Jkhrl56Q8h1gdOuumzPqlZpYISvvP8Rw6C7fU=; b=CEhniNL/aM9IN/fypELjH0Z5DigWpS/Ud+aI3N+GLn/aeNfX25x8j7EYy6dvTeWJAe 3UXAyYsXXjq3JbojELYqjwrrmELVykN3AoTC47KHcVDWCsGDS2nbaPMr4ueGnyTyfEbB 3F7/SMvu52E1/cL4ahTyc0f5GT3fkR7VQmHCtUMLb8v1aqybyXZ2R2vid5gqQsUl5k1e 6nf3g8Z+RyDc8AcVEhKX0CRHYlYIdErC+oI4k6MyAu5HyGi9L9s1bF0i4+RIgzKo8LeR bm/iQqavVNahCJH5bhc8yphlKWhH/WUQVHYj8rV/oHTvW+6+2vKpFN8f3GJkHwT3AG04 umFA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/ADre7Jkhrl56Q8h1gdOuumzPqlZpYISvvP8Rw6C7fU=; b=OH1RC/ZZVhYYUNtW3AA2QfRNv+L4TCAalq3ty6lVqSH34YSY6kvPJMDKrVaeVr4/R4 qnUQ6/NAtVwraRiObAHVicPDqqc2RhmyPi5sNlA8L8ySMrdSnEl+6L0LsQbfmCSCenOO LWzEwqOCJJQMa7a7X+hxlVSB7ihaoCNg6RCLMQSjxJukdnYe1tlpFuGKvOYIq9Y2sDZk KMHUgOBV2511nB9R5dB30Ms5b1RQeEfMKorgo0EXMAbZN6k+Sg5PnDpGT/f0vR177hSX IncWqWqFwNwuFDcdzmsX/1I+FDWPDv0zIjJd9gAVv6s9Ga11olRpfS2LxlenXPdf1j2E CJvQ==
X-Gm-Message-State AOAM532NTS6CUYId0WYnlLd4GgG0Lr+5sHhGyVrqU2vNrboGNx1VlFEE T3JI5vU5jcePCwqKMBpOMMTApIhnORX07EEXa5UHUY4YG4depXWNi4ExTRzn4RenEAkjpDnQKun jC8eHb35h/y8=
X-Received by 2002:ae9:c113:: with SMTP id z19mr12277038qki.355.1592756765548; Sun, 21 Jun 2020 09:26:05 -0700 (PDT)
X-Google-Smtp-Source ABdhPJxiZvl5IDO13Il+yt71W0mKmdu2eAcr0bBIuhYEguU0g8Qyu/+kuLAcUg1QgXkqMkhQLls1+w==
X-Received by 2002:ae9:c113:: with SMTP id z19mr12277002qki.355.1592756765115; Sun, 21 Jun 2020 09:26:05 -0700 (PDT)
Autocrypt addr=chet.ramey@case.edu; prefer-encrypt=mutual; keydata= mQGiBEEOsGwRBACFa0A1oa71HSZLWxAx0svXzhOZNQZOzqHmSuGOG92jIpQpr8DpvgRh40Yp AwdcXb8QG1J5yGAKeevNE1zCFaA725vGSdHUyypHouV0xoWwukYO6qlyyX+2BZU+okBUqoWQ koWxiYaCSfzB2Ln7pmdys1fJhcgBKf3VjWCjd2XJTwCgoFJOwyBFJdugjfwjSoRSwDOIMf0D /iQKqlWhIO1LGpMrGX0il0/x4zj0NAcSwAk7LaPZbN4UPjn5pqGEHBlf1+xDDQCkAoZ/VqES GZragl4VqJfxBr29Ag0UDvNbUbXoxQsARdero1M8GiAIRc50hj7HXFoERwenbNDJL86GPLAQ OTGOCa4W2o29nFfFjQrsrrYHzVtyA/9oyKvTeEMJ7NA3VJdWcmn7gOu0FxEmSNhSoV1T4vP2 1Wf7f5niCCRKQLNyUy0wEApQi4tSysdz+AbgAc0b/bHYVzIf2uO2lIEZQNNt+3g2bmXgloWm W5fsm/di50Gm1l1Na63d3RZ00SeFQos6WEwLUHEB0yp6KXluXLLIZitEJLQwQ2hldCBSYW1l eSAoQ2FzZSBzdGFuZGFyZCkgPGNoZXQucmFtZXlAY2FzZS5lZHU+iF8EExECAB8FAkPi19EC GwMHCwkIBwMCAQMVAgMDFgIBAh4BAheAAAoJELtYafBk6nSrelkAn31Gsuib7GcCZHbv5L5t VKYR9LklAJ4hzUHKA49Z0QXR+qCb80osIcmPSbkBDQRBDrBvEAQAkK6TAOKBEM+EC4j6V/7o /riVZqcgU5cid2qG9TXdwNtD9a3kvA/ObZBO93sX59wc6Bnwo4VJxsOmMlpGrAjJsxNwg3QH akEtf8LXRbVpj5xStdmBdQZUhIQyalo/2/TZq5OijtddUQcL5cs70hTv/FpT3wUvr2Xr8rjF 41IFEz8AAwcD/A0CZEGlzIrT5WCBnl6xBog/8vKiUCbarByat3d1mL6DbizvKNXQRTC9E/vE dENAWCQCjr75Bu55xT8n3SXGtWdDC5xmZ/P3OBYORP8yl8H8I1FIosWOFirbIeYdZPq8SPD1 HL+EXo9zSiHVrrZRJ19ooCKKbSdXHFCY+aJG+0KZiEkEGBECAAkFAkEOsG8CGwwACgkQu1hp 8GTqdKvjcACfZlkVCDwaz/NTO9cy3t69oWpVPNwAnRwe0qk/WL/gfhH346xh5B3HFbFN
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.8.1
In-Reply-To <1592695979.4387.27.camel@16bits.net>
Content-Language en-US
X-Mirapoint-IP-Reputation reputation=Good-1, source=Queried, refid=tid=0001.0A020301.5EEF8053.001B, actions=tag
X-Mirapoint-IP-Reputation reputation=good-1, source=Fixed, refid=n/a, actions=tag
X-Junkmail-Status score=7/80, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw score=7/80, refid=2.7.2:2020.6.21.153018:17:7.944, ip=, rules=__YOUTUBE_RCVD, DKIM_SIGNATURE, __X_GOOGLE_DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __PHISH_SPEAR_SUBJ_PREDICATE, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __TO_MALFORMED_2, __MULTIPLE_RCPTS_TO_X2, __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, __URI_WITH_PATH, __URI_ENDS_IN_SLASH, __URI_NO_WWW, __CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __MAIL_CHAIN, __FORWARDED_MSG, __BODY_NO_MAILTO, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
Received-SPF pass client-ip=129.22.103.195; envelope-from=chet.ramey@case.edu; helo=mpv4-2015.case.edu
X-detected-operating-system by eggs.gnu.org: First seen = 2020/06/21 12:26:06
X-ACL-Warn Detected OS = Linux 2.4.x-2.6.x [generic]
X-Spam_score_int -43
X-Spam_score -4.4
X-Spam_bar ----
X-Spam_report (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action no action
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 <262f1d13-be7c-ee68-387b-53c39a5ad304@case.edu>
X-Mailman-Original-References <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt> <c2a567ac-2c9c-4ebf-f769-3aed25e679cb@iki.fi> <6BF29BAB-6F57-4D88-85BC-56E1AA14F29F@larryv.me> <4c262650-3c37-923f-53f1-358df8c0f9a1@case.edu> <1592695979.4387.27.camel@16bits.net>
Xref csiph.com gnu.bash.bug:16424

Show key headers only | View raw


On 6/20/20 7:32 PM, Ángel wrote:

> The hidden command "cd ." changed us into a completely different
> directory. Perhaps unexpected for the user (why did the bash version
> changed completely in the middle of a test run??).
> 
> Reading the above POSIX link, I would expect cd -P . not to have such
> side effect.
> 
> I read the instructions:
> 
>> 6. Set curpath to the directory operand.
>>
>> 7. If the -P option is in effect, proceed to step 10. If curpath does
>> not begin with a <slash> character, set curpath to the string formed
>> by the concatenation of the value of PWD, a <slash> character if the
>> value of PWD did not end with a <slash> character, and curpath.
> 
>> 10. The cd utility shall then perform actions equivalent to the
>> chdir() function called with curpath as the path argument.
>>
> (trimmed for clarity)
> 
> And would expect "cd -P ." to perform the equivalent of chdir("."),
> which should always leave you on the same folder you are in.

It does. The folder is the same, though its name might have changed if
the rename happens out from underneath the shell.

> However, it appears that it performs the concatenation even when -P is
> in effect.

How do you conclude this?

What it does do is part of step 10, which you trimmed.

"If the -P option is in effect, the PWD environment variable shall be set
to the string that would be output by pwd -P."

In the examples we've been using so far, what happens is that the
chdir(".") occurs, $PWD is discarded since it wasn't what `pwd -P' would
have output, the current working directory gets rebuilt using the
equivalent of getcwd(), and PWD is set to that.

Even if you don't rename the directory, $PWD can change in the presence of
symlinks, since `pwd -P' produces a physical path that doesn't contain any
symlinks.

-- 
``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


Thread

Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder. Chet Ramey <chet.ramey@case.edu> - 2020-06-21 12:26 -0400

csiph-web