From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10542 invoked by alias); 7 Jun 2005 19:23: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 10468 invoked by uid 22791); 7 Jun 2005 19:23:00 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 07 Jun 2005 19:23:00 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j57JMxI6026665; Tue, 7 Jun 2005 15:22:59 -0400 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j57JMwO09292; Tue, 7 Jun 2005 15:22:58 -0400 Received: from [172.31.0.98] (vpnuser7.surrey.redhat.com [172.16.9.7]) by pobox.surrey.redhat.com (8.12.8/8.12.8) with ESMTP id j57JMvLZ006926; Tue, 7 Jun 2005 20:22:57 +0100 Message-ID: <42A5F497.5080900@redhat.com> Date: Tue, 07 Jun 2005 19:23:00 -0000 From: Nick Clifton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) MIME-Version: 1.0 To: Mark Mitchell CC: binutils@sources.redhat.com, gdb-patches@sources.redhat.com Subject: Re: PATCH: Avoid accidentally opening files for write References: <200506070717.j577HNq4006430@sethra.codesourcery.com> <42A566C9.4040500@redhat.com> <42A5C2EA.3070906@codesourcery.com> In-Reply-To: <42A5C2EA.3070906@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-06/txt/msg00058.txt.bz2 Hi Mark, >> patch to a generic part of BFD it would be good if you could also test >> with a --enable-targets=all build, just to make sure. > I didn't know about that, but will try it before check-in. Thanks. > Just a build, or should I try to run some kind of testsuite as well? Just a build, since there will no binutils executable which will exercise the new code anyway. (You could run a GDB testsuite with a patched GDB linked against the BFD library built for an all targets toolchain but I think that is needlessly paranoid). > (Is there a way to run the binutils testuite on all targets all at once?) Not really. You can run the binutils testsuites with an all-targets toolchain but it will just check the toolchain's default target, not all of the targets it can possibly support. >> This assumes that the contents of 'mode' are well defined. Is this >> the case for non-POSIX environments ? For example can we be sure that >> the character 'R' is never used to indicate read-only status, or that >> an OS might allow a file created with just "a" to have the >> newly-written-to parts read back, effectively making "a" a >> read-and-write mode ? What I am getting at is, should bfd_fopen() >> take an explicit extra parameter which tells BFD whether this file is >> intended for reading, writing or both ? > > > Hmm. In practice, we always use one of the FOPEN_* macros as an > argument, and these do follow the rules implied by what I wrote. But, I > could tighten the test to check for just what ISO C requires, which is > that the characters must occur at the start of the string, so using > strchr is probably incorrect. OK to make that change before check-in, > or would you like me to resubmit? No please just make the change before check-in. > I'm not aware of OSes that do as you say, but, in any case, I don't > think we need to worry about OSes that accept other variations. Clients > of BFD should be using the standard syntax. It's OK if they use OS > extensions, but I think it's reasonable to say that if they mean "read" > they use "r" and not "R". Fair enough. Cheers Nick