Re: Command substitution reduce spaces even in strings

2009-12-09 Thread Marc Herbert
ma...@fiz15.jupiter.vein.hu a écrit :
> Short example:

> $ echo $(echo "'alfa  beta'")
> 'alfa beta'
> 
> Instead of 'alfa  beta' with double space.

Always try tracing to understand what is going on:

echo $(set -x ;echo "'alfa  beta'")

++ echo ''\''alfa  beta'\'''


http://www.mpi-inf.mpg.de/~uwe/lehre/unixffb/quoting-guide.html





Re: bash segfaults on startup when TERM=eterm* and EMACS is unset

2009-12-09 Thread Roman Rakus

On 10/29/2009 10:35 AM, Roman Rakus wrote:
$subject can be triggered easily by setting TERM to eterm (with unset 
EMACS). Originally this segfault was caused by running emacs and 
within emacs try to ssh on localhost.


Reproducer 1)
[rra...@dhcp-lab-170 ~]$ bash
[rra...@dhcp-lab-170 ~]$ exit
[rra...@dhcp-lab-170 ~]$ env TERM=eterm bash
Segmentation fault
[rra...@dhcp-lab-170 ~]$ env TERM=eterm-sldkhflsad bash
Segmentation fault

Reproducer 2)
1. Start emacs on some machine.
2. M-x ansi-term
3. 'echo $TERM' to verify that it's eterm-color or eterm
4. 'ssh F11HOST' (where F11HOST is a machine with bash 4.0 installed
and set as your shell)
5. Observe the connection being closed instead of receiving a prompt.

Following patch hinders segfault:

--- bash-4.0/shell.c.orig2009-10-15 15:57:56.0 -0400
+++ bash-4.0/shell.c2009-10-15 15:58:28.0 -0400
@@ -572,7 +572,7 @@

   /* running_under_emacs == 2 for `eterm' */
   running_under_emacs = (emacs != 0) || (term&&  STREQN (term, 
"emacs", 5));
-  running_under_emacs += term&&  STREQN (term, "eterm", 5)&&  
strstr (emacs, "term");
+  running_under_emacs += term&&  STREQN (term, "eterm", 5)&&  
(emacs != 0)&&  strstr (emacs, "term");


   if (running_under_emacs)
 gnu_error_format = 1;


RR



Any updates/comments here?
RR




Error on meta-{ filename expansion

2009-12-09 Thread Jeff Terrell

(pasted this in from dead.bashbug when the mail failed.)

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' - 
DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' - 
DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' - 
DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/ 
lib   -g -O2 -Wall
uname output: Linux art 2.6.24-23-generic #1 SMP Mon Jan 26 00:13:11  
UTC 2009 i686 GNU/Linux

Machine Type: i486-pc-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description:
The meta-{ command should automatically expand filenames that match the
current prefix into a {,,,} list.  I found a test case for which this
does not work correctly.

Repeat-By:
$ mkdir tmp; cd tmp
$ cat | xargs touch  # paste the following lines in; terminate with ^d
app-controllers-account_reminders_controller_rb.html
app-controllers-accounts_controller_rb.html
app-controllers-account_settings_controller_rb.html
app-controllers-application_rb.html
app-controllers-backup_aging_controller_rb.html
app-controllers-backup_verification_controller_rb.html
app-controllers-controller_represents_rb.html
app-controllers-dashboard_controller_rb.html
app-controllers-domains_controller_rb.html
app-controllers-file_spaces_controller_rb.html
app-controllers-help_pages_controller_rb.html
app-controllers-licenses_controller_rb.html
app-controllers-logs_controller_rb.html
app-controllers-nodes_controller_rb.html
app-controllers-node_test_cases_controller_rb.html
app-controllers-platforms_controller_rb.html
app-controllers-preferences_controller_rb.html
app-controllers-rubyamf_controller_rb.html
app-controllers-sessions_controller_rb.html
app-controllers-storage_visualizer_controller_rb.html
app-controllers-support_controller_rb.html
app-controllers-sweeps_controller_rb.html
app-controllers-tsm_servers_controller_rb.html
^d
$ rm   # expands to a long list of filenames
rm: cannot remove `app-controllers-account__controller_rb.html': No such
file or directory
$ rm   # expands to: app-controllers-accounts_controller_rb.html


Thanks,
-Jeff T.





Re: bash segfaults on startup when TERM=eterm* and EMACS is unset

2009-12-09 Thread Chet Ramey
> On 10/29/2009 10:35 AM, Roman Rakus wrote:
> > $subject can be triggered easily by setting TERM to eterm (with unset 
> > EMACS). Originally this segfault was caused by running emacs and 
> > within emacs try to ssh on localhost.
> >
> >
> Any updates/comments here?

This will be fixed in the next version of bash.  The supplied patch is
essentially correct.

Chet

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




Re: Error on meta-{ filename expansion

2009-12-09 Thread DennisW
On Dec 9, 10:05 am, Jeff Terrell  wrote:
> (pasted this in from dead.bashbug when the mail failed.)
>
> Configuration Information [Automatically generated, do not change]:
> Machine: i486
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -
> DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -
> DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -
> DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/
> lib   -g -O2 -Wall
> uname output: Linux art 2.6.24-23-generic #1 SMP Mon Jan 26 00:13:11  
> UTC 2009 i686 GNU/Linux
> Machine Type: i486-pc-linux-gnu
>
> Bash Version: 3.2
> Patch Level: 39
> Release Status: release
>
> Description:
> The meta-{ command should automatically expand filenames that match the
> current prefix into a {,,,} list.  I found a test case for which this
> does not work correctly.
>
> Repeat-By:
> $ mkdir tmp; cd tmp
> $ cat | xargs touch  # paste the following lines in; terminate with ^d
> app-controllers-account_reminders_controller_rb.html
> app-controllers-accounts_controller_rb.html
> app-controllers-account_settings_controller_rb.html
> app-controllers-application_rb.html
> app-controllers-backup_aging_controller_rb.html
> app-controllers-backup_verification_controller_rb.html
> app-controllers-controller_represents_rb.html
> app-controllers-dashboard_controller_rb.html
> app-controllers-domains_controller_rb.html
> app-controllers-file_spaces_controller_rb.html
> app-controllers-help_pages_controller_rb.html
> app-controllers-licenses_controller_rb.html
> app-controllers-logs_controller_rb.html
> app-controllers-nodes_controller_rb.html
> app-controllers-node_test_cases_controller_rb.html
> app-controllers-platforms_controller_rb.html
> app-controllers-preferences_controller_rb.html
> app-controllers-rubyamf_controller_rb.html
> app-controllers-sessions_controller_rb.html
> app-controllers-storage_visualizer_controller_rb.html
> app-controllers-support_controller_rb.html
> app-controllers-sweeps_controller_rb.html
> app-controllers-tsm_servers_controller_rb.html
> ^d
> $ rm   # expands to a long list of filenames
> rm: cannot remove `app-controllers-account__controller_rb.html': No such
> file or directory
> $ rm   # expands to: app-controllers-accounts_controller_rb.html
>
> Thanks,
> -Jeff T.

Works as expected in Bash 4.0.33(1)-release.


Re: Error on meta-{ filename expansion

2009-12-09 Thread DennisW
On Dec 9, 10:05 am, Jeff Terrell  wrote:
> (pasted this in from dead.bashbug when the mail failed.)
>
> Configuration Information [Automatically generated, do not change]:
> Machine: i486
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -
> DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -
> DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -
> DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/
> lib   -g -O2 -Wall
> uname output: Linux art 2.6.24-23-generic #1 SMP Mon Jan 26 00:13:11  
> UTC 2009 i686 GNU/Linux
> Machine Type: i486-pc-linux-gnu
>
> Bash Version: 3.2
> Patch Level: 39
> Release Status: release
>
> Description:
> The meta-{ command should automatically expand filenames that match the
> current prefix into a {,,,} list.  I found a test case for which this
> does not work correctly.
>
> Repeat-By:
> $ mkdir tmp; cd tmp
> $ cat | xargs touch  # paste the following lines in; terminate with ^d
> app-controllers-account_reminders_controller_rb.html
> app-controllers-accounts_controller_rb.html
> app-controllers-account_settings_controller_rb.html
> app-controllers-application_rb.html
> app-controllers-backup_aging_controller_rb.html
> app-controllers-backup_verification_controller_rb.html
> app-controllers-controller_represents_rb.html
> app-controllers-dashboard_controller_rb.html
> app-controllers-domains_controller_rb.html
> app-controllers-file_spaces_controller_rb.html
> app-controllers-help_pages_controller_rb.html
> app-controllers-licenses_controller_rb.html
> app-controllers-logs_controller_rb.html
> app-controllers-nodes_controller_rb.html
> app-controllers-node_test_cases_controller_rb.html
> app-controllers-platforms_controller_rb.html
> app-controllers-preferences_controller_rb.html
> app-controllers-rubyamf_controller_rb.html
> app-controllers-sessions_controller_rb.html
> app-controllers-storage_visualizer_controller_rb.html
> app-controllers-support_controller_rb.html
> app-controllers-sweeps_controller_rb.html
> app-controllers-tsm_servers_controller_rb.html
> ^d
> $ rm   # expands to a long list of filenames
> rm: cannot remove `app-controllers-account__controller_rb.html': No such
> file or directory
> $ rm   # expands to: app-controllers-accounts_controller_rb.html
>
> Thanks,
> -Jeff T.

That was under Ubuntu 9.10 for Bash 4.0.33(1)-release, by the way.

It also works for me under cygwin in Bash 3.2.49(23)-release.

One thing I noticed is that the error message for rm has two
underscores in a row. Is that just a typo (or "pasto")?