Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVhNj-0000BC-OM for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2017 16:54:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dVhNj-0008Pb-4N for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2017 16:54:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dVhNg-0008Kx-VK; Thu, 13 Jul 2017 16:54:25 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dVhNY-0008Ve-Cm; Thu, 13 Jul 2017 16:54:24 +0000 Received: by mail-lf0-x243.google.com with SMTP id f28so6221068lfi.3; Thu, 13 Jul 2017 09:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=OKgq+8zibLcdBuAcEa6WsAEYsfYIh1UdHljelP76Nwk=; b=TK0bncwYmwydf9Xsz3wJpzelAt1Vf+zZmlRC59GbdgRRoxmfyw6umxItT7jNArPX3v fLYvdrbxKTkE5d5Qr9if41RTM9pfHIwTzN1ujqTjoyJITRlrKMP2C0iFrM5cIzZ859A8 lLayZzlkGP5jUM7GUjE/G0epwu60rbgaJM7DkiR4iDrOT+uvyk1oYgJPsTB/JMrTUz2B l0bGMCpuR8OHIkZ0y1R7mNkQENny6gz03ADN+uuiqfYzeuH9WjJYZSFul1ozzIYMFH11 wzaPbi4F6rwue5jL0e3xXhpcZhZwBkFVqlrlDthSrn7UVWjsjXJZr4f/jh4jxvxZ4Amn zDag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=OKgq+8zibLcdBuAcEa6WsAEYsfYIh1UdHljelP76Nwk=; b=ku1roMok6yxRlz7jWxBHh8aAtmQKHSYRlWh2euwJO5tvZZHowB3uOieBhHe0mDp+Ne Obz4sRKj7lyiqiDKDUl6dSfY3NFR/hQcwSdURnDCPQVYNSmcdEvMuGnJfzAhzfuRjxg3 X2Fsp+kaK1p4JVtEUTbavNcJjYywz96mzIhMIMdFT63sQSuBVkeKiO0wNUVoH+R3SCJR CPjZ3PGNnZUb0vwPAOlfftZOQSGgU3noRHJ48ht2E0ciSPRXOw15/mKnfG08O3EJZYUT 1aLiBnK8tdscA0ahpEz8Bnk+U8E2LRza8kjbEWfVqJlREoPyUsrTBlol3u0/rYwwixWT b8xQ== X-Gm-Message-State: AIVw111RfXpNNHhaBalm284ICSRHFknuCCDdZT5G2rYZujnfPpU4LOYH UJSKdkUmZQu7pR7H X-Received: by 10.25.192.2 with SMTP id q2mr1868854lff.120.1499964853703; Thu, 13 Jul 2017 09:54:13 -0700 (PDT) Received: from [192.168.44.233] (dsl-hkibng32-54fb4e-103.dhcp.inet.fi. [84.251.78.103]) by smtp.gmail.com with ESMTPSA id x83sm1365343lfa.13.2017.07.13.09.54.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 09:54:13 -0700 (PDT) Subject: Re: [BUGS] BUG #14634: On Windows pg_basebackup should write tar to stdout in binary mode To: Haribabu Kommi , henry_boehlert@agilent.com References: <20170428082818.24366.13134@wrigleys.postgresql.org> Cc: "pgsql-bugs@postgresql.org" , "pgsql-hackers@postgresql.org" From: Heikki Linnakangas Message-ID: <931e755b-02df-d504-e5ad-eaeaa6ab9cd3@iki.fi> Date: Thu, 13 Jul 2017 19:54:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 05/03/2017 07:32 AM, Haribabu Kommi wrote: > [Adding -hackers mailing list] > > On Fri, Apr 28, 2017 at 6:28 PM, wrote: > >> The following bug has been logged on the website: >> >> Bug reference: 14634 >> Logged by: Henry Boehlert >> Email address: henry_boehlert@agilent.com >> PostgreSQL version: 9.6.2 >> Operating system: Windows Server 2012 R2 6.3.9600 >> Description: >> >> Executing command pg_basebackup -D -F t writes its output to stdout, which >> is open in text mode, causing LF to be converted to CR LF thus corrupting >> the resulting archive. >> >> To write the tar to stdout, on Windows stdout's mode should be temporarily >> switched to binary. >> >> https://msdn.microsoft.com/en-us/library/tw4k6df8.aspx >> > > Thanks for reporting the issue. > With the attached patch, I was able to extract the tar file that gets > generated when the tar file is written into stdout. I tested the > the compressed tar also. > > This bug needs to be fixed in back branches also. Seems reasonable. One question: In the patch, you used "_setmode" function, while the calls in src/bin/pg_dump/pg_backup_archiver.c use "setmode". There are a few places in the backend that also use "_setmode". What's the difference? Should we change some of them to be consistent? - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers