zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>,
	Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: PATCH: sysopen (was Re: '>>' does not create file if set -C (noclobber) is active)
Date: Thu, 30 Jul 2015 13:05:53 +0200	[thread overview]
Message-ID: <CAHYJk3SNqwFQ5E11E=Jx6btgrvJ9o8roQNVefKMc-o3PkQcEww@mail.gmail.com> (raw)
In-Reply-To: <20150724125516.64006bb5@pwslap01u.europe.root.pri>

On Fri, Jul 24, 2015 at 1:55 PM, Peter Stephenson
<p.stephenson@samsung.com> wrote:
> Also, I suppose we should say something like...
>
> (although adding sysclose isn't necessarily a bad thing)
>
> pws
>
> diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo
> index e4d4c31..b9b07bb 100644
> --- a/Doc/Zsh/mod_system.yo
> +++ b/Doc/Zsh/mod_system.yo
> @@ -68,6 +68,11 @@ item(tt(trunc))(
>  truncate file to size 0
>  )
>  enditem()
> +
> +To close the file, use one of the following:
> +
> +example(tt(exec {)var(fd)tt(}<&-)
> +tt(exec {)var(fd)tt(}>&-))
>  )
>  findex(sysread)
>  redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi(        )))

I remembered this being mentioned and was looking through the docs
because I always forget where the & goes, but it looks like you never
committed it. It is mentioned in the paragraph about zsystem flock
though.

Was there a reason the new commands were not made subcommands to
zsystem? I don't see any rationale in the commit message. An advantage
would be that "zsystem supports foo" already will tell you that foo is
not a recognized subcommand. We could add the sysopen/tell/close/seek
commands to zsystem supports anyway, even though they're not
subcommands.

> One very minor comment now I've tried this:
>
> % sysread -i fd
> sysread: integer expected: fd
>
> I think it would probably be appropriate and consistent with other
> similar contexts for this to do matn eval, even though the workaround is
> obvious and trivial.

I feel like this might be slightly dangerous, as if you get used to fd
being treated as an integer here, you may try sysopen -u fd and it
will silently use another fd and assign to your parameter instead.


It also looks like the -u option for sysopen is not optional, so it
shouldn't be listed in [ ].

--- i/Doc/Zsh/mod_system.yo
+++ w/Doc/Zsh/mod_system.yo
@@ -31,7 +31,7 @@ not recognised (no message is printed for this).
 findex(sysopen)
 redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi(        )))
 xitem(tt(sysopen) [ tt(-arw) ] [ tt(-m) var(permissions) ] [ tt(-o)
var(options) ])
-item(SPACES()[ tt(-u) var(fd) ] var(file))(
+item(SPACES()tt(-u) var(fd) var(file))(
 This command opens a file. The tt(-r), tt(-w) and tt(-a) flags indicate
 whether the file should be opened for reading, writing and appending,
 respectively. The tt(-m) option allows the initial permissions to use when


-- 
Mikael Magnusson


  reply	other threads:[~2015-07-30 11:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25  1:02 '>>' does not create file if set -C (noclobber) is active Martijn Dekker
2015-06-25  1:49 ` Bart Schaefer
2015-06-25  2:22   ` Martijn Dekker
2015-06-25  7:30     ` Bart Schaefer
2015-06-25 14:04       ` Stephane Chazelas
2015-06-25 16:00         ` Bart Schaefer
2015-06-25 19:20           ` Chet Ramey
2015-06-26 14:14       ` Martijn Dekker
2015-06-26 20:15         ` Bart Schaefer
2015-06-27  1:54           ` Martijn Dekker
2015-06-27  3:38             ` Bart Schaefer
2015-06-27 17:02         ` Peter Stephenson
2015-06-28  0:02           ` Martijn Dekker
2015-06-28  0:46             ` Martijn Dekker
2015-06-28  7:48             ` Stephane Chazelas
2015-06-28  9:15               ` Oliver Kiddle
2015-06-28 14:00                 ` Stephane Chazelas
2015-06-28 18:38                   ` Bart Schaefer
2015-06-28 19:30                     ` Stephane Chazelas
2015-07-23  2:56                     ` PATCH: sysopen (was Re: '>>' does not create file if set -C (noclobber) is active) Oliver Kiddle
2015-07-24 10:57                       ` Peter Stephenson
2015-07-24 11:55                         ` Peter Stephenson
2015-07-30 11:05                           ` Mikael Magnusson [this message]
2015-07-31 12:41                         ` Oliver Kiddle
2015-07-31 14:02                           ` Mikael Magnusson
2015-06-28 17:19             ` '>>' does not create file if set -C (noclobber) is active Peter Stephenson

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='CAHYJk3SNqwFQ5E11E=Jx6btgrvJ9o8roQNVefKMc-o3PkQcEww@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=okiddle@yahoo.co.uk \
    --cc=p.stephenson@samsung.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).