From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 2C0E1385B53E for ; Tue, 17 Jan 2023 12:00:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C0E1385B53E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7E1115CF7F; Tue, 17 Jan 2023 12:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673956835; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yGedWzrp5tPqYESnMT0XRwwPrvn+gaJYOXWjz52Aduo=; b=a0Sg7zxpDL5urfQxwHHjd3PS6vb6X3Vyov03OOIfmhqNOCL0COuVYm//zAEmmbuPqTonoW Ntu+EOlrZwF8+H/KNnVpneRpeW4W+VrVgePB2B2Eo6QY/5+AzOKvQbmXaR3I2phXnXBMAn UUT0piBeD3JjELz6OA1vBgh93FpAm4Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673956835; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yGedWzrp5tPqYESnMT0XRwwPrvn+gaJYOXWjz52Aduo=; b=+u6Edfp6tF2FAXrOmjDTS5zS9xYCLJB/cRreK82bE7Kt1eR7Bl4zrlq8gLo3pPdYTgXHe1 tVRsVvKyVyjQ8vCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6BDED13357; Tue, 17 Jan 2023 12:00:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id W5ZpGeONxmOVUgAAMHmgww (envelope-from ); Tue, 17 Jan 2023 12:00:35 +0000 Message-ID: Date: Tue, 17 Jan 2023 13:00:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] contrib: ignore CR in update-copyright.py To: gcc-patches@gcc.gnu.org Content-Language: en-US Cc: Jakub Jelinek Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: When opening files, preserve CR characters. By default, open accepts universal newlines, but I think we should only split with '\n'. Ready to be installed? Thanks, Martin contrib/ChangeLog: * update-copyright.py: Split lines only with '\n'. --- contrib/update-copyright.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py index ac7a94743cf..bdb5417bcec 100755 --- a/contrib/update-copyright.py +++ b/contrib/update-copyright.py @@ -408,7 +408,7 @@ class Copyright: line_filter = filter.get_line_filter (dir, filename) mode = None encoding = self.guess_encoding(pathname) - with open (pathname, 'r', encoding=encoding) as file: + with open (pathname, 'r', encoding=encoding, newline='\n') as file: prev = None mode = os.fstat (file.fileno()).st_mode for line in file: @@ -434,7 +434,7 @@ class Copyright: # If something changed, write the new file out. if changed and self.errors.ok(): tmp_pathname = pathname + '.tmp' - with open (tmp_pathname, 'w', encoding=encoding) as file: + with open (tmp_pathname, 'w', encoding=encoding, newline='\n') as file: for line in lines: file.write (line) os.fchmod (file.fileno(), mode) -- 2.39.0