Closed frederickjh closed 4 years ago
I'm going to change the logic from:
export XDG_CONFIG_HOME=$XXH_HOME/.config
if [[ $HOMEPATH != '' ]]; then
# setting $HOME
fi
To:
if [[ $HOMEPATH != '' ]]; then
# setting $HOME
fi
export XDG_CONFIG_HOME=$HOME/.config
It looks more natural and expected.
I'm going to change the logic from:
export XDG_CONFIG_HOME=$XXH_HOME/.config if [[ $HOMEPATH != '' ]]; then # setting $HOME fi
To:
if [[ $HOMEPATH != '' ]]; then # setting $HOME fi export XDG_CONFIG_HOME=$HOME/.config
It looks more natural and expected.
Sorry I don't understand this change.
Why did you switch from using $XXH_HOME to $HOME to set the XDG directories?
If you do this what is the point of setting them at all?
The configuration files, data files and cache you want to all be in the $XXH_HOME so it is "hermetic".
I do not want $HOME to be the same as $XXH_HOME, which is what you have done with this code.
So with this change whatever is set with +hhh for $HOME is also set for the XDG directories.
I am going to make a pull request to change setting the XDG directories back to using $XXH_HOME.
Ah, I just figured out that this broke long before your change from $XXH_HOME to $HOME. It was when you switched from using dirname to readlink. See the reference below to 0.6.22
The configuration files, data files and cache you want to all be in the $XXH_HOME so it is "hermetic".
Let's think step by step. Validate my logic please.
For example user has Midnight Commander (mc
) on the host and user set the "dark" theme for mc. This means that in ~/.config/mc
we have dark theme settings and in ~/.local/cache/mc
we have temporary mc data. Right?
User xxh to the host with default settings. What happened when he run mc? It will be run as "first run" because ~/.xxh/.config/
and ~/.xxh/.local/
is empty. Right?
The user set the light theme and we have the light theme settings in ~/.xxh/.config/mc
. Right?
As result user has "dark mc" when he do ssh and the "light mc" when he do xxh. Right?
After time user thinks "it's not bad if I'll use my home as xxh home to avoid difference" and he add +hhh "~"
argument to config.xxhc
. After this when he xxh to the host he will be in "dark mc" forever. Right?
This looks as expected logic. Right?
Let's read the code:
export XXH_HOME=`readlink -f $CURRENT_DIR/../../../..`
export PATH=$CURRENT_DIR/fish-portable/bin:$PATH
if [[ $HOMEPATH != '' ]]; then
homerealpath=`readlink -f $HOMEPATH`
if [[ -d $homerealpath ]]; then
export HOME=$homerealpath
else
echo "Home path not found: $homerealpath"
echo "Set HOME to $XXH_HOME"
export HOME=$XXH_HOME
fi
else
export HOME=$XXH_HOME
fi
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share
export XDG_CACHE_HOME=$HOME/.cache
Here we see that if $HOMEPATH
is set (from entrypoint argumet -H
) it will change the $HOME
(to ~
for example). Otherwise the $HOME
will be $XXH_HOME
.
All what you are saying is true.
However you are binding $HOME and the XDG directories together, which I do not believe is the point of the XDG directories. The point of the XDG directories is so the user can choose where this data gets placed if they do not want it in default of $HOME.
When I work on a server I mainly work out of $HOME. I don't want to start or be brought back to $HOME/.xxh. On the other hand it would be nice if I can do rm -rf ~/.xxh
and xxh is cleaned up and gone when I am finished. With the current code this is not possible.
I believe this is a design decision, however as the code is now, this is not to my liking nor to my way of working.
I think you try to say that $HOME
, XDG and $XXH_HOME
is three different places and them should be customizable.
Could you please give me your real life example?
+hhh "~"
?+hhx
argument for XDG paths is it will work for you?When I work on a server I mainly work out of $HOME. I don't want to start or be brought back to $HOME/.xxh. On the other hand it would be nice if I can do rm -rf ~/.xxh and xxh is cleaned up and gone when I am finished. With the current code this is not possible.
May be you not clearly understand what +hhh "~"
means? It means that xxh place xxh packages to ~/.xxh
and $HOME
will be ordinary /home/user
directory. This is the behavior of xxh<0.7.0 and it should work for you. Doesn't it? If no, why?
- If we add new
+hhx
argument for XDG paths is it will work for you?
This means this logic:
xxh myhost
:
$XXH_HOME=/home/user/.xxh
$HOME=/home/user/.xxh
$XDG_...=/home/user/.xxh/...
xxh myhost +hhh "~"
:
$XXH_HOME=/home/user/.xxh
$HOME=/home/user
$XDG_...=/home/user/.xxh/...
xxh myhost +hhh "~" +hhx "~"
:
$XXH_HOME=/home/user/.xxh
$HOME=/home/user
$XDG_...=/home/user/...
Is it working for you?
I've added the logic above - https://github.com/xxh/xxh-shell-fish/commit/b56b1bad40e17c32b322407ffd3447c7edbb8724
So I've released xxh 0.7.6 with support of this logic - https://github.com/xxh/xxh-shell-fish/pull/6#issuecomment-606160402
@frederickjh it should works for you.
From the README.md
Hermetic. If you delete ~/.xxh directory from the remote host then xxh has never been on the host. If files appears outside xxh home directory feel free to report about this cases.
How can you make this claim about xxh if you allow the user to set $HOME with at least a warning that their data will then no longer be contained in the ~/.xxh
directory?
I think this project has strayed from sensible default settings. I think that they should be the following:
$HOME should be left alone. Why are we messing with it when we have the XDG directories?
$XXH_HOME = $HOME/.xxh
This is one thing I think that we agree on.
XDG Directories $XDG_CONFIG_HOME="$HOME/.xxh/.config" $XDG_DATA_HOME="$HOME/.xxh/.local/share" $XDG_CACHE_HOME="$HOME/.xxh/.cache"
I didn't complain much when you decided to set $HOME to /home/username/.xxh
by default as you added a setting for it. I would just set the three XDG directories using the +e option but only one of the environmental variable seems to get set from config.xxhc.
So no, I do not agree with the logic above. xxh should leave $HOME alone and the XDG directories by default should be inside the $XXH_HOME. The XDG directories should NOT be connected the $HOME setting.
So no, I do not agree with the logic above. xxh should leave $HOME alone and the XDG directories by default should be inside the $XXH_HOME. The XDG directories should NOT be connected the $HOME setting.
Got it! Please update to xxh 0.7.6, update xxh-shell-fish and try xxh myhost +s fish +hhh "~" +if
.
After this command it will work as you need:
$XXH_HOME=/home/user/.xxh
$HOME=/home/user
$XDG_...=/home/user/.xxh/...
Is it the solution? :)
OK, looking at the code it looks like it will work but sub-optimal defaults for on-boarding new users.
OK, looking at the code it looks like it will work but sub-optimal defaults for on-boarding new users.
I understand what you want to say. My logic is:
xxh myhost
- full hermeticxxh myhost +hhh "~"
- semi hermetic because if you run a tool that doesn't support XDG it will write to user home and you can't control itxxh myhost +hhh "~" +hhx "~"
- not hermeticI'm going to add the clarifications to README.
Done - https://github.com/xxh/xxh#how-to-set-homeuser-as-home-instead-of-homeuserxxh
Will look to feedback. @frederickjh thank you! I hope I helped you and the time will show what is the best default values.
OK, looking at the code it looks like it will work but sub-optimal defaults for on-boarding new users.
I believe I owe you an apology. For some reason I think I misread your new code handling the XDG directories. I have taken another look at the code and tested and I believe that this is now working correctly. Sorry.
No problem! We made the review and as result the logic looks more consistent.
The Fish shell package manager Fisher and others, use $XDG_DATA_HOME which by default is set to
~/.local/share
.