From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6298 invoked by alias); 31 Jul 2015 12:48:11 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35963 Received: (qmail 18124 invoked from network); 31 Jul 2015 12:48:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1438346494; bh=Szv3UYirP5ny4uZjHy13QeDeshCyyXtW7RkKcAL2aEQ=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=a5a4FAVh1aX/sYLUB3BZ+ubQ9kHKLdS/p3zz1iqPoWdWebvTS5P3/y4LIEGk4BrGN0dMVYx8G8biiR9Ci8uSdDFbU+DNnK8y8DmTa0z5XCle3he5iBDbMrz4j+AIq/Zo7oXJjzROVXK6+WuAuduk+ZAcOUquziWL6iBP84W/sNCoAiqn1qGmJkyfmFEY9KG/Eywl0aAGnkShLfN4htLLdwES/+q8qjD8HKl7baggF5xrxXnnr65gk+Pb7MqVTgO2s5FKoJEym6FdSLcWg584BWzfq3WuSaTDO4EYNvoHh56tSJ2ZfmlegiBguWQ3ygGRHmfwkKi2cURNBN0Dz+ozfw== X-Yahoo-Newman-Id: 571804.64920.bm@smtp103.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: EevsAPMVM1koSx81fx1il7_Dqgv5pVwMw2F5uzZy9yVywzM 61BjTKdH1h8BSwySJPGhUlTl1mDBfDiFxI35_WRVpM4TZg.eEwIGY4eELOCo aNDxuekdzrNl85nfxLVfD_Fv8XB_1ta.bIylRV8nHFf3avi9TaTKwzqTwCWq MJdCi422RcTsZMc5mCnjTMFcepNNaMR.rkSqE0x8INKRCENUNbxVoPBklGE6 x9644AfRfcnspMn3sOaOxNFQfyp09RNPLzLdJwvzd1mxq4LDqr0mGsLhfKFV 54Ns2A_PX1_jOo.7No4uJccSZsG55y5RKC26OTEO_YVp0Le_TWgBRs0VGFkn qspxfDU.H60yMblvTMkKP0Y3uKjWdoP.d38xltinCUQNaSyN4jYI5KqEV4Ri 4JMpWNnVO1mGVp6Hu6jrKCNnH3IK8mlXt6VsA3E2HhDtXgnR4P8rAUnaQKyS l7yJZgQMZBTZFesZAa4JX.RJ.rzQo_jFyJ3N79PIAMehFWzXR3qYY4fFXTIw o6dRnFjKH96QxZYo_r50ukdq5G2GS1w-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <20150724115733.44531b77@pwslap01u.europe.root.pri> From: Oliver Kiddle References: <558B5342.2090706@inlv.org> <150624184916.ZM19079@torch.brasslantern.com> <558B65EB.3060204@inlv.org> <150625003047.ZM19218@torch.brasslantern.com> <558D5E34.3020505@inlv.org> <20150627180230.5fda7e09@ntlworld.com> <558F397D.9030708@inlv.org> <20150628074837.GB4818@chaz.gmail.com> <16434.1435482953@thecus.kiddle.eu> <20150628140050.GA10570@chaz.gmail.com> <150628113814.ZM1638@torch.brasslantern.com> <23516.1437620218@thecus.kiddle.eu> <20150724115733.44531b77@pwslap01u.europe.root.pri> To: zsh-workers@zsh.org Subject: Re: PATCH: sysopen (was Re: '>>' does not create file if set -C (noclobber) is active) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31987.1438346493.1@thecus.kiddle.eu> Date: Fri, 31 Jul 2015 14:41:33 +0200 Message-ID: <31988.1438346493@thecus.kiddle.eu> On 24 Jul, Peter wrote: > 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. C.f. "sysopen -u fd" (though of course there's no > choice in that case) and > > % print $(( systell(fd) )) > 8192 > > However, we're not actually missing anything by not. I don't have a strong opinion either way on this. This could apply to print and read just as much as sysread, syswrite and sysseek. By the way, I'm happy with both documentation patches. Mikael wrote: > Was there a reason the new commands were not made subcommands to > zsystem? sysread and syswrite are not zsystem subcommands. What is the purpose of zsystem (as opposed to a direct sysflock)? Is it that flock is not supported by some common systems? Coverity noticed that I'd made one part more complicated than it needs to be so this cleans that up (the !append was tautologous). Oliver diff --git a/Src/Modules/system.c b/Src/Modules/system.c index a1ed33a..1ab1fb1 100644 --- a/Src/Modules/system.c +++ b/Src/Modules/system.c @@ -311,8 +311,7 @@ bin_sysopen(char *nam, char **args, Options ops, UNUSED(int func)) int write = OPT_ISSET(ops, 'w'); int append = OPT_ISSET(ops, 'a') ? O_APPEND : 0; int flags = O_NOCTTY | append | ((append || write) ? - (read ? O_RDWR : O_WRONLY) : - (!append || read) ? O_RDONLY : O_WRONLY); + (read ? O_RDWR : O_WRONLY) : O_RDONLY); char *opt, *ptr, *nextopt, *fdvar; int o, fd, explicit = -1; mode_t perms = 0666;