From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by sourceware.org (Postfix) with ESMTPS id 74DCA394841C for ; Tue, 26 May 2020 16:38:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 74DCA394841C Received: by mail-qt1-x844.google.com with SMTP id k22so1850587qtm.6 for ; Tue, 26 May 2020 09:38:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JhgXGTpNFO4o5M2ScyjMBYoVjrcmr2HUv2+DFKheqD8=; b=WJVm76JCJD7yEcSN9FZHW1yhg7uYPx58EBSDu5Dz1DzmYtiRrC32dhImqppT7TV/tq TX1EybDXZDs8KO9LI/gxlVx+zjU5YFUq5snWtp/k3oa+OMZTM89kXzW6VztztTMt0Seq lA5wxuI5EN8+9CwYH/34W+bbi/NgehH0fKOd1JCNpo6DyHByJ0suupof1GRSBJbWbeXu LUTEa5yEIIe5BYQ0zeFvD9+qkssmrfAFQn3+wPYpRW0lM0UUeFslCoKu9vm9NmdZNnfH pWNNNnArajeRclRAFa4lr+HoJUpZJlJgg+COMQITwwajEnZSoTxN4N4oZJbUHNolgM0+ DXZQ== X-Gm-Message-State: AOAM533ZfpE5i9g7Sb6hizt9pFToaoGoHIk1DiIoph17I6CgVPFEp0b0 kvtd1vqHYKWvDvo+HYGJTBjwDsqDPE+8EreaILPmaQ== X-Google-Smtp-Source: ABdhPJzou480JNiOjm57GknBkOdKVGicAm234Ccia/Oi4NHg8g4snwqhMlYgPntIXpAD7JRDKNDZEEr6Qlt+cADiTj0= X-Received: by 2002:ac8:3f77:: with SMTP id w52mr2096761qtk.161.1590511085715; Tue, 26 May 2020 09:38:05 -0700 (PDT) MIME-Version: 1.0 References: <20200525185659.59346-1-ssbssa@yahoo.de> <20200525185659.59346-6-ssbssa@yahoo.de> In-Reply-To: <20200525185659.59346-6-ssbssa@yahoo.de> From: Christian Biesinger Date: Tue, 26 May 2020 11:37:29 -0500 Message-ID: Subject: Re: [PATCH 5/7] Close file handle of empty history file To: Hannes Domani Cc: gdb-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-24.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2020 16:38:07 -0000 On Mon, May 25, 2020 at 1:58 PM Hannes Domani via Gdb-patches wrote: > > Happened while trying to reproduce a gdb.base/gdbinit-history.exp failure: > warning: Could not rename C:/gdb/build64/gdb-git/gdb/testsuite/outputs/gdb.base/gdbinit-history/gdbinit-history.gdb_history to C:/gdb/build64/gdb-git/gdb/testsuite/outputs/gdb.base/gdbinit-history/gdbinit-history.gdb_history-gdb5228~: Permission denied > > I had an empty gdbinit-history.gdb_history-gdb5228~ file, and the file > handle was not closed on startup, so it couldn't rename it at the end > when trying to write a new one. Readline has an upstream repository, please send the patch to them as well at bug-readline@gnu.org. https://tiswww.case.edu/php/chet/readline/rltop.html Also add the change to readline/README per the instructions in there. Not sure if ChangeLog needs/should be updated. Christian > > readline/readline/ChangeLog: > > 2020-05-25 Hannes Domani > > * histfile.c (read_history_range): Close file handle. > --- > readline/readline/histfile.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/readline/readline/histfile.c b/readline/readline/histfile.c > index dc64bde1c5..a8a92aa360 100644 > --- a/readline/readline/histfile.c > +++ b/readline/readline/histfile.c > @@ -305,6 +305,7 @@ read_history_range (const char *filename, int from, int to) > if (file_size == 0) > { > free (input); > + close (file); > return 0; /* don't waste time if we don't have to */ > } > > -- > 2.26.2 >