Message ID | 20190607062719.10989-1-orgads@gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 117500 invoked by alias); 7 Jun 2019 06:27:29 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 117438 invoked by uid 89); 7 Jun 2019 06:27:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail-wm1-f68.google.com Received: from mail-wm1-f68.google.com (HELO mail-wm1-f68.google.com) (209.85.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Jun 2019 06:27:28 +0000 Received: by mail-wm1-f68.google.com with SMTP id u8so708463wmm.1 for <gdb-patches@sourceware.org>; Thu, 06 Jun 2019 23:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=upWxmSVpqLQ7zA0P9K/mL7F8Y7QRrZgtW+/BTnSYj2I=; b=Vn4htMvq7/0omouAdnVyeG2F9SSxYsrtkviCgzIdHQKnWldqEnVLiOjqtX3r+qCCRy E45DUawZ2wcVQvY5bkY6zB/Es3eVxCkJzUx2+9+QrknXOdMQMjNCahxLBSp/JByNTrln QPaJvovg46ARL9B+dn+lPdhPZpsKPp3tdW11QOBtpbDY8fUojT2zaXbCutLEqG783OFg XKy7AxirZ0dAlk6ITUB+yIhLN12o/NmYAMVOmkP/47eiAy/KH6JEO3xUPRPDpe0/Y5Yo PFMvu2zRAPNGSecYN65O6KbSOX7jSy7WX0JeLY9/a5XjbiIVnAtOusjOt3ZsX3dkM3H6 U6BQ== Return-Path: <orgads@gmail.com> Received: from junior.corp.audiocodes.com ([164.138.127.164]) by smtp.gmail.com with ESMTPSA id h90sm2696437wrh.15.2019.06.06.23.27.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 06 Jun 2019 23:27:25 -0700 (PDT) From: orgads@gmail.com To: gdb-patches@sourceware.org Cc: Orgad Shaneh <orgads@gmail.com> Subject: [PATCH] Fix cache dir resolving on Windows Date: Fri, 7 Jun 2019 09:27:19 +0300 Message-Id: <20190607062719.10989-1-orgads@gmail.com> In-Reply-To: <20190603193716.4861-1-orgads@gmail.com> References: <20190603193716.4861-1-orgads@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Commit Message
Orgad Shaneh
June 7, 2019, 6:27 a.m. UTC
From: Orgad Shaneh <orgads@gmail.com>
... when not running from MSYS environment, and HOME is not set.
---
gdb/common/pathstuff.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
> From: orgads@gmail.com > Cc: Orgad Shaneh <orgads@gmail.com> > Date: Fri, 7 Jun 2019 09:27:19 +0300 > > From: Orgad Shaneh <orgads@gmail.com> > > ... when not running from MSYS environment, and HOME is not set. > --- > gdb/common/pathstuff.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c > index 2b1669a5b9..59410fb61f 100644 > --- a/gdb/common/pathstuff.c > +++ b/gdb/common/pathstuff.c > @@ -231,6 +231,10 @@ get_standard_cache_dir () > #endif > > const char *home = getenv ("HOME"); > +#ifdef _WIN32 > + if (home == nullptr) > + home = getenv ("APPDATA"); > +#endif > if (home != NULL) > { > /* Make sure the path is absolute and tilde-expanded. */ Thanks, this LGTM.
> Date: Fri, 07 Jun 2019 10:36:39 +0300 > From: Eli Zaretskii <eliz@gnu.org> > CC: gdb-patches@sourceware.org > > > const char *home = getenv ("HOME"); > > +#ifdef _WIN32 > > + if (home == nullptr) > > + home = getenv ("APPDATA"); > > +#endif > > if (home != NULL) > > { > > /* Make sure the path is absolute and tilde-expanded. */ > > Thanks, this LGTM. Actually, I see that we mention HOME on Windows in the manual, in a footnote that's part of the "Startup" node. I think we should document this addition there. Would you like to add a change to the manual as well? Thanks. P.S. I see that you don't have a copyright assignment on file, which means we are limited in the amount of changes we can accept from you. Would you like to start the legal paperwork of assigning to the FSF the copyright for your changes? If so, I will send you the form to fill.
> From: Orgad Shaneh <orgads@gmail.com> > Date: Fri, 7 Jun 2019 11:58:45 +0300 > > On Fri, Jun 7, 2019 at 11:01 AM Eli Zaretskii <eliz@gnu.org> wrote: > > Actually, I see that we mention HOME on Windows in the manual, in a > > footnote that's part of the "Startup" node. I think we should > > document this addition there. Would you like to add a change to the > > manual as well? > > This refers to gdbinit, which probably should also be added a fallback > to APPDATA. Anyway, it is not related to this patch, which is about > the cache directory. Oh, so we probe $HOME in more than one place? Yes, I think we should do this in all of those places, preferably through a single function. > > P.S. I see that you don't have a copyright assignment on file, which > > means we are limited in the amount of changes we can accept from you. > > Would you like to start the legal paperwork of assigning to the FSF > > the copyright for your changes? If so, I will send you the form to > > fill. > > Sure. Thanks, form sent off-list.
>> +#ifdef _WIN32 >> + if (home == nullptr) >> + home = getenv ("APPDATA"); I think the assignment line is indented a bit too far -- should be 2 spaces over from the "if", per the GNU style. thanks, Tom
diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c index 2b1669a5b9..59410fb61f 100644 --- a/gdb/common/pathstuff.c +++ b/gdb/common/pathstuff.c @@ -231,6 +231,10 @@ get_standard_cache_dir () #endif const char *home = getenv ("HOME"); +#ifdef _WIN32 + if (home == nullptr) + home = getenv ("APPDATA"); +#endif if (home != NULL) { /* Make sure the path is absolute and tilde-expanded. */