Windows: paths are not completely handled #5

Closed
opened 10 years ago by adrientetar · 14 comments
adrientetar commented 10 years ago (Migrated from github.com)

I'm on Windows with latest racket and pollen.

What I did was cd to my working directory then ran this command:

"C:\Program Files\Racket\raco" pollen start

The index.ptree works, I can also access files in the folder that are not processed by pollen. However, when I click on spec.html.pm; I get this:

route-404: Can't find C:\Users\Adrien\Downloads\project\c\users\adrien\downloads\project\spec.html

Notice the stray path here.

Now cd'ing to racket directory and running it from here with a custom project path, I have basically the same error pattern but with racket path:

route-404: Can't find C:\Users\Adrien\Downloads\project\c\program files\racket\spec.html

Basically the same but with Racket's path.
For reference the command ran here was:

raco pollen start "C:\Users\Adrien\Downloads\project"

@mbutterick; Note that it's the first time I'm using Racket so I may be doing something wrong.

I'm on Windows with latest racket and pollen. What I did was `cd` to my working directory then ran this command: ``` "C:\Program Files\Racket\raco" pollen start ``` The `index.ptree` works, I can also access files in the folder that are not processed by pollen. However, when I click on `spec.html.pm`; I get this: ``` route-404: Can't find C:\Users\Adrien\Downloads\project\c\users\adrien\downloads\project\spec.html ``` Notice the stray path here. Now `cd`'ing to racket directory and running it from here with a custom project path, I have basically the same error pattern but with racket path: ``` route-404: Can't find C:\Users\Adrien\Downloads\project\c\program files\racket\spec.html ``` Basically the same but with Racket's path. For reference the command ran here was: ``` raco pollen start "C:\Users\Adrien\Downloads\project" ``` @mbutterick; Note that it's the first time I'm using Racket so I may be doing something wrong.
mbutterick commented 10 years ago (Migrated from github.com)

More likely I'm doing something dumb with Windows paths.

I'll have a look...

More likely I'm doing something dumb with Windows paths. I'll have a look...
adrientetar commented 10 years ago (Migrated from github.com)

Thanks, just ran into something weirder: it now works... but I haven't actually changed anything.

The log shows this:

Servlet (@ /) exception:
bytes->path: path string is empty

  context...:
   C:\Program Files\Racket\collects\net\url.rkt:154:0: file://->path4
   req->path
   C:\Users\Adrien\AppData\Roaming\Racket\6.0\pkgs\pollen\server-routes.rkt:215:
0: route-default
   C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\dispatchers\disp
atch-servlets.rkt:58:2

Seems like that stray path is now considered empty internally?

Thanks, just ran into something weirder: it now works... but I haven't actually changed anything. The log shows this: ``` Servlet (@ /) exception: bytes->path: path string is empty context...: C:\Program Files\Racket\collects\net\url.rkt:154:0: file://->path4 req->path C:\Users\Adrien\AppData\Roaming\Racket\6.0\pkgs\pollen\server-routes.rkt:215: 0: route-default C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\dispatchers\disp atch-servlets.rkt:58:2 ``` Seems like that stray path is now considered empty internally?
mbutterick commented 10 years ago (Migrated from github.com)

I was able to reproduce this problem. There were a couple places in the code where I wasn't handling Windows paths correctly. I've pushed a fix & now it's working for me.

PS You can update your installation with
raco pkg update pollen
or on Windows
"C:\Program Files\Racket\raco" pkg update pollen

I was able to reproduce this problem. There were a couple places in the code where I wasn't handling Windows paths correctly. I've pushed a fix & now it's working for me. PS You can update your installation with `raco pkg update pollen` or on Windows `"C:\Program Files\Racket\raco" pkg update pollen`
adrientetar commented 10 years ago (Migrated from github.com)

Neat, thanks!

Neat, thanks!
adrientetar commented 10 years ago (Migrated from github.com)

@mbutterick I haven’t used pollen in months but here I just updated to the latest version and I have a similar message I had before:

The application raised an exception with the message:

bytes->path: path string is empty

Stack trace:

file://->path4 at:
  line 154, column 0, in file C:\Program Files\Racket\collects\net\url.rkt
<unknown procedure> at:
  line 219, column 25, in file C:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt
req->path at:
  <unknown location>
route-default at:
  line 219, column 0, in file C:\Users\Adrien\AppData\Roaming\Racket\6.1\pkgs\pollen\server-routes.rkt
<unknown procedure> at:
  line 58, column 2, in file C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\dispatchers\dispatch-servlets.rkt
@mbutterick I haven’t used pollen in months but here I just updated to the latest version and I have a similar message I had before: The application raised an exception with the message: ``` bytes->path: path string is empty ``` Stack trace: ``` file://->path4 at: line 154, column 0, in file C:\Program Files\Racket\collects\net\url.rkt <unknown procedure> at: line 219, column 25, in file C:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt req->path at: <unknown location> route-default at: line 219, column 0, in file C:\Users\Adrien\AppData\Roaming\Racket\6.1\pkgs\pollen\server-routes.rkt <unknown procedure> at: line 58, column 2, in file C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\dispatchers\dispatch-servlets.rkt ```
adrientetar commented 10 years ago (Migrated from github.com)

I did more testing. When I pass a path inside quotes like raco pollen start "C:\nAZERTY" I get the error up here. I need quotes for paths that have spaces in the terminal.

It also does not work when you have non-ASCII chars in your path, like e.g. é. Should it use strings instead of bytes or something?

After doing these two tests I renamed back to C:\nAZERTY and opened without quotes, got the same error when opening the server root (http://localhost:8080/) but it worked when opening the dashboard directly (http://localhost:8080/index.ptree).
So something is a bit weird with how it routes the root page?

Lastly, I’d expect the dashboard to follow the Windows path conventions.
ptree

I did more testing. When I pass a path inside quotes like `raco pollen start "C:\nAZERTY"` I get the error up here. I need quotes for paths that have spaces in the terminal. It also does not work when you have non-ASCII chars in your path, like e.g. é. Should it use strings instead of bytes or something? After doing these two tests I renamed back to C:\nAZERTY and opened without quotes, got the same error when opening the server root (`http://localhost:8080/`) but it worked when opening the dashboard directly (`http://localhost:8080/index.ptree`). So something is a bit weird with how it routes the root page? Lastly, I’d expect the dashboard to follow the Windows path conventions. ![ptree](https://cloud.githubusercontent.com/assets/1250894/4190839/f6698fb0-3788-11e4-9dea-2843d51ce69e.PNG)
adrientetar commented 10 years ago (Migrated from github.com)

Also if I click on the drive letter from the dashboard:

The application raised an exception with the message:

build-path: drive cannot be added to a base path
  drive: C:\
  base path: C:\nAZERTY

(same with absolute path instead of drive if I click on a path.)

Stack trace:

<unknown procedure> at:
  line 49, column 2, in file C:\Users\Adrien\AppData\Roaming\Racket\6.1\pkgs\pollen\server-routes.rkt
<unknown procedure> at:
  line 58, column 2, in file C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\dispatchers\dispatch-servlets.rkt
<unknown procedure> at:
  line 112, column 8, in file C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\private\dispatch-server-unit.rkt
Also if I click on the drive letter from the dashboard: The application raised an exception with the message: ``` build-path: drive cannot be added to a base path drive: C:\ base path: C:\nAZERTY ``` (same with absolute path instead of drive if I click on a path.) Stack trace: ``` <unknown procedure> at: line 49, column 2, in file C:\Users\Adrien\AppData\Roaming\Racket\6.1\pkgs\pollen\server-routes.rkt <unknown procedure> at: line 58, column 2, in file C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\dispatchers\dispatch-servlets.rkt <unknown procedure> at: line 112, column 8, in file C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\private\dispatch-server-unit.rkt ```
mbutterick commented 10 years ago (Migrated from github.com)

What happens if you change your current directory to C:\nAZERTY and then do raco pollen start (without a directory argument)?

What happens if you change your current directory to `C:\nAZERTY` and then do `raco pollen start` (without a directory argument)?
mbutterick commented 10 years ago (Migrated from github.com)

I pushed a possible fix. Let me know if it helps.

I pushed a possible fix. Let me know if it helps.
adrientetar commented 10 years ago (Migrated from github.com)

It works now except when opening server root (http://localhost:8080/), opening index.ptree or a file works properly.

(I hit this also with raw UTF8 files without BOM but it seems to be an issue on the browser’s side.)

It works now except when opening server root (`http://localhost:8080/`), opening index.ptree or a file works properly. (I hit [this](https://bugzilla.mozilla.org/show_bug.cgi?id=760050) also with raw UTF8 files without BOM but it seems to be an issue on the browser’s side.)
adrientetar commented 10 years ago (Migrated from github.com)

Sometimes a page will hang and fail to load and give a spurious TCP error:

tcp-read: error reading
  system error: Une connexion ├®tablie a ├®t├® abandonn├®e par un logiciel de vo
tre ordinateur h├┤te.; errno=10053
  context...:
   C:\Program Files\Racket\collects\racket\port.rkt:1135:4: try-again
fprintf: output port is closed
  context...:
   C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\http\response.rk
t:52:0: output-response-head33
   C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\http\response.rk
t:23:0: output-response/method
   C:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt:
255:18
   C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\private\dispatch
-server-unit.rkt:112:8

It seems to correspond to a timeout from the client but the underlying error might be elsewhere. Does it look like a Racket error rather than Pollen?

(Notice that non-ASCII chars are not output properly but since it’s a Racket-output error, I’m assuming that Racket itself does it wrong.)

Sometimes a page will hang and fail to load and give a spurious TCP error: ``` tcp-read: error reading system error: Une connexion ├®tablie a ├®t├® abandonn├®e par un logiciel de vo tre ordinateur h├┤te.; errno=10053 context...: C:\Program Files\Racket\collects\racket\port.rkt:1135:4: try-again fprintf: output port is closed context...: C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\http\response.rk t:52:0: output-response-head33 C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\http\response.rk t:23:0: output-response/method C:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt: 255:18 C:\Program Files\Racket\share\pkgs\web-server-lib\web-server\private\dispatch -server-unit.rkt:112:8 ``` It seems to correspond to a timeout from the client but the underlying error might be elsewhere. Does it look like a Racket error rather than Pollen? (Notice that non-ASCII chars are not output properly but since it’s a Racket-output error, I’m assuming that Racket itself does it wrong.)
mbutterick commented 10 years ago (Migrated from github.com)

You won't see anything at the server root (http://localhost:8080/) unless you put your own index.html there. (This is deliberate behavior.)

As for the TCP error, the stack trace doesn’t originate in Pollen code, so it looks like a Racket error.

As for the non-ASCII characters, that’s probably because the web page showing the error needs to be set to UTF-8 — I can fix that.

You won't see anything at the server root (`http://localhost:8080/`) unless you put your own `index.html` there. (This is deliberate behavior.) As for the TCP error, the stack trace doesn’t originate in Pollen code, so it looks like a Racket error. As for the non-ASCII characters, that’s probably because the web page showing the error needs to be set to UTF-8 — I can fix that.
mbutterick commented 10 years ago (Migrated from github.com)

PS. Because of a recent update, you need to change the name of project-require.rkt to directory-require.rkt.

PS. Because of a recent update, you need to change the name of `project-require.rkt` to `directory-require.rkt`.
adrientetar commented 10 years ago (Migrated from github.com)

You won't see anything at the server root (http://localhost:8080/) unless you put your own index.html there. (This is deliberate behavior.)

It makes sense, however I’d expect it to not error with a stack trace when index.html isn’t present?

As for the non-ASCII characters, that’s probably because the web page showing the error needs to be set to UTF-8 — I can fix that.

The web error is fine (through it lacks a DOCTYPE like the dashboard did previously), it was in the Terminal.

PS. Because of a recent update, you need to change the name of project-require.rkt to directory-require.rkt.

Right, thanks!

> You won't see anything at the server root (`http://localhost:8080/`) unless you put your own `index.html` there. (This is deliberate behavior.) It makes sense, however I’d expect it to not error with a stack trace when `index.html` isn’t present? > As for the non-ASCII characters, that’s probably because the web page showing the error needs to be set to UTF-8 — I can fix that. The web error is fine (through it lacks a DOCTYPE like the dashboard did previously), it was in the Terminal. > PS. Because of a recent update, you need to change the name of `project-require.rkt` to `directory-require.rkt`. Right, thanks!
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen#5
Loading…
There is no content yet.