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


Groups > gnu.bash.bug > #16660

Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode
Date 2020-07-31 10:03 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.381.1596204216.2739.bug-bash@gnu.org> (permalink)
References (3 earlier) <8ddc4816-f85e-97b3-5c51-9b55acdcaca5@case.edu> <CAH7i3LpXfj3p5tXS_4S_dxdvdLG_tNyBa-4bU=z0Xih1=Tr7OA@mail.gmail.com> <26757.1595233713@jinx.noi.kre.to> <7963.1596120220@jinx.noi.kre.to> <c994a502-9804-c057-557f-fd60e010304d@case.edu>

Show all headers | View raw


On 7/30/20 10:43 AM, Robert Elz wrote:
>     Date:        Mon, 20 Jul 2020 10:11:59 -0400
>     From:        Chet Ramey <chet.ramey@case.edu>
>     Message-ID:  <a62804af-8c7f-5191-362b-ef5f4d7b3db8@case.edu>
> 
> Sorry, didn't reply to this at the time...
> 
>   | You can make a case for the bash/ksh tilde expansion: the word
>   | expansion is ${PARAM:=WORD}, and the WORD is subject to tilde expansion
>   | according to the enumerated list in 2.6.2.
> 
> Sure. but ...
> 
>   | Since the first character of WORD is a tilde, if you say the
>   | tilde-prefix stops at the `:',
> 
> but that's true (in posix) only in an assignment.   Either it is an
> assignment, or it is not. 

It's not an assignment. Not according to the POSIX definition of a variable
assignment.

The terminating the tilde prefix at `:' is a bash extension. POSIX allows
it because the behavior is undefined if the tilde prefix doesn't form a
valid login name. Call it a bug if you like, but it's been there since at
least bash-1.10.

-- 
``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: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode Chet Ramey <chet.ramey@case.edu> - 2020-07-31 10:03 -0400

csiph-web