NetBSD Problem Report #54620

From www@netbsd.org  Wed Oct 16 09:35:05 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B6B8E7A20B
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 16 Oct 2019 09:35:04 +0000 (UTC)
Message-Id: <20191016093503.D1B487A25B@mollari.NetBSD.org>
Date: Wed, 16 Oct 2019 09:35:03 +0000 (UTC)
From: coypu@sdf.org
Reply-To: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Subject: patch(1) has issues with long lines
X-Send-Pr-Version: www-1.0

>Number:         54620
>Category:       bin
>Synopsis:       patch(1) has issues with long lines
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 16 09:40:00 +0000 2019
>Last-Modified:  Wed Dec 04 21:25:01 +0000 2019
>Originator:     coypu
>Release:        NetBSD 9.99.15
>Organization:
>Environment:
NetBSD planets 9.99.15 NetBSD 9.99.15 (GENERIC) #1: Fri Oct 11 23:50:23 IDT 2019  fly@planets:/cvs/obj/sys/arch/amd64/compile/GENERIC amd64

>Description:
Unfortunately there's a very real scenario for this happening: trying to patch JSON files in pkgsrc.

It errors like:

patch: **** malformed patch at line 5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


>How-To-Repeat:
Here's a test case. It works if changing 10000s to 1000s.

#!/bin/sh

printf %10s |tr " " "a" > longlines 2>/dev/null

cat << EOF > longlines.patch
--- ./longlines.orig	2019-10-16 09:25:30.667656644 +0000
+++ ./longlines
@@ -1 +1 @@
EOF

printf -- "-"%10s"\n" |tr " " "a" >> longlines.patch 2>/dev/null
printf -- "+"%10s |tr " " "b" >> longlines.patch 2>/dev/null

patch longlines < longlines.patch
>Fix:

>Audit-Trail:
From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54620: patch(1) has issues with long lines
Date: Wed, 16 Oct 2019 11:21:39 +0000

 Oops, the failing variant is with "10000s" :-)

 #!/bin/sh

 printf %10000s |tr " " "a" > longlines 2>/dev/null

 cat << EOF > longlines.patch
 --- ./longlines.orig	2019-10-16 09:25:30.667656644 +0000
 +++ ./longlines
 @@ -1 +1 @@
 EOF

 printf -- "-"%10000s"\n" |tr " " "a" >> longlines.patch 2>/dev/null
 printf -- "+"%10000s |tr " " "b" >> longlines.patch 2>/dev/null

 patch longlines < longlines.patch

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54620: patch(1) has issues with long lines
Date: Wed, 4 Dec 2019 21:23:50 +0000

 looks like openbsd recently committed a fix for their patch.
 https://v4.freshbsd.org/commit/openbsd/src/1Wl50W6O3FLZ1Et1

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.45 2018/12/21 14:23:33 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.