From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31702 invoked by alias); 15 Apr 2014 17:37:25 -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 31689 invoked by uid 89); 15 Apr 2014 17:37:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yh0-f74.google.com Received: from mail-yh0-f74.google.com (HELO mail-yh0-f74.google.com) (209.85.213.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 15 Apr 2014 17:37:23 +0000 Received: by mail-yh0-f74.google.com with SMTP id f10so1434432yha.5 for ; Tue, 15 Apr 2014 10:37:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=PhlP8WC75FAugGmayuD9AnUCgIL4BfoQGxRUU+3ZE8Q=; b=ZOrTMPmF/dof8RvrKgcjW+xZ+94V64MckR69QzpGvCgTZDW8J4hYHJWRnpoh2jKTIB MhuZ751WAMnU3LIhQqfqjKklouqcAcngZaQ9TnVrfUFa/xRLvJ8hSvHIhBPnoGspcKDc vd6wPA2+tT8D6IBAp0gGP8urOvomZBwGu7fMJ1XBywEpYxd0bVpkJ9igl1d6+T2Uco2l a/iMJPS6pxErvfVb+s/Ooe317URBQBspX3cb6OOf+WriRFi+G3nzXPlhfH67OoCul7Az DIp2OEohJ5DrPf8P/6Aia++QB+vcJ7tBmLgG8QkZMOZpjKCTIZPQwWjao2+Oq+WdiK64 XxpQ== X-Gm-Message-State: ALoCoQm/vyQuGmSjyJ7RdxjxYqQTlatM2n6i1K5i4jb/Legpoeh2uQYWHX66CwkFEgYo7VsAwidzps+vS14ULW6Ob0pv0B2Mh/OgWj6G66+ctG7mok7QBvKvuhchSz3M4nv4xiGtx9GtaIHuuky03WqPTNlwQ52nppodBMNgLOP/MV63/dWWTgSFss9AvUl7FNi0G9Ig/MDYbNoIzX7qjBMVXyaTSZ/QRHfiyp59v2C9apmi84KhWAU= X-Received: by 10.224.167.8 with SMTP id o8mr1374970qay.0.1397583441422; Tue, 15 Apr 2014 10:37:21 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id r61si2778938yhf.1.2014.04.15.10.37.21 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Apr 2014 10:37:21 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 0DA2731C20C for ; Tue, 15 Apr 2014 10:37:20 -0700 (PDT) From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] Pass --data-directory through gdb_realpath. Date: Tue, 15 Apr 2014 17:37:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00296.txt.bz2 Hi. gdb currently records the supplied --data-directory as is, which if a relative path will be wrong if the user cd's to a different directory. 2014-04-15 Doug Evans * main.c (captured_main): Pass --data-directory through gdb_realpath. diff --git a/gdb/main.c b/gdb/main.c index 59015f5..d269638 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -642,7 +642,15 @@ captured_main (void *data) break; case 'D': xfree (gdb_datadir); - gdb_datadir = xstrdup (optarg); + if (optarg[0] == '\0') + { + fprintf_unfiltered (gdb_stderr, + _("%s: empty path for" + " `--data-directory'\n"), + argv[0]); + exit (1); + } + gdb_datadir = gdb_realpath (optarg); gdb_datadir_provided = 1; break; #ifdef GDBTK