zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint3@fastmail.com>
To: zsh-workers@zsh.org
Subject: Cannot write to zsystem flock's descriptor
Date: Wed, 01 Mar 2017 02:49:45 -0800	[thread overview]
Message-ID: <1488365385.3896802.896627648.08162014@webmail.messagingengine.com> (raw)

Hello,

# echo "test" > file
# zsystem flock -t 0 -f MY_FD "file"; echo $?
0
# echo a>&${MY_FD}
zsh: 11: bad file descriptor
# exec {MY_FD}>&-
(works, lock also works)

I've added debug logs to system.c and there is:

Read-write flags, 2 (O_RDWR) | 131072 (O_NOCTTY) = 131074
Before move fdflags 0
After move fdflags 0
After cloexec fdflags 1
lck.l_type RD:1, WR:3, is:3

So it looks good. When locking via "flock" util-linux program I can
write to the FD. What could it be? 

    if ((flock_fd = open(unmeta(args[0]), flags)) < 0) {

flags are like first line of debug message. I think it's open() that
matters.

-- 
  Sebastian Gniazdowski
  psprint3@fastmail.com


             reply	other threads:[~2017-03-01 10:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01 10:49 Sebastian Gniazdowski [this message]
2017-03-01 17:32 ` Bart Schaefer

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=1488365385.3896802.896627648.08162014@webmail.messagingengine.com \
    --to=psprint3@fastmail.com \
    --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).