cqfd: use CQFD_HISTFILE#250
Conversation
56bd06d to
7907f4f
Compare
|
If we specify the variable CQFD_HISTFILE, should we bind mount this file in all cases ? For now, a histfile is bind mounted only if we detect which shell is currently in use, for example when using But maybe we can consider that if a file was specified using CQFD_HISTFILE then it would make sense to bind mount it in all cases, whatever command is used after cqfd |
7aa0ae6 to
ef46e16
Compare
7907f4f to
00d906a
Compare
ef46e16 to
54a337a
Compare
2ffe904 to
b14941d
Compare
54a337a to
ff86f51
Compare
b14941d to
e9a0753
Compare
e9a0753 to
9c653f4
Compare
The variable HISTFILE is not exported in most shells so cqfd cannot read it. And if we don’t use the same shell on the host and in cqfd then we don’t want to share the histfile. So it is more convenient to use this variable to set the HISTFILE in cqfd
9c653f4 to
c204b14
Compare
This will be the object of another PR |
|
|
||
| `CQFD_SHELL`: The shell to be launched, by default `/bin/sh`. | ||
|
|
||
| `CQFD_HISTFILE`: This file will be used as the shell history file for all the |
There was a problem hiding this comment.
If I'm correct, CQFD_DISABLE_SHELL_HISTORY was broken and didn't work unless the shell exported HISTFILE, which none do? Which shells did?
Maybe we can remove CQFD_DISABLE_SHELL_HISTORY and rather infer it as long as CQFD_HISTFILE is provided?
I think a traditional container approach is NOT to bind the host history by default. If we want to bind a host persistent history file by default, it could be a cqfd specific one, unless CQFD_HISTFILE explicitly points to the user's main history. By default, it could be ~/.cqfd_history
There was a problem hiding this comment.
CQFD_DISABLE_SHELL_HISTORY was working as expected:
cqfd bash -> bind mounts the default bash history file -> I can use up arrow to navigate history
CQFD_DISABLE_SHELL_HISTORY=true cqfd bash -> does not bind mount the default bash history file -> up arrow does nothing
it is just that cqfd was trying to read HISTFILE to set the file to bind mount, but if HISTFILE did not exist then it used the default path of the shell history file for different shells:
But no shell is exporting HISTFILE, so cqfd was always using the default value provided to bind mount the history file.
This PR was just about fixing this behavior which made cqfd always use the default hardcoded histfile path because HISTFILE is never exported.
It is true that we should discuss about which file we bind mount (project-specific, cqfd-specific or user one), and in which circumstances (by default or not), but this PR just intended to fix an erratic behavior.
A simpler version of this PR could also just remove the variables HISTFILE and CQFD_HISTFILE to only use default values hardcoded in cqfd, which is the current behavior.
There was a problem hiding this comment.
Ok, I don't fully agree with the decision to bind the host history file as a default behaviorr, but since it has already been merged, a fix is welcome.
I have concerns regarding the pollution of the host history, or exposing sensitive commands information inside the container.
There was a problem hiding this comment.
I configured my own environment to have a default separate file for cqfd history: ~/.cqfd_history. If other users/maintainers agree, we could turn this into a default.
The variable HISTFILE is not exported in most shells so cqfd cannot read it. And if we don’t use the same shell on the host and in cqfd then we don’t want to share the histfile. So it is more convenient to use CQFD_HISTFILE to set the HISTFILE in cqfd