From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: get absolute path of given path Date: Sun, 6 Sep 2020 08:20:49 -0700 Message-ID: References: <53fcdc7a-5c55-3f11-5812-a02729a12295@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33105"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Sep 06 17:21:07 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 1kEwTb-0008Vw-IY for guile-user@m.gmane-mx.org; Sun, 06 Sep 2020 17:21:07 +0200 Original-Received: from localhost ([::1]:46506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEwTa-0001wO-KQ for guile-user@m.gmane-mx.org; Sun, 06 Sep 2020 11:21:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEwTP-0001uR-D6 for guile-user@gnu.org; Sun, 06 Sep 2020 11:20:55 -0400 Original-Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:46269) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEwTN-0000nQ-LG for guile-user@gnu.org; Sun, 06 Sep 2020 11:20:55 -0400 Original-Received: by mail-pf1-x42d.google.com with SMTP id b124so7246611pfg.13 for ; Sun, 06 Sep 2020 08:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=en+6mjLsSSo+pcbXNGXg98jCTlWjkMoPAHd5jJQH9Ok=; b=IIs+VTr/TsNdUTFHliNrkqGDEjiJF8bjwS8qkmlZY0uvGIJ3LcfhIZRDoQeGMcyK4P IOtGDAYfMZbSvtTsKHkimv4ADgCwdgSwi6HK9FLnjfxHpx2qB4tYY+w5G/ACfYmczWa7 1hieS/n75v3wM4dfGbCY5RRGG5ebY5Mia9WbLsLfmYTzwHV6pBOgLZC/g88cNpk6MlTP WaXuCRM3BglsPo/56WzlejLOAzt4Mok+MuTQVrNQ22eJjHXy8jb1dD9Dwlyj1husYOxq lkK8TjijgJxC1hzr9ExfvA8HjsqKWfoni1sqpv6Y1tymi0ICjnapQi7hch2Mr8YoYs/f p5Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=en+6mjLsSSo+pcbXNGXg98jCTlWjkMoPAHd5jJQH9Ok=; b=N2pCxjHCyLG7KmLckR/Y4lB+rDcRubgYVS5dXQsovza0enI9zojOtyewcUitKSqf/D YYyHc960Y+q1O95ILr4J/nRGPIKR6ZgncO1ckjuUuakru2Az3P1RvcViKGPTTwDFACyW cWn36Rm5d9KocNuupLos4iCA5iqiqZNonhB/hJHnhg5fblNpfMTZb2PAbYNtZFWiOdpy jB7EQuGbtkYtRy+hczT3bhrn29QEZ+NxJ0oOip2XaD+FpHsw+/A9L4f6FYrmDlbsii4/ QFj3SpEAr95yQn2g6L78iHc3QWKmhRYC5acZfpPZKg5TeVSpvpKrIC7HxAwJO7Cr4UEU J93w== X-Gm-Message-State: AOAM530BI87DdwgVPl9Jmr8SM30tX34gaevpvnQQK9WN7TOd7PHTR13o hNXRwtiiMq9NxMUEy6KohvuqB6eUG4YsHg== X-Google-Smtp-Source: ABdhPJx6KFxvv8kdnyEHvU2H43Oc9GDqMf8hkPxtUBpk0et3A/B7FM/ugrXekh2YgoS1hi9SBFyTmw== X-Received: by 2002:a63:e015:: with SMTP id e21mr14248376pgh.264.1599405651300; Sun, 06 Sep 2020 08:20:51 -0700 (PDT) Original-Received: from [192.168.2.183] (64-52-176-132.championbroadband.com. [64.52.176.132]) by smtp.gmail.com with ESMTPSA id n1sm12488210pfu.2.2020.09.06.08.20.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 06 Sep 2020 08:20:50 -0700 (PDT) In-Reply-To: <53fcdc7a-5c55-3f11-5812-a02729a12295@posteo.de> Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=matt.wette@gmail.com; helo=mail-pf1-x42d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, NICE_REPLY_A=-2.69, RCVD_IN_DNSWL_NONE=-0.0001, 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:16872 Archived-At: 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