Skip to content

Comments

add support for plan9#744

Closed
mjl- wants to merge 3 commits intolib:masterfrom
mjl-:master
Closed

add support for plan9#744
mjl- wants to merge 3 commits intolib:masterfrom
mjl-:master

Conversation

@mjl-
Copy link
Contributor

@mjl- mjl- commented Apr 23, 2018

Make this compile (and work) by adding a file user_plan9.go. It's nearly identical to the posix version.

On plan9 the test TestCloseBadConn in conn_test.go was failing. The hardcoded localhost:5432 won't work (postgres isn't available on plan9). The README already encourages you to use environment variables to override database connection parameters, so this patch makes the code look at env vars.

mjl- added 2 commits April 23, 2018 15:00
user_plan9.go is almost identical to user_posix.

test about failing bad connection is failing on plan9, more in a next commit.
i ran into this while adding plan9 support (postgres doesn't run on plan9).

unrelated, this test is still broken on plan9:

	conn_test.go:769: expected use of closed error, got write tcp 192.168.178.144:55579->192.168.178.38:5432: bad arg in system call

tcp closing apparently works slightly differently on plan9, where
it doesn't return the error string expected by the tests.
no big deal, and this patch improves the general situation.
conn_test.go Outdated
if port == "" {
port = "5432"
}
addr := host + ":" + port

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

net.JoinHostPort? (in case host is v6 for some reason)

would make it work with ipv6 ip addresses.
suggested by roger chen in pull request comment.
@mjl-
Copy link
Contributor Author

mjl- commented Apr 25, 2018

can someone restart the build?
it failed due to golint missing (externally, which has been fixed, see golang/lint#397).

@arp242
Copy link
Collaborator

arp242 commented Dec 31, 2025

In #952, Plan 9 support was added via user_posix.go rather than creating a new user_plan9.go. The only difference seems to be the casing of the environment variable. Does it need to be lower-case?

The test was fixed in #905.

@arp242 arp242 added the needs-feedback Requires feedback to be actionable label Dec 31, 2025
@mjl-
Copy link
Contributor Author

mjl- commented Jan 11, 2026

The only difference seems to be the casing of the environment variable. Does it need to be lower-case?

Yes, in plan9 the standard environment variables are in lower case. See "$user" and "$home" in https://9p.io/magic/man2html/1/intro.

But, it's probably fine to not make further changes. user.Current should
normally just succeed. It would only fail if something was wrongly set up in
the environment, and the user/developer can just fix their environment. The
fixed test (looking at the PG-env vars) also look good.

So, I suggest we just close this PR. Thanks for looking at this, and for
working on lib/pq.

@arp242
Copy link
Collaborator

arp242 commented Jan 13, 2026

Okay, I changed it to lower-case for Plan 9 with #1233. Maybe not necessary, but easy enough to do so might as well.

@arp242 arp242 closed this Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-feedback Requires feedback to be actionable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants