From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Paolo Bonzini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 16 Jul 2010 20:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 6657@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12793127506148 (code B ref -1); Fri, 16 Jul 2010 20:40:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Jul 2010 20:39:10 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZrgb-0001b7-3x for submit@debbugs.gnu.org; Fri, 16 Jul 2010 16:39:10 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZrVD-0001UW-IG for submit@debbugs.gnu.org; Fri, 16 Jul 2010 16:27:26 -0400 Received: from lists.gnu.org ([199.232.76.165]:37566) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OZrVP-0000Oh-5O for submit@debbugs.gnu.org; Fri, 16 Jul 2010 16:27:35 -0400 Received: from [140.186.70.92] (port=60564 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZrVK-0001TP-Co for bug-coreutils@gnu.org; Fri, 16 Jul 2010 16:27:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZrVB-0003dg-Py for bug-coreutils@gnu.org; Fri, 16 Jul 2010 16:27:22 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:40122) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZrVB-0003ci-LL for bug-coreutils@gnu.org; Fri, 16 Jul 2010 16:27:21 -0400 Received: by fxm20 with SMTP id 20so1479767fxm.0 for ; Fri, 16 Jul 2010 13:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=qaw+d5n1Nc8iTqzvyF05vcAPFoFbDjF9bgBBmuMjCH4=; b=A9vaT4bg3yIg+o7E/KrmEqMDact5d1EfksWLSIAvNJhCKKFuONXei1WI29lG/RZAke zmxeQYkQNYxR0CW5Mt6X1f6iUk2V9i0kw3gJCEj2N9BKi5NVSIH1SZ9/VrEAKrAg/kAB lBPgkiarBrx1tgfCUofpgC6wC6s1Qw3ftm7HQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=ps34JRAhBmWZ262rNgIgZjVL5wPvpfulSXD8tYwMgyvhTNSar3dN6RKrlbS1z/QtR2 ffDEYekUCKzfsHF02ZdFwzEUoAt8ASXVTDEgsLhZtWkuT93jRYBKw5L3u9tv5ND3J1RS JpD+6Yi7EKukmWAWRgWkB0+uXzoI/r4gTpGu0= Received: by 10.223.119.6 with SMTP id x6mr1102493faq.59.1279312040070; Fri, 16 Jul 2010 13:27:20 -0700 (PDT) Received: from yakj.usersys.redhat.com (83-215-184-40.stjo.dyn.salzburg-online.at [83.215.184.40]) by mx.google.com with ESMTPS id r10sm889088faq.5.2010.07.16.13.27.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 13:27:19 -0700 (PDT) Message-ID: <4C40C0A6.9090801@gnu.org> Date: Fri, 16 Jul 2010 22:27:18 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.9 (-----) X-Mailman-Approved-At: Fri, 16 Jul 2010 16:39:08 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) I recently got by private email a report that "sed -i" changed the line endings of the file to bare linefeeds on cygwin. The reason for this is that mkstemp on cygwin hardcodes the flags to O_EXCL|O_BINARY: http://www.cygwin.com/ml/cygwin-patches/2006-q2/msg00013.html I fixed it by using instead mkostemp(template, 0). From a quick "git grep", it seems like sort and tac are affected by the bug in coreutils. Thanks! Paolo From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 16 Jul 2010 21:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paolo Bonzini Cc: 6657@debbugs.gnu.org Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.12793168268049 (code B ref 6657); Fri, 16 Jul 2010 21:48:02 +0000 Received: (at 6657) by debbugs.gnu.org; 16 Jul 2010 21:47:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZskL-00025m-Ld for submit@debbugs.gnu.org; Fri, 16 Jul 2010 17:47:05 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZskI-00025N-HA for 6657@debbugs.gnu.org; Fri, 16 Jul 2010 17:47:03 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o6GLlFP0023489; Fri, 16 Jul 2010 14:47:15 -0700 (PDT) Message-ID: <4C40D363.7010607@cs.ucla.edu> Date: Fri, 16 Jul 2010 14:47:15 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> In-Reply-To: <4C40C0A6.9090801@gnu.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) On 07/16/10 13:27, Paolo Bonzini wrote: > I fixed it by using instead mkostemp(template, 0). From a quick "git > grep", it seems like sort and tac are affected by the bug in coreutils. tac access the temp file in binary mode, so there's no problem there. I don't see the problem with 'sort' offhand. Why would the user care whether line endings in sort's temp files are \r\n or \n? Using binary mode is a bit faster and more reliable, surely. Or is there some problem if the file descriptor is created with O_BINARY and then fdopen is called with "w" (and not "wb")? I guess "sort" does that on Cygwin now. From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Paolo Bonzini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 17 Jul 2010 06:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 6657@debbugs.gnu.org Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.127934723019787 (code B ref 6657); Sat, 17 Jul 2010 06:14:02 +0000 Received: (at 6657) by debbugs.gnu.org; 17 Jul 2010 06:13:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oa0ej-000596-CJ for submit@debbugs.gnu.org; Sat, 17 Jul 2010 02:13:49 -0400 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oa0eh-000591-6U for 6657@debbugs.gnu.org; Sat, 17 Jul 2010 02:13:47 -0400 Received: by fxm1 with SMTP id 1so1419351fxm.3 for <6657@debbugs.gnu.org>; Fri, 16 Jul 2010 23:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=P+nEc2I15hL6I1/j3AtNCVih774Vst/zSbitdMXBKrA=; b=HeOVy8ZqzxHh1yQqsU7fumpglzLjJAAqO3Wtc/PKhO7k1KnNjt+e1DbVOIbGkFyU8D UlLdP467QhPs3rzP32JoeYm55RztW2GuQEXn1IJ5B6kRXliREobkYUIwekmhLb5Vd9cT Wrq9/iJ3oHGLjXjYcRkNBD+7nV4jkvaRtZIyo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=Aigi1InD9Slg05rTn1oL7lU/4H1YgnMoLrNzO2+EWimnJzvAtL+Uq635dUVNdJaTvc Cd1qsflPA0g+PZbmgwONgKL0uKsrapcaVsVTm6zb1dL5VyUEJWWztVq+4J+3yZIOs6jT sR5cfIfQ90667McZQMIwADladVKEcKSVaLi6s= Received: by 10.223.115.201 with SMTP id j9mr1405125faq.48.1279347241612; Fri, 16 Jul 2010 23:14:01 -0700 (PDT) Received: from yakj.usersys.redhat.com (83-215-184-40.stjo.dyn.salzburg-online.at [83.215.184.40]) by mx.google.com with ESMTPS id k15sm1053506fai.40.2010.07.16.23.14.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 23:14:00 -0700 (PDT) Message-ID: <4C414A27.3090203@gnu.org> Date: Sat, 17 Jul 2010 08:13:59 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> In-Reply-To: <4C40D363.7010607@cs.ucla.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -4.3 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.7 (---) On 07/16/2010 11:47 PM, Paul Eggert wrote: > On 07/16/10 13:27, Paolo Bonzini wrote: > >> I fixed it by using instead mkostemp(template, 0). From a quick "git >> grep", it seems like sort and tac are affected by the bug in coreutils. > > tac access the temp file in binary mode, so there's no problem there. > > I don't see the problem with 'sort' offhand. Why would the user care whether > line endings in sort's temp files are \r\n or \n? Using binary mode is a > bit faster and more reliable, surely. > > Or is there some problem if the file descriptor is created with O_BINARY > and then fdopen is called with "w" (and not "wb")? I guess "sort" does > that on Cygwin now. No idea. I just thought a heads-up was in order... Paolo From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 17 Jul 2010 23:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paolo Bonzini Cc: 6657@debbugs.gnu.org, Paul Eggert Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.1279410910882 (code B ref 6657); Sat, 17 Jul 2010 23:56:02 +0000 Received: (at 6657) by debbugs.gnu.org; 17 Jul 2010 23:55:10 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaHDp-0000EB-1s for submit@debbugs.gnu.org; Sat, 17 Jul 2010 19:55:09 -0400 Received: from qmta14.emeryville.ca.mail.comcast.net ([76.96.27.212]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaHDm-0000Do-4E for 6657@debbugs.gnu.org; Sat, 17 Jul 2010 19:55:07 -0400 Received: from omta23.emeryville.ca.mail.comcast.net ([76.96.30.90]) by qmta14.emeryville.ca.mail.comcast.net with comcast id jBYg1e0051wfjNsAEBvNDb; Sat, 17 Jul 2010 23:55:22 +0000 Received: from [192.168.0.20] ([98.202.142.190]) by omta23.emeryville.ca.mail.comcast.net with comcast id jBvM1e00Q46h3c28jBvNeu; Sat, 17 Jul 2010 23:55:22 +0000 Message-ID: <4C4242B1.90500@redhat.com> Date: Sat, 17 Jul 2010 17:54:25 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> <4C414A27.3090203@gnu.org> In-Reply-To: <4C414A27.3090203@gnu.org> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig9219CF95F1821BAB9D12B6A4" X-Spam-Score: -3.8 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9219CF95F1821BAB9D12B6A4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 07/17/2010 12:13 AM, Paolo Bonzini wrote: >> I don't see the problem with 'sort' offhand. Why would the user care >> whether >> line endings in sort's temp files are \r\n or \n? Using binary mode i= s a >> bit faster and more reliable, surely. Correct. I see no reason to change sort. >> >> Or is there some problem if the file descriptor is created with O_BINA= RY >> and then fdopen is called with "w" (and not "wb")? I guess "sort" doe= s >> that on Cygwin now. >=20 > No idea. I just thought a heads-up was in order... fdopen(,"w") on cygwin honors the existing O_TEXT or O_BINARY flag of the underlying fd; while only fdopen(,"wt") and fdopen(,"wb") force the flag (and changes the flag of the underlying fd, if needed). The problem with sed was that the temp file was then being rename()d into the original file name, regardless of whether the final file should be binary or text. sort does not have the problem, because the temporary file was truly temporary - it is not renamed into a user-visible file after it is used. By the way, newer cygwin provides mkostemp() - did you only fix the problem for older cygwin that lacks mkostemp and thus gets the gnulib fallback that doesn't force binary? And what's wrong with using setmode() (from , or from gnulib's "binary-io.h") on the fd created by mkstemp() to ensure the desired mode, rather than having to use mkostemp? --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig9219CF95F1821BAB9D12B6A4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMQkKxAAoJEKeha0olJ0Nq3cQH/2Zy6RIKha2O/ZfV7yG80pd0 7osXsewaIk2J3UONgqud63hwH23XmkLM/wtS8sqcJzNuVR5E9LVFDs/Kmkk/uVgo +jGRfCWeWCEwsq1WtRazhAbEu9myX+xuHcQClC7l7mM3pgUxG5+irSr7VgNX5DNq L/M6uf346gDpU1ObP70Lf1KYPm8g9Y2vXJaNneuxGPZS1ug4KZ4k1UFZB8YFSGoy KMG918KeDmwmnQY3PqY9W+Two3J32M0udiTRHUzH4XncBunOn9emALKvaEMuX3+l lY95rTjQ+9IiHHCSljG+7FQkkTyu+WFBcs8DJDaZLoSeWNkENj6GoF3NF/dlHQ4= =JXWL -----END PGP SIGNATURE----- --------------enig9219CF95F1821BAB9D12B6A4-- From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Paolo Bonzini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 18 Jul 2010 07:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 6657@debbugs.gnu.org, Paul Eggert Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.127943756211515 (code B ref 6657); Sun, 18 Jul 2010 07:20:03 +0000 Received: (at 6657) by debbugs.gnu.org; 18 Jul 2010 07:19:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaO9i-0002zg-DZ for submit@debbugs.gnu.org; Sun, 18 Jul 2010 03:19:22 -0400 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaO9h-0002zb-9C for 6657@debbugs.gnu.org; Sun, 18 Jul 2010 03:19:21 -0400 Received: by fxm1 with SMTP id 1so1678195fxm.3 for <6657@debbugs.gnu.org>; Sun, 18 Jul 2010 00:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=/Hl1fIVcDeL+B96mnfe4Xp5PBcs5l1D1M5s60sJk490=; b=dViU1YBO8/442Kl3b/+5fbZeah8XfB3OXU9X2UBPrXGdGpge6m2wxfLO8wzIxjKdhV QYOj+3qTWsPEIjBvmgwU/la/ZeigdGmq0SN8gF8YjYkuj/p7Z4t1b4FCZUFBLFqDEY0N K4hDHu0kZNDvAanz8dUUesLDK1n+9e3z3n1CA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=SnULcqiZhvPcoAi5+Z5wlXwzoTOIaySlV4sqguAYDRHC1DSQMvtEZmOH2cFMInXccc JlLaYgxNhyTO+X6+ziqnuLXHuuTtTdRrLZ3C4ZyRo3tHE/dA+FLNAQcsO4i9BG7XfP6U RVnpsKOCawR/dq+Sa721fECbAWR78fAMnJFuE= Received: by 10.223.106.203 with SMTP id y11mr2323693fao.16.1279437578379; Sun, 18 Jul 2010 00:19:38 -0700 (PDT) Received: from yakj.usersys.redhat.com (83-215-184-40.stjo.dyn.salzburg-online.at [83.215.184.40]) by mx.google.com with ESMTPS id 14sm1487197fav.2.2010.07.18.00.19.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 18 Jul 2010 00:19:37 -0700 (PDT) Message-ID: <4C42AB06.1020205@gnu.org> Date: Sun, 18 Jul 2010 09:19:34 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> <4C414A27.3090203@gnu.org> <4C4242B1.90500@redhat.com> In-Reply-To: <4C4242B1.90500@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) On 07/18/2010 01:54 AM, Eric Blake wrote: > By the way, newer cygwin provides mkostemp() - did you only fix the > problem for older cygwin that lacks mkostemp and thus gets the gnulib > fallback that doesn't force binary? mkostemp also forces binary? That's a bug IMO, since the caller can tell Cygwin if it wants binary or text. > And what's wrong with using > setmode() (from, or from gnulib's "binary-io.h") on the fd > created by mkstemp() to ensure the desired mode, rather than having to > use mkostemp? I want the default type given by the mount point (using the mount type of /tmp is fine), can I get that? Paolo From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 19 Jul 2010 13:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paolo Bonzini Cc: 6657@debbugs.gnu.org, Paul Eggert Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.127954615432238 (code B ref 6657); Mon, 19 Jul 2010 13:30:02 +0000 Received: (at 6657) by debbugs.gnu.org; 19 Jul 2010 13:29:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaqPB-0008Nv-H9 for submit@debbugs.gnu.org; Mon, 19 Jul 2010 09:29:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaqP8-0008Nl-E5 for 6657@debbugs.gnu.org; Mon, 19 Jul 2010 09:29:11 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6JDTUYR012041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 19 Jul 2010 09:29:30 -0400 Received: from [10.11.10.21] (vpn-10-21.rdu.redhat.com [10.11.10.21]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6JDTScm004618; Mon, 19 Jul 2010 09:29:29 -0400 Message-ID: <4C445300.5060202@redhat.com> Date: Mon, 19 Jul 2010 07:28:32 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> <4C414A27.3090203@gnu.org> <4C4242B1.90500@redhat.com> <4C42AB06.1020205@gnu.org> In-Reply-To: <4C42AB06.1020205@gnu.org> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig78F34640212128FC4BA265EF" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Spam-Score: -10.1 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.1 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig78F34640212128FC4BA265EF Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 07/18/2010 01:19 AM, Paolo Bonzini wrote: > On 07/18/2010 01:54 AM, Eric Blake wrote: >> By the way, newer cygwin provides mkostemp() - did you only fix the >> problem for older cygwin that lacks mkostemp and thus gets the gnulib >> fallback that doesn't force binary? >=20 > mkostemp also forces binary? That's a bug IMO, since the caller can > tell Cygwin if it wants binary or text. In looking at it more, cygwin 1.7.5 does not provide mkostemp (although it's planned for the future). So I will make sure that when cygwin adds it, that it will allow the user to request O_TEXT or O_BINARY (forced mode), or 0 (underlying mode of mount point where file is being created); in addition it supports the O_CLOEXEC/0 option that justifies mkostemp on glibc. >=20 >> And what's wrong with using >> setmode() (from, or from gnulib's "binary-io.h") on the fd >> created by mkstemp() to ensure the desired mode, rather than having to= >> use mkostemp? >=20 > I want the default type given by the mount point (using the mount type > of /tmp is fine), can I get that? Well, the mount type of /tmp is fine only if you will be rename()ing the final file into /tmp - really, you want the default type given by the mount point of where the final file will live. But you are correct that mkostemp(,0) is the right way to get that behavior, and since mkostemp can create a file in any directory (not just /tmp), and since you can only guarantee an atomic rename() if you don't cross device boundaries (that is, you should already be creating the temporary file in the same directory as the final destination), you've convinced me that your approach of using mkostemp in sed is correct for cygwin. By the way, I don't see your patch for using mkostemp on cygwin in git://git.sv.gnu.org/sed.git; am I missing something, or is that not the latest git repository for sed? --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig78F34640212128FC4BA265EF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMRFMAAAoJEKeha0olJ0NqRN8IAKeZETEMt0FWheQ0Mi5wlHgA 3YjWJJZJADO8IfuI624rVaCJpyxNFtGViZuUvJ6Iw5kWWrENV9o/iSaio7IFrkV0 XRVEL9SUKyWel51cr1ijT+cxVxxIQGQVdOrp582x3LkoNW97VO9sKafqJB2YnZD1 kNJPdFoy8UkljzLlgsZiSdwWj1ccHDV4d9LPu0gM62eQ2VtRozEYKxIBpw5RFLFn sDigwFOoJrS7h0A4XSrsD2MuJ9JZYMa3PCWnUJ1GnNYZylqvqRRc30Cj++yS8m1c /DbQ2dplGDMmR7ayZXomjjVlCV6Emb45zKX0zQ9PLOgQZJeMcjOsEROzOQc1CQY= =3tIq -----END PGP SIGNATURE----- --------------enig78F34640212128FC4BA265EF-- From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Paolo Bonzini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 19 Jul 2010 16:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 6657@debbugs.gnu.org, Paul Eggert Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.12795570574597 (code B ref 6657); Mon, 19 Jul 2010 16:31:01 +0000 Received: (at 6657) by debbugs.gnu.org; 19 Jul 2010 16:30:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OatF2-0001C5-Ma for submit@debbugs.gnu.org; Mon, 19 Jul 2010 12:30:56 -0400 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OatF0-0001C0-Kr for 6657@debbugs.gnu.org; Mon, 19 Jul 2010 12:30:55 -0400 Received: by fxm1 with SMTP id 1so2281917fxm.3 for <6657@debbugs.gnu.org>; Mon, 19 Jul 2010 09:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=zdnc09JyMFpunjWPXmUH4SY9zZCRRKgbHwCPq0j7qmA=; b=l/RNy3CGyJ2acXUcHGOH8cQEqKq6LLxiIi/aVC5v/b7j8OtO7ulK+EbGW31vC8YaaW GeYKQwgMXrPwesWgyHLhAM+rMadnj10Cl78tPJT4DevA4cPdR4mFEGqUkslfQbBW1yhx /KYdhtEwINRPQFpXjSl7hGeocCg+9Ix/glbPg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=uQJfQs6EBZjaqQbdT5coFCP06yM6uWF/G54Ao8kcQ3OrirONAK7GxaRBKjCt6zYRcz 5g3FytHjdjFx1dZZjGCRD/+nBqtm7z9mNNIiRvwofXdEZ9LxZoT0//Ko3DOebP/bLZu8 yGTUvX1I573ouB3vRt/sDkCnHb3KlOQsPLtyg= Received: by 10.223.121.133 with SMTP id h5mr4050930far.74.1279557075329; Mon, 19 Jul 2010 09:31:15 -0700 (PDT) Received: from yakj.usersys.redhat.com (83-215-184-40.stjo.dyn.salzburg-online.at [83.215.184.40]) by mx.google.com with ESMTPS id r27sm2078755faa.24.2010.07.19.09.31.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 19 Jul 2010 09:31:13 -0700 (PDT) Message-ID: <4C447DC6.3050602@gnu.org> Date: Mon, 19 Jul 2010 18:31:02 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> <4C414A27.3090203@gnu.org> <4C4242B1.90500@redhat.com> <4C42AB06.1020205@gnu.org> <4C445300.5060202@redhat.com> In-Reply-To: <4C445300.5060202@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.2 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) On 07/19/2010 03:28 PM, Eric Blake wrote: > By the way, I don't see your patch for using mkostemp on cygwin in > git://git.sv.gnu.org/sed.git; am I missing something, or is that not the > latest git repository for sed? I wanted to make sure you liked it before pushing. :) I'll now push it. I also experimented with forcing "wt" or "wb" depending on the presence or absence of --binary, but I convinced myself that at least using "wt" is wrong. For now, I won't change the behavior of building the file in /tmp. While this may make rename not atomic, it can be "corrected" anyway by setting TMPDIR=. in the environment. By comparison, "perl -i" is implemented using unlink+open which is not atomic so it's unlikely that anyone is relying on atomicity (and also wastes quota like TMPDIR=. would do). Paolo From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 19 Jul 2010 16:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paolo Bonzini Cc: 6657@debbugs.gnu.org, Paul Eggert Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.12795572584705 (code B ref 6657); Mon, 19 Jul 2010 16:35:02 +0000 Received: (at 6657) by debbugs.gnu.org; 19 Jul 2010 16:34:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OatIH-0001Dq-03 for submit@debbugs.gnu.org; Mon, 19 Jul 2010 12:34:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OatIE-0001Dl-Dy for 6657@debbugs.gnu.org; Mon, 19 Jul 2010 12:34:15 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6JGYYB4027311 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 19 Jul 2010 12:34:34 -0400 Received: from [10.11.10.21] (vpn-10-21.rdu.redhat.com [10.11.10.21]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6JGYWTU002977; Mon, 19 Jul 2010 12:34:33 -0400 Message-ID: <4C447E5C.8040109@redhat.com> Date: Mon, 19 Jul 2010 10:33:32 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> <4C414A27.3090203@gnu.org> <4C4242B1.90500@redhat.com> <4C42AB06.1020205@gnu.org> <4C445300.5060202@redhat.com> <4C447DC6.3050602@gnu.org> In-Reply-To: <4C447DC6.3050602@gnu.org> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig45E58BC52382C6767557D641" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Spam-Score: -10.1 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.1 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig45E58BC52382C6767557D641 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 07/19/2010 10:31 AM, Paolo Bonzini wrote: > On 07/19/2010 03:28 PM, Eric Blake wrote: >> By the way, I don't see your patch for using mkostemp on cygwin in >> git://git.sv.gnu.org/sed.git; am I missing something, or is that not t= he >> latest git repository for sed? >=20 > I wanted to make sure you liked it before pushing. :) I'll now push it= =2E >=20 > I also experimented with forcing "wt" or "wb" depending on the presence= > or absence of --binary, but I convinced myself that at least using "wt"= > is wrong. >=20 > For now, I won't change the behavior of building the file in /tmp. Whil= e > this may make rename not atomic, it can be "corrected" anyway by settin= g > TMPDIR=3D. in the environment. Yuck - that means if /tmp is mounted differently than ., then using mkostemp(,0) will force the wrong line endings (converting binary to text, or converting text to binary, depending on which direction the mismatch is between the mount modes). If you aren't creating the temp file in the same mount point as the target, then you cannot blindly rely on automatic mount point file modes to do the right thing. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig45E58BC52382C6767557D641 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMRH5gAAoJEKeha0olJ0NqYDsH/1q6/o9dKeYbmaOeyEXSwoRy e7a+jm8NczZFaMTzu2v2bGe7wDMQNI3MtlklYOraOo+A7hHRStFfN0AQvgtw58dn cDt0krEbk0ykCdotChHq55iOYdaxXkirMR/Ky9I+lVhdl2IrPH1GpeyOt3xX3UdG fzMBkjIE1DLHrTuomYceL7M4M8W4I6NnPXlN5ctOJB1IP0lKk5+v4JrQh17dWI0q TJd6xXSl7PIzFcRx+WzhOFIwBTkFPCsB2D6Amnm/X7AnA+cG3lEXh8luxUggIyd+ uKeX1CiUGzAyMHWK5olEkGyAJFFV5pCkrLyZhXNX0ltEGmHuF7F1qXk+a1APaWQ= =+DA3 -----END PGP SIGNATURE----- --------------enig45E58BC52382C6767557D641-- From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Paolo Bonzini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 19 Jul 2010 16:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 6657@debbugs.gnu.org, Paul Eggert Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.12795580875170 (code B ref 6657); Mon, 19 Jul 2010 16:49:02 +0000 Received: (at 6657) by debbugs.gnu.org; 19 Jul 2010 16:48:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OatVf-0001LL-3l for submit@debbugs.gnu.org; Mon, 19 Jul 2010 12:48:07 -0400 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OatVc-0001Ky-Vk for 6657@debbugs.gnu.org; Mon, 19 Jul 2010 12:48:05 -0400 Received: by fxm1 with SMTP id 1so2290704fxm.3 for <6657@debbugs.gnu.org>; Mon, 19 Jul 2010 09:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=81T0t3f1BS5L+uRCg7dNpizRCVDM2xs1dqlYqImNHlE=; b=X2PKx0u2WWuVT6wqI0Cyp4BP4aRnxn8qouzf+XaLrXPqmwzH4u1FZH3q3EG2T6MmcU ClC/LdCmGz6OkWTHcEdechJ/JZ/kC6AjDBpyBicUTS+m8R7xXrO/aEAQ/yDV52U5FJh0 Tvqj7wz/EpBN0okbEMNUqPBQIp4B6hS3gzBOc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=YAzUgV28lr+LXtQsFxhDY4jyl+k2OJR1P9uVkBkUAeLO99NFRQ4v0adinG1l29b9/s 31cxZdLQmNiv6nfivFWiLRHNUG4Gvr+Q5lnDN9bEEume8cFAP4vywWLwVMt4pJ5ow/mS DSgxVxy9L7NKbU21jFmBbC+CGIOh68amDfq84= Received: by 10.86.92.7 with SMTP id p7mr3065357fgb.57.1279558105860; Mon, 19 Jul 2010 09:48:25 -0700 (PDT) Received: from yakj.usersys.redhat.com (83-215-184-40.stjo.dyn.salzburg-online.at [83.215.184.40]) by mx.google.com with ESMTPS id b11sm2084184faq.6.2010.07.19.09.48.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 19 Jul 2010 09:48:25 -0700 (PDT) Message-ID: <4C4481D8.4020106@gnu.org> Date: Mon, 19 Jul 2010 18:48:24 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> <4C414A27.3090203@gnu.org> <4C4242B1.90500@redhat.com> <4C42AB06.1020205@gnu.org> <4C445300.5060202@redhat.com> <4C447DC6.3050602@gnu.org> <4C447E5C.8040109@redhat.com> In-Reply-To: <4C447E5C.8040109@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) On 07/19/2010 06:33 PM, Eric Blake wrote: > Yuck - that means if /tmp is mounted differently than ., then using > mkostemp(,0) will force the wrong line endings (converting binary to > text, or converting text to binary, depending on which direction the > mismatch is between the mount modes). If you aren't creating the temp > file in the same mount point as the target, then you cannot blindly rely > on automatic mount point file modes to do the right thing. It's buggy anyway in all released versions of sed. I'll probably make the change---just, not yet. Paolo From unknown Tue Aug 19 05:09:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6657: mkstemp on cygwin creates binary files Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 19 Jul 2010 16:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6657 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paolo Bonzini Cc: 6657@debbugs.gnu.org, Paul Eggert Received: via spool by 6657-submit@debbugs.gnu.org id=B6657.12795583575278 (code B ref 6657); Mon, 19 Jul 2010 16:53:01 +0000 Received: (at 6657) by debbugs.gnu.org; 19 Jul 2010 16:52:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oata1-0001N5-7U for submit@debbugs.gnu.org; Mon, 19 Jul 2010 12:52:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OatZx-0001N0-Fg for 6657@debbugs.gnu.org; Mon, 19 Jul 2010 12:52:34 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6JGqre5022128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 19 Jul 2010 12:52:54 -0400 Received: from [10.11.10.21] (vpn-10-21.rdu.redhat.com [10.11.10.21]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6JGqqwe006538; Mon, 19 Jul 2010 12:52:52 -0400 Message-ID: <4C4482AC.5010900@redhat.com> Date: Mon, 19 Jul 2010 10:51:56 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 MIME-Version: 1.0 References: <4C40C0A6.9090801@gnu.org> <4C40D363.7010607@cs.ucla.edu> <4C414A27.3090203@gnu.org> <4C4242B1.90500@redhat.com> <4C42AB06.1020205@gnu.org> <4C445300.5060202@redhat.com> <4C447DC6.3050602@gnu.org> <4C447E5C.8040109@redhat.com> <4C4481D8.4020106@gnu.org> In-Reply-To: <4C4481D8.4020106@gnu.org> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig96A5C5D9C900417FFBF19919" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Spam-Score: -10.1 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.1 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig96A5C5D9C900417FFBF19919 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 07/19/2010 10:48 AM, Paolo Bonzini wrote: > On 07/19/2010 06:33 PM, Eric Blake wrote: >> Yuck - that means if /tmp is mounted differently than ., then using >> mkostemp(,0) will force the wrong line endings (converting binary to >> text, or converting text to binary, depending on which direction the >> mismatch is between the mount modes). If you aren't creating the temp= >> file in the same mount point as the target, then you cannot blindly re= ly >> on automatic mount point file modes to do the right thing. >=20 > It's buggy anyway in all released versions of sed. I'll probably make > the change---just, not yet. As a compromise, it is faster to at least document that the choice of TMPDIR=3D. can help fix line ending issues with 'sed -i' on cygwin, until= such time as you actually do make some change on either the default in-place location or more work on explicit mode matching when creating the temp file. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig96A5C5D9C900417FFBF19919 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMRIKsAAoJEKeha0olJ0Nq4LIIAKTnzbokSrqaVChdNNbtgxdP 9UmAYYOulz2WfR6CgOwxF8F3jbrjyVMCFnbOiGr72bMrgfyJ0iVXlz7SNyyg7ypd Gmhp+sg+xGriyU870KqXtr4CBijrVRGzs96OhcshVgMJhseyKusRlnD5Iu6cJtIL s6zWfR8a+pbEDsxkgSW+Gzl5TDJPJw6FsQoD3LmMh7R5SPV3QJcrqNgqY9bOO92i eZJ5sb17NXsfp1WX2RNi8TbbT8/UmNG+5zgD6oRUPMeAVlbYPcIHAz5EeQTJxvGQ qxmEr5JHblDqsbsLmbjH01/tcOCJMpCqpqoTe9Ei6ogwo/YIsYOcjf8hTBzKCe0= =PpaP -----END PGP SIGNATURE----- --------------enig96A5C5D9C900417FFBF19919-- From unknown Tue Aug 19 05:09:21 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Paolo Bonzini Subject: bug#6657: closed (Re: bug#6657: mkstemp on cygwin creates binary files) Message-ID: References: <87ehzk6434.fsf@rho.meyering.net> <4C40C0A6.9090801@gnu.org> X-Gnu-PR-Message: they-closed 6657 X-Gnu-PR-Package: coreutils Reply-To: 6657@debbugs.gnu.org Date: Tue, 13 Sep 2011 12:10:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1315915802-1486-1" This is a multi-part message in MIME format... ------------=_1315915802-1486-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6657: mkstemp on cygwin creates binary files which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6657@debbugs.gnu.org. --=20 6657: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6657 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1315915802-1486-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6657-done) by debbugs.gnu.org; 13 Sep 2011 12:09:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3RnV-0000Mq-Px for submit@debbugs.gnu.org; Tue, 13 Sep 2011 08:09:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3RnQ-0000MN-5V for 6657-done@debbugs.gnu.org; Tue, 13 Sep 2011 08:09:04 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8DC4W0c022526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Sep 2011 08:04:32 -0400 Received: from mx.meyering.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8DC4VeK022429; Tue, 13 Sep 2011 08:04:32 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 7141F6005B; Tue, 13 Sep 2011 14:04:31 +0200 (CEST) From: Jim Meyering To: Paolo Bonzini Subject: Re: bug#6657: mkstemp on cygwin creates binary files In-Reply-To: <4C40C0A6.9090801@gnu.org> (Paolo Bonzini's message of "Fri, 16 Jul 2010 22:27:18 +0200") References: <4C40C0A6.9090801@gnu.org> Date: Tue, 13 Sep 2011 14:04:31 +0200 Message-ID: <87ehzk6434.fsf@rho.meyering.net> Lines: 17 MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -10.4 (----------) X-Debbugs-Envelope-To: 6657-done Cc: 6657-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.4 (----------) tags 6657 notabug thanks Paolo Bonzini wrote: > I recently got by private email a report that "sed -i" changed the > line endings of the file to bare linefeeds on cygwin. The reason for > this is that mkstemp on cygwin hardcodes the flags to O_EXCL|O_BINARY: > > http://www.cygwin.com/ml/cygwin-patches/2006-q2/msg00013.html > > I fixed it by using instead mkostemp(template, 0). From a quick "git > grep", it seems like sort and tac are affected by the bug in > coreutils. Thanks for the heads up. This turned out not to be a problem with coreutils, so I'm marking this as "done". ------------=_1315915802-1486-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 Jul 2010 20:39:10 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZrgb-0001b7-3x for submit@debbugs.gnu.org; Fri, 16 Jul 2010 16:39:10 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZrVD-0001UW-IG for submit@debbugs.gnu.org; Fri, 16 Jul 2010 16:27:26 -0400 Received: from lists.gnu.org ([199.232.76.165]:37566) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OZrVP-0000Oh-5O for submit@debbugs.gnu.org; Fri, 16 Jul 2010 16:27:35 -0400 Received: from [140.186.70.92] (port=60564 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZrVK-0001TP-Co for bug-coreutils@gnu.org; Fri, 16 Jul 2010 16:27:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZrVB-0003dg-Py for bug-coreutils@gnu.org; Fri, 16 Jul 2010 16:27:22 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:40122) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZrVB-0003ci-LL for bug-coreutils@gnu.org; Fri, 16 Jul 2010 16:27:21 -0400 Received: by fxm20 with SMTP id 20so1479767fxm.0 for ; Fri, 16 Jul 2010 13:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=qaw+d5n1Nc8iTqzvyF05vcAPFoFbDjF9bgBBmuMjCH4=; b=A9vaT4bg3yIg+o7E/KrmEqMDact5d1EfksWLSIAvNJhCKKFuONXei1WI29lG/RZAke zmxeQYkQNYxR0CW5Mt6X1f6iUk2V9i0kw3gJCEj2N9BKi5NVSIH1SZ9/VrEAKrAg/kAB lBPgkiarBrx1tgfCUofpgC6wC6s1Qw3ftm7HQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=ps34JRAhBmWZ262rNgIgZjVL5wPvpfulSXD8tYwMgyvhTNSar3dN6RKrlbS1z/QtR2 ffDEYekUCKzfsHF02ZdFwzEUoAt8ASXVTDEgsLhZtWkuT93jRYBKw5L3u9tv5ND3J1RS JpD+6Yi7EKukmWAWRgWkB0+uXzoI/r4gTpGu0= Received: by 10.223.119.6 with SMTP id x6mr1102493faq.59.1279312040070; Fri, 16 Jul 2010 13:27:20 -0700 (PDT) Received: from yakj.usersys.redhat.com (83-215-184-40.stjo.dyn.salzburg-online.at [83.215.184.40]) by mx.google.com with ESMTPS id r10sm889088faq.5.2010.07.16.13.27.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 13:27:19 -0700 (PDT) Message-ID: <4C40C0A6.9090801@gnu.org> Date: Fri, 16 Jul 2010 22:27:18 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: mkstemp on cygwin creates binary files Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 16 Jul 2010 16:39:08 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) I recently got by private email a report that "sed -i" changed the line endings of the file to bare linefeeds on cygwin. The reason for this is that mkstemp on cygwin hardcodes the flags to O_EXCL|O_BINARY: http://www.cygwin.com/ml/cygwin-patches/2006-q2/msg00013.html I fixed it by using instead mkostemp(template, 0). From a quick "git grep", it seems like sort and tac are affected by the bug in coreutils. Thanks! Paolo ------------=_1315915802-1486-1--