Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Patch to zsystem flock documentation
- X-seq: zsh-workers 44156
- From: Clinton Bunch <cdb_zsh@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Patch to zsystem flock documentation
- Date: Thu, 21 Mar 2019 11:37:45 -0500
- Dkim-filter: OpenDKIM Filter v2.11.0 heimdall.zentaur.org x2LGdBAr012162
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zentaur.org; s=default; t=1553186352; bh=NF/uRf7vR5Hv70xgILlPAWIo2JJAT9iX/srP1hnxaQI=; h=To:From:Subject:Date:From; b=F6DRSZglFgDgNU3lK7mTtU49Z2Bk7rc6Lr/OzJ3dVD1tmd3c43Sb71jiFogfzLlcK 9be3Rk0hD3HkpQJ+U+SY8YXH+shWij75ruK4T1YQG2OlSxYkdpfa7q+i9oVp/rwXQy NCSMWlk9pJOOdFygUH0zEGs4CYedpxccZtKagr6g=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This is a patch to the yodl documention for the zsh/system module's
zsystem flock section to note that use of the builtin print with -u
option has the side-effect of releasing the lock made by flock. It also
mentions using a sub-shell redirected to the filename as a workaround.
This should be documented since updating the file is one of the reasons
one might use flock.
--- zsh-5.7.1/Doc/Zsh/mod_system.yo.old 2018-12-14 01:50:17.000000000 -0600
+++ zsh-5.7.1/Doc/Zsh/mod_system.yo 2019-03-20 10:55:44.004627151 -0500
@@ -177,8 +177,11 @@
the file descriptor. The lock terminates when the shell process that
created the lock exits; it is therefore often convenient to create file
locks within subshells, since the lock is automatically released when
-the subshell exits. Status 0 is returned if the lock succeeds, else
-status 1.
+the subshell exits. Note that use of the print builtin with -u option will,
+as a side effect, release the lock, as will redirection to the file in the
+shell holding the lock. To work around this use a subshell, e.g.
+(print "message") >> var(file). Status 0 is returned if the lock succeeds,
+else status 1.
In the second form the file descriptor given by the arithmetic
expression var(fd_expr) is closed, releasing a lock. The file descriptor
Messages sorted by:
Reverse Date,
Date,
Thread,
Author