Badhostname in t.pull-push - how to configure to pass test?


#1

In running ./doit t.pull-push, I’m seeing the test hang on:
bk push bk://badhostname
How can I configure that hostname so it will immediately fail the lookup and pass the test?
I haven’t figured out what to google so I can configure name lookup to fail.
Edit: I’m running mostly on Linux, a little on Mac.


#2

https://tools.ietf.org/html/rfc6761 speaks to this.

My reading is that adding a .test suffix will do the trick.


#3

Thanks Georg.

In a bugfix repo:

$ uname -a
Linux <hostname>.local 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ bk push bk://badhostname.test
Push file:///<...pathstuff...>/bugfix
  -> bk://badhostname.test
<hang>

Same thing on MacOS.
Does it work for you?

I tried bk:://test. , test.test , test.com , com.test , and a bunch of other silly permutations.

Hangs on all of them.

Do you have any magic set up to have ./doit t.pull-push pass?


#4

Here’s what I get:

odin:dev-oss georgn$ uname -a
Darwin odin.bitkeeper.com 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
odin:dev-oss georgn$ bk push bk://badhostname.test
Push file:///Volumes/huge/bk/dev-oss
  -> bk://badhostname.test
Cannot resolve host 'badhostname.test'.
odin:dev-oss georgn$

So the following diffs seem to work for me:

odin:t georgn$ bk diffs t.pull-push
===== t.pull-push 1.116 vs edited =====
--- 1.116/src/t/t.pull-push	2016-05-17 14:45:31 -04:00
+++ edited/src/t/t.pull-push	2017-04-24 22:33:58 -04:00
@@ -461,7 +461,7 @@
 # XXX TODO need test case for pull/pull/clone to/from space in pathname

 echo $N Try pushing to an illegal hostname ..........................$NL
-bk push bk://badhostname > ERR 2>&1 && {
+bk push bk://badhostname.test > ERR 2>&1 && {
 	echo should have failed
 	exit 1
 }
@@ -470,25 +470,25 @@
 	exit 1
 }

-grep -q "Cannot resolve host 'badhostname'." ERR || {
+grep -q "Cannot resolve host 'badhostname.test'." ERR || {
 	echo failed
 	cat ERR
 	exit 1
 }
 echo OK

 echo $N Make sure illegal hostname error is emitted even with -q ....$NL
-bk push -q bk://badhostname 2> ERR
-grep -q "Cannot resolve host 'badhostname'." ERR || {
+bk push -q bk://badhostname.test 2> ERR
+grep -q "Cannot resolve host 'badhostname.test'." ERR || {
 	echo failed
 	cat ERR
 	exit 1
 }
 echo OK

 echo $N And the same for pull -q ....................................$NL
-bk pull -q bk://badhostname 2> ERR
-grep -q "Cannot resolve host 'badhostname'." ERR || {
+bk pull -q bk://badhostname.test 2> ERR
+grep -q "Cannot resolve host 'badhostname.test'." ERR || {
 	echo failed
 	cat ERR
 	exit 1

#5

Perhaps a key bit of insight is that on my system, a DNS lookup of badhostname.test returns NXDOMAIN:

$ host badhostname.test
Host badhostname.test not found: 3(NXDOMAIN)

#6

The combo of patch and breadcrumbs did it!

bash-3.2$ host badhostname.test
badhostname.test has address 198.105.254.228
badhostname.test has address 198.105.244.228
Host badhostname.test not found: 3(NXDOMAIN)

And Google shows this for the IP:

Because your ISP is hijacking your DNS queries. […]
Fortunately they do have a preferences page where you can supposedly turn it off.

And I disabled hijacking and I matched your host output. Then with your patch, t.pull-push works!
Thanks!