From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 6fd8e56b for ; Thu, 28 Mar 2019 09:39:39 +0000 (UTC) Received: (qmail 9434 invoked by alias); 28 Mar 2019 09:39:23 -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: List-Unsubscribe: X-Seq: 44187 Received: (qmail 6543 invoked by uid 1010); 28 Mar 2019 09:39:23 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.1/25398. spamassassin: 3.4.2. Clear:RC:0(66.111.4.25):SA:0(-2.6/5.0):. Processed in 4.504835 secs); 28 Mar 2019 09:39:23 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:subject:content-type :content-transfer-encoding; s=fm2; bh=F6jiusmch0/NEE2fDvN6bS2Z9z iK1VWCC9sbOLY29TA=; b=jh8sFVB7d8ftOwxIHBMfAuXXHDs4sq1kzMOTKd3rAd 88cJjsRkT/oiq3J23TsP1+QtEMhE92AQxCJWFPfKauGPvnXtczHaOymW9rB1Y79+ 0cgFrKkeNNGMig3nZkv6bNE57sqr1Qr2ZzySIWquZxAjo46PlDcQAEK1EzJLD2Zl Q0ybSMLa2z7HkmoRkbPMfgBW13trQ23/ROdIn+ri/TN8T0RVFPU8R/KxPTxZSMer CtYSSDEk9/NGHLdiyxZ92b00JDtFEZVBs99EUSd9xjn0dDG5d92wv2Vv2K015b0+ h3K0BLhKH5+7Krt8d7ybxZamPlml3Kje5c3OfArn1R5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=F6jiusmch0/NEE2fDvN6bS2Z9ziK1VWCC9sbOLY29 TA=; b=MvOh//ks0073nRYc8pod46dgcBejRZmTFsm0WZFfdHSgNVHNFZlhMG65b A2xLfKq1kco26zLHdJUQYTTA1ejnXy32fM5ZqHQbLnJDl1DbA1vPLJ0xmOKxT9Ps T0obQzYrufQ7OJe1SECe4cP79kVRQxWh2DHkhsLwJWLDYJNzNAXjwCGmjuLzceDE xOpWkxznY3xJHJe5PqTiwHx6vKw0BNOV1WKTlKij7Vn8sxvd9dkkW233uQPc6Sij YL6K7APbqbFvLIhLbC6njLTa33szTRjil9ZOJgximDRtX9Y9SPU/dBXUhJjx+rSx zz1V9OQcP5qjuhqAb9LEDeBXdCHwg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrkeeggddtjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgsehtqh ertderreejnecuhfhrohhmpedfffgrnhhivghlucfuhhgrhhgrfhdfuceougdrshesuggr nhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfrrghrrghmpehmrghilhhfrhhomhepug drshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgep td X-ME-Proxy: X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.5-976-g376b1f3-fmstable-20190314v3 Mime-Version: 1.0 X-Me-Personality: 3897223 Message-Id: <38c2ebfc-f238-4f85-af76-b87c9e7f4531@www.fastmail.com> In-Reply-To: References: Date: Thu, 28 Mar 2019 05:38:42 -0400 From: "Daniel Shahaf" To: zsh-workers@zsh.org Subject: Re: [RFC] adding zmktemp command Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Clinton Bunch wrote on Wed, 27 Mar 2019 21:18 +00:00: > I'm thinking of adding a zmktemp command either in a new module (e.g.=20= > zsh/tempfile) or in the zsh/files module. ... > Thoughts? A few. - I wonder if implementing mktemp in the shell is easier than expecting people to install a third-party mktemp(1) binary with whatever functionality they desire. BSD systems often have both BSD make and GNU make, so it's conceivable that HP-UX systems could have both the native mktemp(1) and a third-party one. =20 (To be clear, I do not object to your RFC; I just wonder if there's a better solution to the underlying problem.) - There's already a gettempname() function in the shell's C implementati= on; it relies on mktemp(3) being available. A module implementation might= be able to reuse that. - O_EXCL is exposed by zsh/system's 'sysopen' builtin, so a pure zsh implementation should be possible. (I think you're aware of the following, but for the record:) There is a *limited* workaround: '() { =E2=80=A6 } =3D(:)' creates a tem= pfile (in ${TMPPREFIX:h}, if that's set). The catch is that the file is deleted when the anonymous function returns, so it's effectively a lexically scoped tempfile. And, of course, it's not a substitute for =C2=ABmktemp= -d=C2=BB. (So, no, that's not a replacement to a proper mktemp(1).) Cheers, Daniel