zsh-users
 help / color / mirror / Atom feed
* shared history file
@ 2021-10-02 17:52 Pier Paolo Grassi
  2021-10-02 17:54 ` Pier Paolo Grassi
  2021-10-02 23:12 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Pier Paolo Grassi @ 2021-10-02 17:52 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

Hello, I was trying to implement a per project shell history file.
Some of these projects are on windows shared mounted via cifs. when I open
those files as history with fc -p I get:

/root/.zshrc:440: locking failed for /mnt/docs/projects/devbox/.history:
operation not supported: reading anyway
zsh: locking failed for  /mnt/docs/projects/devbox/.history: operation not
supported: reading anyway

Is it possible to work around this? is it possibile in zsh to disable
locking the history file during write operations? I am the only one writing
to those files so I shouldn't risk a concurrent operation.
I tried using setopt HIST_FCNTL_LOCK but ended up with an emptied history
file.

Pier Paolo Grassi

[-- Attachment #2: Type: text/html, Size: 1009 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared history file
  2021-10-02 17:52 shared history file Pier Paolo Grassi
@ 2021-10-02 17:54 ` Pier Paolo Grassi
  2021-10-02 23:12 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Pier Paolo Grassi @ 2021-10-02 17:54 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]

I forgot to mention that, while I was able to read the history file, the
new commands typed were not written to it, and this is the problem I would
like to solve
thanks

Pier Paolo Grassi


Il giorno sab 2 ott 2021 alle ore 19:52 Pier Paolo Grassi <
pierpaolog@gmail.com> ha scritto:

> Hello, I was trying to implement a per project shell history file.
> Some of these projects are on windows shared mounted via cifs. when I open
> those files as history with fc -p I get:
>
> /root/.zshrc:440: locking failed for /mnt/docs/projects/devbox/.history:
> operation not supported: reading anyway
> zsh: locking failed for  /mnt/docs/projects/devbox/.history: operation not
> supported: reading anyway
>
> Is it possible to work around this? is it possibile in zsh to disable
> locking the history file during write operations? I am the only one writing
> to those files so I shouldn't risk a concurrent operation.
> I tried using setopt HIST_FCNTL_LOCK but ended up with an emptied history
> file.
>
> Pier Paolo Grassi
>

[-- Attachment #2: Type: text/html, Size: 1730 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared history file
  2021-10-02 17:52 shared history file Pier Paolo Grassi
  2021-10-02 17:54 ` Pier Paolo Grassi
@ 2021-10-02 23:12 ` Bart Schaefer
  2021-10-02 23:19   ` Pier Paolo Grassi
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2021-10-02 23:12 UTC (permalink / raw)
  To: Pier Paolo Grassi; +Cc: Zsh-Users List

On Sat, Oct 2, 2021 at 10:53 AM Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> is it possibile in zsh to disable locking the history file during write operations? I am the only one writing to those files so I shouldn't risk a concurrent operation.

The lock mechanism is not to protect against multiple users writing
those files, it's to protect against multiple zsh processes writing to
the files.  E.g. if you have more than one window open on the same
"project", both zsh might attempt to write the file, even though you
are "the only one" who needs to write.

The problem here seems to be that your host system has symbolic links,
so zsh is compiled to use that locking mechanism, but the remote
server doesn't support creating one.

Your best bet is to store the project history in a directory where a
symbolic link can be created, instead of storing it inside the
remote-mounted directory.

The ~/.zlogin file is sourced before, and the ~/.zlogout file after,
reading/saving history respectively, so if you need to copy the file
contents from/to the remote directory to/from the file used by the
current shell, you can do so there ... or in whatever other functions
etc. you are using to keep track of which project you're in.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shared history file
  2021-10-02 23:12 ` Bart Schaefer
@ 2021-10-02 23:19   ` Pier Paolo Grassi
  0 siblings, 0 replies; 4+ messages in thread
From: Pier Paolo Grassi @ 2021-10-02 23:19 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]

thanks, I was hoping for a different answer but it is what it is

Il giorno dom 3 ott 2021 alle 01:12 Bart Schaefer <schaefer@brasslantern.com>
ha scritto:

> On Sat, Oct 2, 2021 at 10:53 AM Pier Paolo Grassi <pierpaolog@gmail.com>
> wrote:
> > is it possibile in zsh to disable locking the history file during write
> operations? I am the only one writing to those files so I shouldn't risk a
> concurrent operation.
>
> The lock mechanism is not to protect against multiple users writing
> those files, it's to protect against multiple zsh processes writing to
> the files.  E.g. if you have more than one window open on the same
> "project", both zsh might attempt to write the file, even though you
> are "the only one" who needs to write.
>
> The problem here seems to be that your host system has symbolic links,
> so zsh is compiled to use that locking mechanism, but the remote
> server doesn't support creating one.
>
> Your best bet is to store the project history in a directory where a
> symbolic link can be created, instead of storing it inside the
> remote-mounted directory.
>
> The ~/.zlogin file is sourced before, and the ~/.zlogout file after,
> reading/saving history respectively, so if you need to copy the file
> contents from/to the remote directory to/from the file used by the
> current shell, you can do so there ... or in whatever other functions
> etc. you are using to keep track of which project you're in.
>
-- 
Pier Paolo Grassi

[-- Attachment #2: Type: text/html, Size: 2048 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-02 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 17:52 shared history file Pier Paolo Grassi
2021-10-02 17:54 ` Pier Paolo Grassi
2021-10-02 23:12 ` Bart Schaefer
2021-10-02 23:19   ` Pier Paolo Grassi

zsh-users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/zsh-users

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-users zsh-users/ https://inbox.vuxu.org/zsh-users \
		zsh-users@zsh.org
	public-inbox-index zsh-users

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git