9fans / plan9port

Plan 9 from User Space
https://9fans.github.io/plan9port/
Other
1.64k stars 326 forks source link

Conflict between man pages and binaries on $home and $HOME #386

Closed colinhb closed 4 years ago

colinhb commented 4 years ago

The acme(1) man page states that it dumps to $home/acme.dump, but acme.c reads "HOME" from the environment (not "home"). There is a similar conflict between the plumber(1) man page and plumber.c for the plumbfile ($home/lib/plumber).

I think the man pages should be consistent with the binaries, and I could put together a PR for that. However, I prefer the behavior of rc (via rcmain), which is to set $home equal to $HOME if unset before sourcing $home/lib/profile. This behavior allows $home and $HOME to be separated.

Two options to allow this separation for the rest of plan9port:

Of these options, I prefer the second. Either one could break people's current installations, if $home and $HOME are set to different values, but I think the second leads to fewer surprises than the first.

Thoughts? I searched the mailing list and issue tracker, but wasn't able to find any discussion of this issue. Apologies if I've overlooked anything.

fhs commented 4 years ago

Why do you separate $home and $HOME, just curious?

colinhb commented 4 years ago

My interest is really the conflict between the docs and commands; I want to help fix that, regardless of the solution.

That said: I've used workarounds for the paths set in the binaries that are rooted in $home. For example, to avoid having my plumbing file at $HOME/lib/plumbing (which is the case when $home=$HOME), I've used a wrapper script that looks for a plumbing file in another location and loads it from there, if it finds it.

If the plan9port binaries read/respected/preferred $home, I could set $home to (e.g.) $HOME/.plan9 and wouldn't have to use these kind of wrapper scripts, and the paths specified in the binaries would all be useful / the behavior consistent across commands. Also, I don't think there's a sane workaround for the default acme dump file.

I started tinkering with this in a branch: https://github.com/9fans/plan9port/compare/master...colinhb:homes

colinhb commented 4 years ago

I was wrong about plumber(1) -- not sure how. Struck that out of my first comment. I'll go back through the man pages, but if the acme(1) man page on the dump file is the only one with an inconsistency, I'll just submit a PR changing $home/acme.dump to $HOME/acme.dump in the man page.