From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 50F883858D37 for ; Thu, 7 Apr 2022 06:09:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 50F883858D37 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncLKO-0003Rb-M7; Thu, 07 Apr 2022 02:09:08 -0400 Received: from [87.69.77.57] (port=4881 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncLKN-0006hF-Ve; Thu, 07 Apr 2022 02:09:08 -0400 Date: Thu, 07 Apr 2022 09:09:16 +0300 Message-Id: <835ynlctmb.fsf@gnu.org> From: Eli Zaretskii To: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <20220407015159.1734834-6-simon.marchi@polymtl.ca> (message from Simon Marchi via Gdb-patches on Wed, 6 Apr 2022 21:51:58 -0400) Subject: Re: [PATCH 5/6] gdb: prepend comp_dir to symtab name in buildsym_compunit References: <20220407015159.1734834-1-simon.marchi@polymtl.ca> <20220407015159.1734834-6-simon.marchi@polymtl.ca> X-Spam-Status: No, score=2.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 07 Apr 2022 06:09:10 -0000 > Date: Wed, 6 Apr 2022 21:51:58 -0400 > From: Simon Marchi via Gdb-patches > > + if (!IS_ABSOLUTE_PATH (name) && m_comp_dir != nullptr) > + { > + name_copy = string_printf ("%s/%s", m_comp_dir.get (), name); Is it really the best idea to concatenate the directory and the file this way? What is 'name' includes "./" or "../" components? what if m_comp_dir ends in a slash or a backslash (for example, if it's just "/")? etc. etc. Shouldn't we use a more sophisticated API here that has some knowledge about the semantics of file names? Thanks.