X-Spam-Check-By: sourceware.org Message-ID: <43C29D64.6EA16960@dessent.net> Date: Mon, 09 Jan 2006 09:29:08 -0800 From: Brian Dessent MIME-Version: 1.0 CC: cygwin AT cygwin DOT com Subject: Re: bash -c error References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Krzysztof Duleba wrote: > $ bash -c time > Segmentation fault (core dumped) > > $ uname -a > CYGWIN_NT-5.1 DULI2 1.5.19s(0.141/4/2) 20051020 10:37:08 i686 unknown > unknown Cygwin This looks like a bash bug. It looks like only 3.0 is affected, as it works fine in 3.1. Since 'time' is a builtin, it appears to be a bug in trying to run time with an empty parameter: (gdb) bt #0 0x610d50e1 in strlen () at ../../../../src/winsup/cygserver/client.cc:464 #1 0x00414712 in execute_simple_command (simple_command=0x626560, pipe_in=-1, pipe_out=-1, async=0, fds_to_close=0x626578) at /usr/src/bash-3.0/execute_cmd.c:2729 #2 0x00411203 in execute_command_internal (command=0x626548, asynchronous=0, pipe_in=-1, pipe_out=-1, fds_to_close=0x626578) at /usr/src/bash-3.0/execute_cmd.c:667 #3 0x00411cdc in time_command (command=0x626548, asynchronous=0, pipe_in=-1, pipe_out=-1, fds_to_close=0x626578) at /usr/src/bash-3.0/execute_cmd.c:1097 #4 0x00410fb3 in execute_command_internal (command=0x626548, asynchronous=0, pipe_in=-1, pipe_out=-1, fds_to_close=0x626578) at /usr/src/bash-3.0/execute_cmd.c:589 #5 0x00449baf in parse_and_execute (string=0x6260d0 "time", from_file=0x46812c "-c", flags=4) at /usr/src/bash-3.0/builtins/evalstring.c:267 #6 0x004026c0 in run_one_command (command=0x6115b514 "time") at /usr/src/bash-3.0/shell.c:1259 #7 0x00401848 in main (argc=3, argv=0x6115b4b4, env=0x620090) at /usr/src/bash-3.0/shell.c:643 The problem is this in execute_cmd.c: 2728 FREE (the_printed_command_except_trap); 2729 the_printed_command_except_trap = savestring (the_printed_command); where 'the_printed_command_except_trap' is NULL and savestring() is ./lib/readline/histlib.h:37:#ifndef savestring ./lib/readline/histlib.h:38:#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x)) ./lib/readline/histlib.h-39-#endif Hence, strlen(NULL). Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/