Issues in option handling (Was: break no longer breaks out of loops defined in an outer context)

2017-03-07 Thread Stephane Chazelas
2017-03-03 08:27:03 -0500, Chet Ramey:
> On 3/1/17 4:58 PM, Stephane Chazelas wrote:
> 
> > BTW, there seems to have been a regression in the handling of the -O
> > option to the bash interpreter:
> 
> Thanks, I'll take a look.  It looks to be specific to the various
> compat* options.
[...]

See also:

$ POSIXLY_CORRECT=1 bash -c 'set +o posix; set +o' | grep posix
set +o posix
$ POSIXLY_CORRECT=1 bash +o posix -c 'set +o' | grep posix
set -o posix

(not a regression, already in 4.3)

I'd expect explicit command line options to take precedence over
the environment.

Another oddity:

$ env SHELLOPTS= bash -o posix -c :
$ env SHELLOPTS= bash +o posix -c :
bash: SHELLOPTS: readonly variable

-- 
Stephane



popd with garbage parameter removes entry from dirs but doesn't cd.

2017-03-07 Thread gazelle
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib  -D_FORTIFY_SOURCE=2 -g 
-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security -Wall
uname output: Linux shell 3.13.0-111-generic #158-Ubuntu SMP Wed Feb 22 
16:12:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.3
Patch Level: 11
Release Status: release

Description:
popd with garbage parameter removes entry from dirs but doesn't cd.
Example: popd lsdfjlskfj

Repeat-By:
cd /some/directory
pushd /tmp
dirs
popd skdfhksjdfhkjsdf
pwd;dirs

Fix:
I assume it should generate an error message for the garbage parameter
and not change the contents of the directory stack.




Re: popd with garbage parameter removes entry from dirs but doesn't cd.

2017-03-07 Thread John McKown
On Tue, Mar 7, 2017 at 8:28 AM,  wrote:

> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib
> -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4
> -Wformat -Werror=format-security -Wall
> uname output: Linux shell 3.13.0-111-generic #158-Ubuntu SMP Wed Feb 22
> 16:12:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.3
> Patch Level: 11
> Release Status: release
>
> Description:
> popd with garbage parameter removes entry from dirs but doesn't cd.
> Example: popd lsdfjlskfj
>
> Repeat-By:
> cd /some/directory
> pushd /tmp
> dirs
> popd skdfhksjdfhkjsdf
> pwd;dirs
>
> Fix:
> I assume it should generate an error message for the garbage
> parameter
> and not change the contents of the directory stack.


​It appears to be fixed on or before release 4.4.​43

[transcript]

[tsh009@it-johnmckown-linux ~]$ pushd /tmp
/tmp ~
[tsh009@it-johnmckown-linux tmp]$ dirs
/tmp ~
[tsh009@it-johnmckown-linux tmp]$ popd bubba;echo $?;dirs
bash: popd: bubba: invalid argument
popd: usage: popd [-n] [+N | -N]
2
/tmp ~
[tsh009@it-johnmckown-linux tmp]$ bash --version
GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[tsh009@it-johnmckown-linux tmp]$


[/transcript]




-- 
"Irrigation of the land with seawater desalinated by fusion power is
ancient. It's called 'rain'." -- Michael McClary, in alt.fusion

Maranatha! <><
John McKown


Re: popd with garbage parameter removes entry from dirs but doesn't cd.

2017-03-07 Thread Chet Ramey
On 3/7/17 6:28 AM, gaze...@xmission.com wrote:

> Description:
>   popd with garbage parameter removes entry from dirs but doesn't cd.
>   Example: popd lsdfjlskfj
> 
> Repeat-By:
>   cd /some/directory
>   pushd /tmp
>   dirs
>   popd skdfhksjdfhkjsdf
>   pwd;dirs

This was changed to print an error message about an invalid argument
before bash-4.3 was released.

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



Re: Full-width characters can result in an unwanted space in filenames

2017-03-07 Thread Chet Ramey
On 3/3/17 9:53 PM, Misaki wrote:

> 15 Mar 2015
> bash bug
> Full-width character, followed by at least one full word with a space after 
> it.
> 
> Example: あa a
> 
> With trailing space.
> 
> Typing before the full-width character causes the 'あ' to be pushed to next
> line, with a blank space on previous line though if selected and copied it
> will actually produce a space.
> 
> The 'あ' occupies two columns on the new line, but characters after the
> first a are only moved one column to the right. The first a, or the first
> character after the 'あ' including a space, is pushed two columns to the
> right, covering the second character after the 'あ'.
> 
> A similar bug occurs when deleting characters before the 'あ', except no
> trailing space is required. A character is duplicated but might be first
> letter of first word on second line, or last letter of next word.
> Duplicating one letter as soon as 'あ' goes to previous line is easy to
> replicate; duplicating other letters as further characters before 'あ' are
> deleted might only happen after resetting the line using up arrow then down
> arrow, but actually just because of forward bug because displayed
> characters change after pressing up then down. Second word on line only
> seems to be affected if no other words after it.

This should be fixed in the next devel branch push. Thanks for the report
with the reproducible test case.

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