Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1db9sd-0005vR-C4 for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jul 2017 18:20:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1db9sc-0002jL-QA for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jul 2017 18:20:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1db9r6-0008Ka-8Q for pgsql-hackers@postgresql.org; Fri, 28 Jul 2017 18:19:20 +0000 Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1db9r3-0001us-6Y for pgsql-hackers@postgresql.org; Fri, 28 Jul 2017 18:19:18 +0000 Received: by mail-qk0-x235.google.com with SMTP id d145so116963185qkc.2 for ; Fri, 28 Jul 2017 11:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=hpQi3hP3QUHFJwKzJBpdep12T+szWdc1AVVZT8Jcy2g=; b=Qt8c2NuBsmeMfFyNBy9sjwPAj3QPd7HpQQocewzWAR/ne0B6QpCPZPGL7iRBXQ3BMf N8knLuBzR0S/LpHP3sK++BcItZgDne+KWTST5c8vS1ieRNHawWkS/TKGahkeUTWO+qoW yYLDAAGzs1B5CGMFnVstunmjgGpzNCaCn5qbJeT78MaunZ/JV6JwM9x8gUdy2bPOVaiz KUy+azIS38G/MeOF/b4orcisOYoagyAX5HYwuBNryPDG7zmAJqoU6/fOJ+qJZHWnc/FG 4NB+any+QB+9jQ8NbrQbMH9+CQjxX2b2Z62ki1jF7z3hGiRQUxMITUo2Jt5Xgj/yx7ZN ViLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=hpQi3hP3QUHFJwKzJBpdep12T+szWdc1AVVZT8Jcy2g=; b=Nc1lngqHubLZgybx5pfBMxCFbZg+ufLJEbYzAAbdUxZhyWHgI9w5UBNGSp2a4i5d5l DF1DOpWc5zVAp8yhNsXhevg7+8Kuiqecs+ETYcfS3MQKxDH8Q9yjAHJkgQXndUEypBSd BHs+jaZpx4k7n7um1cTAxXta96LbYKkkDruzAS2nILYKw89TJOm7JIq7UWzCyLvFaM8Q LGKfkGGBQnCwy40LgbqptJdDiDT7RgjecUMWrYAiaKCuY6RQM8cjwRGnjMv/pKRbUb4S pGby0KpNdzBABBaFzGW0OaidbXoIh/Lad+59FcFBcQJ8KdQqA0suGI+sypo4BlhSMVOk jRiw== X-Gm-Message-State: AIVw112Xjj21xMUEnrrpEzCcitkh0xenqVlj/65POcWCIz7RejOGXwe9 9FEfXPibclc+mmcL X-Received: by 10.55.48.70 with SMTP id w67mr10716783qkw.207.1501265956210; Fri, 28 Jul 2017 11:19:16 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([179.57.115.10]) by smtp.gmail.com with ESMTPSA id q46sm16448632qtc.54.2017.07.28.11.19.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 11:19:15 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id DBD55603; Fri, 28 Jul 2017 14:19:13 -0400 (-04) Date: Fri, 28 Jul 2017 14:19:13 -0400 From: Alvaro Herrera To: Vladimir Kunschikov Cc: pgsql-hackers@postgresql.org Subject: Re: [patch] pg_dump/pg_restore zerror() and strerror() mishap Message-ID: <20170728181913.owfihtuye2ki6agv@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) 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 Vladimir Kunschikov wrote: > >This "maxlen" business and the fallback error message are > >strange. We have roughly equivalent code in pg_basebackup.c > >which has been working since 2011 > >Perhaps you can drop the memchr/fallback tricks and adopt the > >pg_basebackup coding? Or is there a specific reason to have > >the memchr check? > > Ofcourse that tricks can be dropped, function will be much prettier. > 'Tricks' were made to pass some strict internal tests. Well, if there are cases which cause zlib to return a message that causes a crash when printing it or some other problem, then let's use your version both in this new code and in pg_basebackup. Do these cases really exist? > Initially I used exactly that function from pg_basebackup.c: > https://github.com/kunschikov/postgres/commit/15e9fda6df51cf17c0b0a4f201ee0f93cf258de9#diff-98e3f8ce5d6e87950dd66e4c8bdedb21R713 > It was rewritten for the sake of somewhat exaggerated security. > Version #5 in attachment. I'd rather have all the security we can get, so before dropping those protections, let's make sure they are useless. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers