sunaku/dasht

Webserver not working in Ubuntu 16.04

chopfitzroy opened this issue · 10 comments

When I try to use: dasht-server

I get the following response:

http://127.0.0.1:54321
/home/otis/Developer/dotfiles/vendor/dasht/bin/dasht-server-http: 81: shift: can't shift that many
2016/11/21 22:33:01 socat[28881] E write(6, 0x24d4870, 1294): Broken pipe
awk: write failure (Broken pipe)
awk: close failed on file /dev/stdout (Broken pipe)

Cheers.

Interesting. Could you please add set -x; in front of line 80 and re-run the script?
I need to see the value of $url and why it apparently lacks printable characters.

Also, what operating system and what version of awk, shell, coreutils are you using?

Hey @sunaku do you mean like this?

  IFS='?&'
  set -x
  set -- $url

This does not seem to work?

OS: Ubuntu 16.04
awk: mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
shell: fish, version 2.3.1
coreutils: Version: 8.25-2ubuntu2

Sorry would try to be more help with the debugging but this is way above and beyond any shell scripts I have worked with.

Thanks for the information. 👍 Let's try an alternative debugging approach:

  1. Append an x to the first line of bin/dasht-server-http so that it looks like this:

     #!/bin/sh -ex
    
  2. Run dasht-server in a terminal.

  3. Visit http://127.0.0.1:54321/ in a browser.

  4. Look at the terminal where you ran dasht-server and provide all the output you see.

Hey with the -ex flag I get the following:

http://127.0.0.1:54321
+ awk 
  /^GET [[:print:]]+ HTTP\/1.+\r$/ { print $2 }
  /^\r$/ { exit } # reached end of HTTP request

+ awk 
  /^GET [[:print:]]+ HTTP\/1.+\r$/ { print $2 }
  /^\r$/ { exit } # reached end of HTTP request

Cheers.

Hey @sunaku just wanted to see if there had been any progress on this?

Alright, I had to set up Ubuntu 16.04.1 LTS on a virtual machine just to debug this for you! 😬 Stay tuned.

Okay, I've got it! 😤 It's a subtle difference between Void's gawk and Ubuntu's mawk. Here is a workaround:

sudo apt-get install gawk

I'll delve into the differences later, when I have more motivation. Feel free to investigate and report back.

Hey @sunaku, not sure if this is related but none of the links are working, if I inspect the link and manually navigate to something like: file://home/otis/.local/share/dasht/docsets/Bash.docset/Contents/Resources/Documents/bash/Commands-For-Killing.html#//apple_ref/Function/yank%20%28C%2Dy%29 it works, it is just clicking does not seem to work.

That's not related to this issue, but is instead a result of your browser's default security policy. 👮‍♂️ See the manual http://sunaku.github.io/dasht/man/man1/dasht-server.1.html#browser-refuses-to-load-file-links for more information and suggested workarounds.

Hey @sunaku,

Awesome! Sorry only just saw your message about setting up a custom VM much appreciated!!!

Cheers.