From unknown Sat Jun 14 03:57:01 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#31787 <31787@debbugs.gnu.org> To: bug#31787 <31787@debbugs.gnu.org> Subject: Status: Newline badly matched/substituted Reply-To: bug#31787 <31787@debbugs.gnu.org> Date: Sat, 14 Jun 2025 10:57:01 +0000 retitle 31787 Newline badly matched/substituted reassign 31787 sed submitter 31787 Gabriel Czernikier severity 31787 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 11 14:30:39 2018 Received: (at submit) by debbugs.gnu.org; 11 Jun 2018 18:30:39 +0000 Received: from localhost ([127.0.0.1]:43678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSRaR-0001YO-AL for submit@debbugs.gnu.org; Mon, 11 Jun 2018 14:30:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSRZi-0001Vc-B9 for submit@debbugs.gnu.org; Mon, 11 Jun 2018 14:29:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSRZb-0005TJ-Lt for submit@debbugs.gnu.org; Mon, 11 Jun 2018 14:29:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48606) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSRZb-0005T2-Hn for submit@debbugs.gnu.org; Mon, 11 Jun 2018 14:29:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSRZZ-0007vN-GV for bug-sed@gnu.org; Mon, 11 Jun 2018 14:29:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSRZY-0005RK-4U for bug-sed@gnu.org; Mon, 11 Jun 2018 14:29:45 -0400 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:33096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSRZX-0005R6-OW for bug-sed@gnu.org; Mon, 11 Jun 2018 14:29:44 -0400 Received: by mail-lf0-x231.google.com with SMTP id y20-v6so32085298lfy.0 for ; Mon, 11 Jun 2018 11:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=xWjuxIc2snvTSirlSxvJilC8KSaR2mw+1JsWplb37r4=; b=MSd5Ws8LIQ8qPpMlFTDJgiD8A251mRiohuW7lxKWUev10YHIdGyCac4l3pxZj41866 VpSveKW4O07a8unvWURD5JdO7C4P1kFDfML12deDJczK3Ev+kcEo47OpEaj6PzzTsaDH EhKHdK4A3YfyCBwXc4ji5yGg68h19YvLVTNR6+AgYWn9x+V7fL/ViKdW2HUw5bo4K98Z LoIDcBY4tcrZL2OuakKLywMY26o6FminwGghgYQnJHJSvvQEBIys741beP+qgXX+pbJg 25MR2FSNqdYbE4g+TVPVV6+8yzdwzbdOrB1rYWp+LX5igSiLf9ekHiT1f/i5DYeA3E9t v4dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xWjuxIc2snvTSirlSxvJilC8KSaR2mw+1JsWplb37r4=; b=ZLRU6zRDrPoDWVoQYzrHgrw965ijvXLnmZcUoqSDOnap7FyafF+uolKcIfkCQlwtB8 4hoNiE+NytIAc/q/PJaxXcynPu9HYDLzldrOr6arvF4ckFtRIBAg82C4cMXcDPAFllpB a7/HzYUue3pvWcEadjoxvtpi1DM5IyKgzVPZ7Pkq12OmsB29Lw3yBhthBSN8520WrO76 HGKytLyWLM6T2EAO7/kFIFy1lvm7JUH5mySnGJ1jDZDHnP+uVQttKXwe5ZmuV9UI19NE vr+ovoMtVqGQkgGKZzYEXvKJlupSaQG6UV1Elg4T/rLlrifMH8IuDSVzAu1VDahmZkzv ArnA== X-Gm-Message-State: APt69E3NStCoTSNu1w2jLBGnaNcSwbGCiLGJXv7FheOIugbwlPbRFWwr UWjxpm9J2JgxuBTiq1ar0fUEhcdaCcXfY96le1+L X-Google-Smtp-Source: ADUXVKLhFnRy3uf4WAa/LPHWU59vOxq7C5B+iIbLHFxWPva25nRggp+b78SsqrTxHQwUvKYCTkWBU3KwVRgTP/NSwTQ= X-Received: by 2002:a2e:249:: with SMTP id 70-v6mr179061ljc.41.1528741781876; Mon, 11 Jun 2018 11:29:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:78e:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 11:29:41 -0700 (PDT) From: Gabriel Czernikier Date: Mon, 11 Jun 2018 15:29:41 -0300 Message-ID: Subject: Newline badly matched/substituted To: bug-sed@gnu.org Content-Type: multipart/alternative; boundary="000000000000dcb378056e61ee61" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 11 Jun 2018 14:30:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --000000000000dcb378056e61ee61 Content-Type: text/plain; charset="UTF-8" sed --version sed (GNU sed) 4.2.2 uname -o Cygwin uname -r 1.7.28(0.271/5/3) For a file named threaddump.txt which contents delimited by ='s is: ========================== at org/springframework/security/ui/SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)[optimized] at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:406)[optimized] ========================== For which there's just line-feed as line separator (i.e. there's no carriage-return at all), and just ASCII chars there are whithin. For unambiguity's sake, the input in question, printed through sed -n l, delimited by ='s is: ========================== at org/springframework/security/ui/SpringSecurityFilt\ er.doFilter(SpringSecurityFilter.java:53)[optimized]$ $ at org/springframework/security/util/FilterChainProxy\ $VirtualFilterChain.doFilter(FilterChainProxy.java:406)[optimized]$ $ ========================== So, the wanted result is the input text transformed so that the newlines are replaced, one on one, by, let's say, literal 'X's (without quotes). So the result delimited by ='s, filtered through sed -n l, would be: ========================== at org/springframework/security/ui/SpringSecurityFilt\ er.doFilter(SpringSecurityFilter.java:53)X X \ at org/springframework/security/util/FilterChainProxy$VirtualFilterCh\ ain.doFilter(FilterChainProxy.java:406)X X$ ========================== Of a couple of scripts that would seem apropriate to achieve this result, none of them does it but with littering. Each program invocation followed by its result, are shown next. sed '$!N; s/\n/X/g;' threaddump.txt | sed -n l ========================== at org/springframework/security/ui/SpringSecurityFilt\ er.doFilter(SpringSecurityFilter.java:53)X $ at org/springframework/security/util/FilterChainProxy\ $VirtualFilterChain.doFilter(FilterChainProxy.java:406)X $ ========================== sed '$!N; s/$/X/mg;' threaddump.txt | sed -n l ========================== at org/springframework/security/ui/SpringSecurityFilt\ er.doFilter(SpringSecurityFilter.java:53)X$ X$ at org/springframework/security/util/FilterChainProxy\ $VirtualFilterChain.doFilter(FilterChainProxy.java:406)X$ X$ ========================== sed '$!N; s/$/X/mg; s/\n/X/g;' threaddump.txt | sed -n l ========================== at org/springframework/security/ui/SpringSecurityFilt\ er.doFilter(SpringSecurityFilter.java:53)XX X$ at org/springframework/security/util/FilterChainProxy\ $VirtualFilterChain.doFilter(FilterChainProxy.java:406)XX X$ ========================== sed '$!N; s/\n/X/g; s/$/X/mg;' threaddump.txt | sed -n l ========================== at org/springframework/security/ui/SpringSecurityFilt\ er.doFilter(SpringSecurityFilter.java:53)X X$ at org/springframework/security/util/FilterChainProxy\ $VirtualFilterChain.doFilter(FilterChainProxy.java:406)X X$ ========================== Regards, Gabriel Czernikier --000000000000dcb378056e61ee61 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdj48ZGl2PjxkaXY+c2VkIC0tdmVyc2lvbjxicj5zZWQgKEdOVSBz ZWQpIDQuMi4yPGJyPjxicj51bmFtZSAtbzxicj5DeWd3aW48YnI+PGJyPnVuYW1lIC1yPGJyPjEu Ny4yOCgwLjI3MS81LzMpPGJyPjxicj48YnI+Rm9yIGEgZmlsZSBuYW1lZCB0aHJlYWRkdW1wLnR4 dCB3aGljaCBjb250ZW50cyBkZWxpbWl0ZWQgYnkgPSYjMzk7cyBpczo8YnI+PT09PT09PT09PT09 PT09PT09PT09PT09PT08YnI+wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIGF0IG9yZy9z cHJpbmdmcmFtZXdvcmsvc2VjdXJpdHkvdWkvU3ByaW5nU2VjdXJpdHlGaWx0ZXIuZG9GaWx0ZXIo U3ByaW5nU2VjdXJpdHlGaWx0ZXIuamF2YTo1Mylbb3B0aW1pemVkXTxicj7CoMKgwqDCoMKgwqDC oMKgwqAgPGJyPsKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBhdCBvcmcvc3ByaW5nZnJh bWV3b3JrL3NlY3VyaXR5L3V0aWwvRmlsdGVyQ2hhaW5Qcm94eSRWaXJ0dWFsRmlsdGVyQ2hhaW4u ZG9GaWx0ZXIoRmlsdGVyQ2hhaW5Qcm94eS5qYXZhOjQwNilbb3B0aW1pemVkXTxicj7CoMKgwqDC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aXR5RmlsdGVy LmphdmE6NTMpWMKgwqDCoMKgwqDCoMKgwqDCoCBYJDxicj7CoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqAgYXQgb3JnL3NwcmluZ2ZyYW1ld29yay9zZWN1cml0eS91dGlsL0ZpbHRlckNoYWlu UHJveHlcPGJyPiRWaXJ0dWFsRmlsdGVyQ2hhaW4uZG9GaWx0ZXIoRmlsdGVyQ2hhaW5Qcm94eS5q YXZhOjQwNilYwqDCoMKgwqDCoMKgwqDCoMKgIFgkPGJyPj09PT09PT09PT09PT09PT09PT09PT09 PT09PGJyPjxicj48L2Rpdj5SZWdhcmRzLDxicj48L2Rpdj5HYWJyaWVsIEN6ZXJuaWtpZXI8YnI+ PC9kaXY+DQo= --000000000000dcb378056e61ee61-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 12 04:50:00 2018 Received: (at 31787) by debbugs.gnu.org; 12 Jun 2018 08:50:00 +0000 Received: from localhost ([127.0.0.1]:44047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSf01-0002Qx-Uy for submit@debbugs.gnu.org; Tue, 12 Jun 2018 04:49:58 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:38215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSf00-0002Qk-2p for 31787@debbugs.gnu.org; Tue, 12 Jun 2018 04:49:56 -0400 Received: by mail-pg0-f54.google.com with SMTP id c9-v6so11130288pgf.5 for <31787@debbugs.gnu.org>; Tue, 12 Jun 2018 01:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=A7a2Dn1G85saEcKrTa7Z6xoTNVUjr2qR8XYydjNnuIw=; b=EFXPzyNVmJ50MVIaxLJzlbUkqNPQ2rrRiamfm3k1CJqIaJWLWdxPzQUI8qufIICh9x +yuhkRkRHPJ4K8bahzj7oxQTjUz/mCwMwsBub6vlQ1sm1mm/xBRBi5ubziAqeJDzluVn 0ckjvd11QqvQLleMCKH5oSSfxXVTF1i7kzWvG2avSpl0H1m5IqrW1fYq0xvrz/j0Vdrr f0Ya1uEsLriHgUDyUn9d5sOFodCnoi8p94km9gL7oHGREOGIEmsr/dXnb4keG6MMdBvO BmCb05d7dtKD3wVzF64QF3D+HpmOmYF/KZC3gV2d7cxsrD7qVxGWAn7VeooN6YWclkej /jdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=A7a2Dn1G85saEcKrTa7Z6xoTNVUjr2qR8XYydjNnuIw=; b=odwqBGQtlRJDgNMXhA/aWMLzXHdMilbKz5KiKAw5F7Hs7UgxYsRcvZ46vx6aOyO+Tg I2vdYuZ8JcQdmUYq0cFMJ+IYDcZCn39zMy1WRwReTo3HNQ0EjkTbPKxQ5sQ81YNVj6UW 6QosNS/LBxJXVp/f342hUNYBHuYIawjacAR9SqvqtrUXlbi4Y/0rz2GoQl7IWLxEJezQ K4wqcuyk8SRqbbFuz6+k86Zi2a0Jyt7aDa/JTdawRKUTIIih2TrsiAqLEw1dgrl2A3YC s9sZCkuP4N96vIP5dZHDfTqlmASppGJLE4Qm67VsRzzjIrTZhKX7yUXLJYyxFI6ZCE2a RcTw== X-Gm-Message-State: APt69E1TY25p8dmWZC2/kg1pCBpCUJAOuoBALXczJeNv6k562LhHXofy dGrIACArC2VevRwClH0nxaRmQy0h X-Google-Smtp-Source: ADUXVKIs9YPj/Fw0G02ft/Nm0jfXOSLFABnOrOfLS0jwHzBBvDufmntKjOoUFon9gO0epo9MvcTFQA== X-Received: by 2002:a63:a042:: with SMTP id u2-v6mr2438743pgn.413.1528793389930; Tue, 12 Jun 2018 01:49:49 -0700 (PDT) Received: from [192.168.88.239] (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id e25-v6sm960440pfn.88.2018.06.12.01.49.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 01:49:48 -0700 (PDT) Subject: Re: bug#31787: Newline badly matched/substituted To: Gabriel Czernikier , 31787@debbugs.gnu.org References: From: Assaf Gordon Message-ID: <7525d95c-f539-29c8-c451-7654ad4a3688@gmail.com> Date: Tue, 12 Jun 2018 02:49:47 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31787 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tag 31787 notabug close 31787 stop Hello, On 11/06/18 12:29 PM, Gabriel Czernikier wrote: > sed --version > sed (GNU sed) 4.2.2 > > uname -o > Cygwin > > uname -r > 1.7.28(0.271/5/3) First, sed 4.2.2 is rather old (almost six years now). sed 4.4 was released in 2017, and sed 4.5 was released just 3 months ago. Second, Cygwin 1.7.28 also seems rather old (released in 2014). The most recent version currently is 2.10. I'm mentioning this because there have been some fundamental changes in the default behavior of cygwin in regards to newlines (and sed is directly affected). If you are already spending time on dealing with sed+cygwin+newlines, it is likely beneficial to keep an eye on the latest development. For more details, see: http://lists.gnu.org/archive/html/bug-sed/2017-05/msg00001.html (and the entire thread of this message is also instructive). > For a file named threaddump.txt which contents delimited by ='s is: > ========================== > at > org/springframework/security/ui/SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)[optimized] > > at > org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:406)[optimized] > > ========================== > > For which there's just line-feed as line separator (i.e. there's no > carriage-return at all), and just ASCII chars there are whithin. > > For unambiguity's sake, the input in question, printed through sed -n l, > delimited by ='s is: > ========================== > at org/springframework/security/ui/SpringSecurityFilt\ > er.doFilter(SpringSecurityFilter.java:53)[optimized]$ > $ > at org/springframework/security/util/FilterChainProxy\ > $VirtualFilterChain.doFilter(FilterChainProxy.java:406)[optimized]$ > $ > ========================== > > So, the wanted result is the input text transformed so that the newlines > are replaced, one on one, by, let's say, literal 'X's (without quotes). So > the result delimited by ='s, filtered through sed -n l, would be: > ========================== > at org/springframework/security/ui/SpringSecurityFilt\ > er.doFilter(SpringSecurityFilter.java:53)X X \ > at org/springframework/security/util/FilterChainProxy$VirtualFilterCh\ > ain.doFilter(FilterChainProxy.java:406)X X$ > ========================== Since you know exactly which ascii value you want to replace, perhaps using 'tr' would be easier? Replacing new-line (ASCII 0x0A, octal \012) with another single character can be done like so, with no regards to which operating system you are using or what line-endings are there: tr '\012' X < threaddump.txt > output.txt --- Regarding your examples: > Of a couple of scripts that would seem apropriate to achieve this > result, none of them does it but with littering. Each program > invocation followed by its result, are shown next.[...] > sed '$!N; s/\n/X/g;' threaddump.txt | sed -n l > sed '$!N; s/$/X/mg;' threaddump.txt | sed -n l > sed '$!N; s/$/X/mg; s/\n/X/g;' threaddump.txt | sed -n l > sed '$!N; s/\n/X/g; s/$/X/mg;' threaddump.txt | sed -n l There might be a mis-understanding of what "N" does. "N" reads the next input line (just one line), and appends it the the current buffer (called "pattern space"). "N" does not restart the cycle - it allows the sed program to continue to the next command. So if the statement "$!N;" was meant as: "read all input lines and append them to one buffer, and only at the last line process them" Then that is not what "N" does. Instead, the following two programs achieve it: $ seq 5 | sed 'H; $!d; x; l; s/\n// ; s/\n/***/g ; s/$/***/' \n1\n2\n3\n4\n5$ 1***2***3***4***5*** $ seq 5 | sed ':x ; N; $!bx ; l; s/\n/***/g ; s/$/***/' 1\n2\n3\n4\n5$ 1***2***3***4***5*** In the first program: 1. "H" appends the line to the hold buffer. 2. "$!d" deletes the line and restarts the cycle (skipping all other commands), except on the last line. 3. "x" swaps the hold buffer and the pattern buffer. The hold buffer contains the entire file, and after "x" the pattern space will contain the entire file. 4. "l" - used just for illustrative purposes - it shows the content of the pattern space - which contains the entire input with newlines. 5. "s/\n//" - removes the first newline (which is a side effect of using H on the first line). 6. "s/\n/***/g" replaces all embedded newlines with a marker. 7. "s/$/***/" - replaces the implied last newline with the same marker In the second program: 1. ":x" - a label at the beginning of the program, will be used below. 2. "N" - read the next line from the input and append to the buffer. 3. "$!bx" - jump to label "x" without restarting the cycle, effectively accumulating more lines due to the "N", until the last line. The rest is like in the first program. More information can be found here: https://www.gnu.org/software/sed/manual/sed.html#Multiline-techniques ----- Lastly, The regex end-of-line anchor '$' will not match the actual newline character - you can't use it to replace the newlines, even with "s///m". Observe the following: $ seq 5 | sed ':x ; N;$!bx ; l; s/$/***/mg ; l' 1\n2\n3\n4\n5$ 1***\n2***\n3***\n4***\n5***$ 1*** 2*** 3*** 4*** 5*** $ seq 5 | sed ':x ; N;$!bx ; l; s/$/***/g ; l' 1\n2\n3\n4\n5$ 1\n2\n3\n4\n5***$ 1 2 3 4 5*** ---- I hope this resolves the issue. I'm marking this item as closed, but discussion can continue by replying to this thread. regards, - assaf From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 08 19:54:34 2018 Received: (at 31787-done) by debbugs.gnu.org; 8 Oct 2018 23:54:34 +0000 Received: from localhost ([127.0.0.1]:40976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g9fM7-0002Ex-Ov for submit@debbugs.gnu.org; Mon, 08 Oct 2018 19:54:34 -0400 Received: from mail-io1-f52.google.com ([209.85.166.52]:38631) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g9fM5-0002Eh-WB for 31787-done@debbugs.gnu.org; Mon, 08 Oct 2018 19:54:30 -0400 Received: by mail-io1-f52.google.com with SMTP id n5-v6so6840540ioh.5 for <31787-done@debbugs.gnu.org>; Mon, 08 Oct 2018 16:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=M4mzmoDHhDI/4FcISlBA96velPK5UaeTaBsMDPqzrRA=; b=Yyjck1AuYAZZ4zlRs/MLbPryLN5EQK6Zb8rpsYR+FSJ874G6BChlqgWz1MzD5u8Q4u uCEqeoWaw2MFda8ESvhi9APbn8kqJZF0NUle7upxFha45SPnBYW+VPXCN/a5wdO3VNp2 yw14AAeD9M75yCaR+8FmdFiVBlYCfsSLqAe873wQ73dqiJDp7n71NZmRWTmpp0xw+nuf QuH40UxvvtgD7T6AShRWJY78yco7dxNM+djeqKLnzXvuPNxbafXElWc0dkkEwtHBEqco caUlFId8Qmq1fqDa1joUm3ow9s1xttBufj7tt+zqkJCJ/Pp3x4ux9OS67i6T2sCv8XSS SLZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=M4mzmoDHhDI/4FcISlBA96velPK5UaeTaBsMDPqzrRA=; b=YAg2lf5v3UKSA3oY6cc2vKvBpsy9bURqAs3bInicbyMmQh4UA3qUanVa16BLB5p5SJ 8e4XE2jSpFrb8YbBnntFg6e+K3PTqwAIzxg5hJCIODrVUZwxYG+SpLM4m/dcSP9OP/2S f9pU2aZJ07SG3eTmnxMxddOFz6ZVQI8Qw90WCBhOsBUDnz9eQ5348qpbRv/CdLHt/vq/ 2vryPV7CtdOBuGzM7ri5HTtURzpJpojbLpHzxIr3jv4v0pWbweyh3nPFr7/D7RwyLNPX 2phg1BQksdwrdw9v79+EzMZE0Qc1QLifDCzh9P8RMnXOUKrxTvcDTJrFALgWV8uKqHOX zSLg== X-Gm-Message-State: ABuFfoiSGAw6Z7gFr/q4YfSJekkkefSALAuqlM9NnitsjbwE5bgseYNH kH57R4TypNsS3/KqGzYw+1f1u5AI X-Google-Smtp-Source: ACcGV62XBG7H5WR/sbYw9LJLD1lRoP2giES9CjY61h5ACt5zFnFXAO1pFjpgEPtQgk5oK6OT6QdZpg== X-Received: by 2002:a6b:370b:: with SMTP id e11-v6mr17752331ioa.67.1539042863777; Mon, 08 Oct 2018 16:54:23 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id a14-v6sm6272797iod.53.2018.10.08.16.54.21 for <31787-done@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 16:54:22 -0700 (PDT) Subject: Re: bug#31787: Newline badly matched/substituted From: Assaf Gordon To: 31787-done@debbugs.gnu.org References: <7525d95c-f539-29c8-c451-7654ad4a3688@gmail.com> Message-ID: <36f8e17c-97a1-c54d-7c2d-fb72021edc93@gmail.com> Date: Mon, 8 Oct 2018 17:54:21 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <7525d95c-f539-29c8-c451-7654ad4a3688@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31787-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) With no further replies, I'm closing this bug. From unknown Sat Jun 14 03:57:01 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 06 Nov 2018 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator