GNU bug report logs - #60528
uri->string swallows mandatory slashes

Previous Next

Package: guile;

Reported by: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Date: Tue, 3 Jan 2023 20:01:02 UTC

Severity: normal

To reply to this bug, email your comments to 60528 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#60528; Package guile. (Tue, 03 Jan 2023 20:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Tue, 03 Jan 2023 20:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: uri->string swallows mandatory slashes
Date: Tue, 03 Jan 2023 21:00:48 +0100
Hi folks,

Below some unexpected behaviour observed in Guile 3.0.8, but it also
dates back to 2.2.7 and possibly earlier versions.

scheme@(guile-user)> ,use (web uri)
scheme@(guile-user)> (string->uri "file:///home") 
$1 = #<<uri> scheme: file userinfo: #f host: #f port: #f path: "/home"
query: #f fragment: #f>
scheme@(guile-user)> (uri->string $1)
$2 = "file:/home"
scheme@(guile-user)> (uri->string (build-uri 'file #:host "" #:path
"/home")) 
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `uri-error' with args `("Expected valid host: ~s" (""))'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.

Cheers




Information forwarded to bug-guile <at> gnu.org:
bug#60528; Package guile. (Wed, 04 Jan 2023 08:12:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: <tomas <at> tuxteam.de>
To: bug-guile <at> gnu.org
Subject: Re: bug#60528: uri->string swallows mandatory slashes
Date: Wed, 4 Jan 2023 09:11:10 +0100
[Message part 1 (text/plain, inline)]
On Tue, Jan 03, 2023 at 09:00:48PM +0100, Liliana Marie Prikler wrote:
> Hi folks,
> 
> Below some unexpected behaviour observed in Guile 3.0.8, but it also
> dates back to 2.2.7 and possibly earlier versions.
> 
> scheme@(guile-user)> ,use (web uri)
> scheme@(guile-user)> (string->uri "file:///home") 
> $1 = #<<uri> scheme: file userinfo: #f host: #f port: #f path: "/home"
> query: #f fragment: #f>
> scheme@(guile-user)> (uri->string $1)
> $2 = "file:/home"

This looks strange, but not necessarily wrong. "file:///home" means
"empty authority", equivalent to "localhost" whereas "file:/home" means
"no authority". I'd expect the library to keep those two separate.
 
> scheme@(guile-user)> (uri->string (build-uri 'file #:host "" #:path
> "/home")) 
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> Throw to key `uri-error' with args `("Expected valid host: ~s" (""))'.

Note that "no host" is not the empty string, but #f:

> scheme@(guile-user)> (uri->string (build-uri 'file #:host "" #:path
> "/home")) 

  scheme@(guile-user)> (uri->string (build-uri 'file #:host #f #:path "/home"))
  $6 = "file:/home"

So it is consistent, albeit (to me) surprising. I'd have expect
your `$2' above to be "file:///home", with three slashes.

Cheers
-- 
t
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 1 year and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.