From: Clinton Bunch <cdb_zsh@zentaur.org>
To: zsh-workers@zsh.org
Subject: Patch to zsystem flock documentation
Date: Thu, 21 Mar 2019 11:37:45 -0500 [thread overview]
Message-ID: <01ace825-a6f7-101f-6820-b000f366e60e@zentaur.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
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.
[-- Attachment #2: flock_print_doc.patch --]
[-- Type: text/plain, Size: 920 bytes --]
--- 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
next reply other threads:[~2019-03-21 16:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-21 16:37 Clinton Bunch [this message]
2019-03-22 22:18 ` dana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01ace825-a6f7-101f-6820-b000f366e60e@zentaur.org \
--to=cdb_zsh@zentaur.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).