Skip to content

File I/O: spit cannot resolve gio/writer; slurp misclassifies Windows drive paths #143

Open

Description

@corkine

Two related gaps in clojure.core file I/O on stock Glojure v0.7.25 (8ab940f).

1. spit cannot resolve gio/writer

From a writable temporary directory:

glj -e '(spit "glojure-test.txt" "hello")'

On Linux this fails with unable to resolve host form: gio.writer. Expected: create the file with the supplied text. clojure.core/spit calls gio/writer, but the public writer definition is commented out even though the make-writer machinery exists.

2. slurp interprets a Windows drive letter as a URI scheme

Given an existing file at C:\Temp\glojure-test.txt on Windows, this should return its contents:

(slurp "C:\\Temp\\glojure-test.txt")

Passing that same path string to stock v0.7.25 on Linux reproduces the misclassification: unsupported protocol scheme "c". I have not rerun the file read on Windows. The string input-stream implementation tries ParseRequestURI before opening a local path, so the drive prefix takes the URL branch.

Possible fixes: expose writer through the existing make-writer path, and distinguish native absolute paths from URIs before dispatch. Windows drive paths should work for reading and writing without changing behavior for real file:, http:, and https: URLs. Regression coverage for both source-loaded and AOT paths would be useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions