htmltest: Crash parsing HTML document
htmltest is erroring out when I run it:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1111246]
goroutine 1 [running]:
github.com/wjdp/htmltest/htmldoc.(*Document).Parse(0x0)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmldoc/document.go:47 +0x26
github.com/wjdp/htmltest/htmldoc.(*Document).IsHashValid(0x0, 0xc000364b1e, 0x15, 0x127b200)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmldoc/document.go:112 +0x2b
github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkInternalHash(0xc0000c5200, 0xc000161770)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:297 +0xad
github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkInternal(0xc0000c5200, 0xc000161770)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:271 +0xcb
github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkLink(0xc0000c5200, 0xc00010c700, 0xc00012df10)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:85 +0x3f9
github.com/wjdp/htmltest/htmltest.(*HTMLTest).testDocument(0xc0000c5200, 0xc00010c700)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:203 +0x193
github.com/wjdp/htmltest/htmltest.(*HTMLTest).testDocuments(0xc0000c5200)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:182 +0x6a
github.com/wjdp/htmltest/htmltest.Test(0xc000075aa0, 0x1, 0x1, 0x49)
/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:142 +0x8fb
main.run(0xc000075aa0, 0xc000075aa0)
/home/travis/gopath/src/github.com/wjdp/htmltest/main.go:159 +0x1e8
main.main()
/home/travis/gopath/src/github.com/wjdp/htmltest/main.go:66 +0x298
To Reproduce
Steps to reproduce the behaviour:
- Run with config and options …
htmltest --log-level 3
.htmltest.yml
Please copy in your config file
DirectoryPath: "public"
EnforceHTTPS: false
CacheExpires: "6h"
CheckExternal: false
IgnoreDirectoryMissingTrailingSlash: true
IgnoreInternalEmptyHash: true
IgnoreDirs:
- Support
Source files
I haven’t been able to narrow it down yet – my request is for htmltest to print the page it’s processing to help narrow it down.
Expected behaviour
print each page as it’s being processed
Versions
- OS: MacOS 10.14.5
- htmltest: 0.10.3
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (8 by maintainers)
Hi, @wjdp. I was able to replicate this error.
In my case, I have 2 pages, first page has an anchor link to another page page 1
public/docs/dev/index.html
page 2
public/docs/hello-configuration/index.html
.htmltest.yml
:Links are valid since when I run it on localhost or server, links work OK. Is there any workaround? Please let me know if you need more details.
UPDATED (27.10.21): once I remove
DirectoryPath: "public/"
from.htmltest.yml
. it seems to be working UPDATED (28.10.21):hello-configuration/index.html
and in config, I haveIgnoreDirs
->- hello
. this is a case! once I renamed my file or remove IngoreDirs or change namehello
tohello/
, this error is gone. .