From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124054 invoked by alias); 16 Jun 2015 15:00:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 123515 invoked by uid 89); 16 Jun 2015 15:00:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-oi0-f43.google.com Received: from mail-oi0-f43.google.com (HELO mail-oi0-f43.google.com) (209.85.218.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 16 Jun 2015 15:00:27 +0000 Received: by oiha141 with SMTP id a141so13293378oih.0 for ; Tue, 16 Jun 2015 08:00:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=9PeiNxP+4L4MUujCnG5339wEM/h6zabkT1iqODmlGls=; b=F8HHmMmDwZxubPQOyCf3/wa0I2r+qaNC5TggVQH5kNGr7To0abMVb4g9oX9u0Jc8hP KK1i62uRGNOB8tNODbfGqBZoG6Rs6hHPQwzPlNiARHWdRjxu5Db3curAsw1CSfiLt23a c/SmXFFY1HhtCbo0Ao9q82LwB5ZnZJMf4ELAhL1P+RtVUB4A8lUOSNmNO+EOzWKabxNq 50fm+ykVh3cNXweYjHvkVc1ClA38UcQMUHrUNb7K8T1Mc0anzjhBzH5N0QcxC6q7PYxj 65pSRT14xr6RkiAzyvLpS5Rb7KPAXCpUqcbHspBuIJSyEE31zTjA2UhbUvRpg+h0+naN 11rA== X-Gm-Message-State: ALoCoQlgIYEQo7qS1swLPDE5irzILqyYTKlUg6NETR094XaJOkVsEftgS+8fH8UI5Xb0I7QDEMQ4 X-Received: by 10.60.130.167 with SMTP id of7mr616406oeb.85.1434466825250; Tue, 16 Jun 2015 08:00:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.96.167 with HTTP; Tue, 16 Jun 2015 08:00:04 -0700 (PDT) In-Reply-To: <1434466413-28892-1-git-send-email-patrick@parcs.ath.cx> References: <1433878062-23560-1-git-send-email-patrick@parcs.ath.cx> <1434466413-28892-1-git-send-email-patrick@parcs.ath.cx> From: Patrick Palka Date: Tue, 16 Jun 2015 15:00:00 -0000 Message-ID: Subject: Re: [PATCH] Don't truncate the history file when history size is unlimited To: "gdb-patches@sourceware.org" Cc: Patrick Palka Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-06/txt/msg00349.txt.bz2 On Tue, Jun 16, 2015 at 10:53 AM, Patrick Palka wrote: > We still do not handle "set history size unlimited" correctly. In > particular, after writing to the history file, we truncate the history > even if it is unlimited. > > This patch makes sure that we do not call history_truncate_file() if the > history is not stifled (i.e. if it's unlimited). This bug causes the > history file to be truncated to zero on exit when one has "set history > size unlimited" in their gdbinit file. Although this code exists in GDB > 7.8, the bug is masked by a pre-existing bug that's been only fixed in > GDB 7.9 (PR gdb/17820). > > gdb/ChangeLog: > > * top.c (gdb_safe_append_history): Do not call > history_truncate_file if the history is not stifled. > > gdb/testsuite/ChangeLog: > > * gdb.base/gdbinit-history.exp: Add test case to check that > an unlimited history file does not get truncated on exit. I had written some extra stuff in the commit message within the patch file itself and then I overwritten it by running "git format-patch" again... This is basically what I wrote: The reason I had so much trouble with writing the test case because I failed to realize that there are two code paths for writing to the history file: one for writing to a non-existing history file (i.e. creating one) and one for appending to an existing history file. The bug only manifests itself when appending to the history file, not when writing to it. Thus the test has to stop/start GDB twice in order to run both code paths and to trigger the bug. By the way, what do you think about unsetting HOME/HISTSIZE/GDBHISTFILE somewhere higher up in the testsuite infrastructure? It would be nice if individual tests did not have to worry about such environment variables being leaked from userspace.