From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: get absolute path of given path Date: Mon, 7 Sep 2020 01:39:09 +0200 Message-ID: References: <53fcdc7a-5c55-3f11-5812-a02729a12295@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30257"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.10.0 Cc: guile-user@gnu.org To: Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Sep 07 01:39:31 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kF4Fv-0007ma-EN for guile-user@m.gmane-mx.org; Mon, 07 Sep 2020 01:39:31 +0200 Original-Received: from localhost ([::1]:36694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF4Fu-00055H-BI for guile-user@m.gmane-mx.org; Sun, 06 Sep 2020 19:39:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF4Fg-000550-Vc for guile-user@gnu.org; Sun, 06 Sep 2020 19:39:17 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:43046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF4Fd-0001aS-LB for guile-user@gnu.org; Sun, 06 Sep 2020 19:39:16 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id AA78B16005C for ; Mon, 7 Sep 2020 01:39:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1599435550; bh=LhzrVedUzDPMwIHl4JCID5cvCN0EpuKKDKm8cagHG0M=; h=Subject:To:Cc:From:Date:From; b=dqhiejzCrNMReZQ/m/IwHGUd2H/Ia1pIMBUXb8bsKDKIIgOHLm1WlWq9BJdJz03MD RYbyHPH/3S0xqpKPSQkfEuIDlTziIERhqrSbERtYe1cDXgTwTPb4P6pjMq7wx4aH/P G8EdMffi5ZL+ZNRl+NYuOsf/6QxnLhdZb2ANO0tLlIjK+UMr32pa8vp8tJ00vzBcY+ EESPEPvpMJCfVR9j9KZwXU6+XA93gRSFXapxe04lT+ZtGBQu8f95M+8/zwFlPlXjkN QSrczpF+s4Xc6vQvl0SvgGIGwRGiDZ8LtKBWGw5Mg9A9sYo2QTuOLb1xxdvycUWx3y 4lG0sQSGHZSvA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Bl7Cy1QPRz9rxG; Mon, 7 Sep 2020 01:39:10 +0200 (CEST) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=185.67.36.65; envelope-from=zelphirkaltstahl@posteo.de; helo=mout01.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/06 19:39:11 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -47 X-Spam_score: -4.8 X-Spam_bar: ---- X-Spam_report: (-4.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-2.69, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16874 Archived-At: Hi Matt! On 06.09.20 17:20, Matt Wette wrote: > > On 9/6/20 8:04 AM, Zelphir Kaltstahl wrote: >> Hi Guile Users! >> >> In my explorations into making examples for web development, I came >> across the question of how to get an absolute path from any given path. >> This is useful for example when checking, whether a path points to >> something inside a static assets directory, or perhaps sneakily tries to >> escape that and access things it should not. >> >> I found in Guile's manual the function (canonicalize-path path). >> However, this function has one problem, which makes it not sufficient on >> its own: It raises an exception, when a path given points to something >> that does not exist. I would like to have a function, that gives me the >> absolute path of any path I give as argument, not only for existing >> paths. So i went ahead and wrote the following code >> (https://notabug.org/ZelphirKaltstahl/guile-examples/src/14a76a6aee18a900ac9b9de2b79ede239f8cf9f0/file-system/path-handling.scm): >> >> > Maybe you would like false-if-exception. > > https://www.gnu.org/software/guile/manual/html_node/Error-Reporting.html This I definitely did not know and it seems like it would fit perfectly for my use-case. Thank you! Regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl