From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MH+6LUjh/F/kKgAAWB0awg (envelope-from ) for ; Mon, 11 Jan 2021 18:37:44 -0500 Received: by simark.ca (Postfix, from userid 112) id AD2221EEEF; Mon, 11 Jan 2021 18:37:44 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 59A721E940 for ; Mon, 11 Jan 2021 18:37:44 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0AD33846035; Mon, 11 Jan 2021 23:37:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0AD33846035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610408263; bh=SO65W35eA6kBTQYN9C0m6OmjfaqZc2nTs/V40/iWgiE=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=JP589RTpft+8lblCXrOAdyYck0dh5MCMj27nshkrXTGF0ZOjwqgskthPUUcLSN9F7 KCQYDjuee/9EEVaCwQoS/tHL/BBYiYNALPhZRzzbI5vWB8UsdC9oxnYau/uywtv1sn IROWw3TBZTcrVA6lSv0lvCuxSIw+uj82AIGBDBZc= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 54EB13857C65 for ; Mon, 11 Jan 2021 23:37:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 54EB13857C65 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 10BNaWcA025188 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jan 2021 18:36:37 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 10BNaWcA025188 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 90A131E940; Mon, 11 Jan 2021 18:36:32 -0500 (EST) Subject: Re: [PATCH v4] Improve gdb_tilde_expand logic To: Lancelot SIX , gdb-patches@sourceware.org References: <20210108001337.29164-1-lsix@lancelotsix.com> <20210111224059.32287-1-lsix@lancelotsix.com> Message-ID: <1d949257-45d9-d629-94db-5a6b5161ad59@polymtl.ca> Date: Mon, 11 Jan 2021 18:36:32 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210111224059.32287-1-lsix@lancelotsix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 11 Jan 2021 23:36:32 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-01-11 5:40 p.m., Lancelot SIX via Gdb-patches wrote: > Before this patch, gdb_tilde_expand would use glob(3) in order to expand > tilde at the begining of a path. This implementation has limitation when > expanding a tilde leading path to a non existing file since glob fails to > expand. > > This patch proposes to use glob only to expand the tilde component of the > path and leaves the rest of the path unchanged. > > This patch is a followup to the following discution: > https://sourceware.org/pipermail/gdb-patches/2021-January/174776.html > > Before the patch: > > gdb_tilde_expand("~") -> "/home/lsix" > gdb_tilde_expand("~/a/c/b") -> error() is called > > After the patch: > > gdb_tilde_expand("~") -> "/home/lsix" > gdb_tilde_expand("~/a/c/b") -> "/home/lsix/a/c/b" > > Tested on x84_64 linux. > > Since V1: > * Unittests added thanks to inputs and skeleton provided by > Simon Marchi. > * My copyright assignment has been signed! > > Since V2: > * Fix coding style issuess and typos. > * Use $HOME and $USER env variables to test the behavior of > gdb_tilde_expand instead of testing the function against itself. > > Since V3: > * Add tests for erroneous cases. > * Fix coding style of lambda function. > > gdb/ChangeLog: > > * Makefile.in (SELFTESTS_SRCS): Add > unittests/gdb_tilde_expand-selftests.c. > * unittests/gdb_tilde_expand-selftests.c: New file. > > gdbsupport/ChangeLog: > > * gdb_tilde_expand.cc (gdb_tilde_expand): Improve > implementation. > (gdb_tilde_expand_up): Delegate logic to gdb_tilde_expand. > * gdb_tilde_expand.h (gdb_tilde_expand): Update description. This is ok. Did you get your sourceware account? Once you do, you can push a commit to add yourself to gdb/MAINTAINERS (just look up previous commit that touch this file for examples). Simon