From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16897 invoked by alias); 27 Sep 2005 15:46:06 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16835 invoked by uid 22791); 27 Sep 2005 15:45:57 -0000 Received: from dumbledore.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.11) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 27 Sep 2005 15:45:57 +0000 Received: (qmail 2074 invoked from network); 27 Sep 2005 15:45:55 -0000 Received: from unknown (HELO ?192.168.0.4?) (mitchell@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Sep 2005 15:45:55 -0000 Message-ID: <43396939.4030602@codesourcery.com> Date: Tue, 27 Sep 2005 15:46:00 -0000 From: Mark Mitchell User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: DJ Delorie CC: gdb@sources.redhat.com, gdb-patches@sources.redhat.com, ian@airs.com Subject: Re: PATCH: Do not call xmalloc_failed in expandargv References: <200509271451.j8REpKeg029702@sethra.codesourcery.com> <200509271540.j8RFeBbf016490@greed.delorie.com> In-Reply-To: <200509271540.j8RFeBbf016490@greed.delorie.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-09/txt/msg00251.txt.bz2 DJ Delorie wrote: > I seem to recall a general policy (before my time) that libiberty > functions shouldn't ever exit on error; the proper response is to > return some error condition to the application. Since expandargv() > doesn't have an error response, IMHO the right thing to do is treat > @foo as if it weren't a file and just return the original argv[n]. > The application will hopefully discover the out of memory condition > itself and use its own handlers to deal with it. xmalloc is in libiberty, and it calls xmalloc_failed when it fails, which itself calls xexit. That's the source of the idiom; I was just trying to be consistent. I can make the change that you suggest, if you think it's important, but it seems more friendly to the user to just tell them early that there was a problem; the application won't know if "@foo" remains in the argument list because there was no such file "foo" or because it happened to be too big. In the latter case, the program should exit; in the former, we've agreed that "@foo" should be treated as a literal command-line argument. -- Mark Mitchell CodeSourcery, LLC mark@codesourcery.com (916) 791-8304