From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id E0B571F8C2 for ; Sat, 13 Feb 2021 13:26:06 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8282D1209FF; Sat, 13 Feb 2021 22:25:06 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 70A1C1209FB for ; Sat, 13 Feb 2021 22:25:04 +0900 (JST) Received: by filterdrecv-p3las1-c477c4585-l96xf with SMTP id filterdrecv-p3las1-c477c4585-l96xf-20-6027D359-29 2021-02-13 13:25:45.556849685 +0000 UTC m=+311879.919691711 Received: from herokuapp.com (unknown) by geopod-ismtpd-1-4 (SG) with ESMTP id DDun25_hQ_WTns3snxAE_A for ; Sat, 13 Feb 2021 13:25:45.395 +0000 (UTC) Date: Sat, 13 Feb 2021 13:25:45 +0000 (UTC) From: xtkoba+ruby@gmail.com Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Redmine-MailingListIntegration-Message-Ids: 78403 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17626 X-Redmine-Issue-Author: agate-pris X-Redmine-Sender: xtkoba X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?75w3+RXRrinEP3ykAS=2F1WzD2vTMrJdTeEiaFbXc9IwV+wJRzrmckiAqeSHZFbv?= =?us-ascii?Q?8kt7PT363YrZ0cC=2F+mGRAks7ptR8MEch7dhyrnn?= =?us-ascii?Q?6Ie9AQL6s4fY=2FcHoiu3M0ZdDnOJ6c6CMlJ0HFKW?= =?us-ascii?Q?FOnIh+t5sfj1ClrNrVec0hesBjNpS4QDUKtK2Xi?= =?us-ascii?Q?GDeolNaGbv1TDfm1j36MQsEV1sTYYB0E9PHd1fy?= =?us-ascii?Q?jF1yh12POvtJg3Hgk=3D?= To: ruby-dev@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-dev X-Mail-Count: 51021 Subject: [ruby-dev:51021] [Ruby master Bug#17626] FileUtils.cp may cause utime_failed X-BeenThere: ruby-dev@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: "Ruby developers \(Japanese\)" List-Id: "Ruby developers \(Japanese\)" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-dev-bounces@ruby-lang.org Sender: "ruby-dev" Issue #17626 has been updated by xtkoba (Tee KOBAYASHI).=0D =0D =0D I compiled the following code by `x86_64-w64-mingw32-gcc`:=0D ```=0D /* -*- coding: utf-8 -*- */=0D #include =0D void touch(char *path) {=0D FILE *file =3D fopen(path, "a");=0D if (file !=3D NULL) fclose(file);=0D }=0D int main() {=0D touch("foo=E3=82=B3=E3=83=94=E3=83=BC");=0D return 0;=0D }=0D ```=0D and when I ran the output executable on Windows 10, I got a file with a fun= ny name:=0D ```=0D $ echo -n foo* | hexdump -C=0D 00000000 66 6f 6f c3 a3 e2 80 9a c2 b3 c3 a3 c6 92 e2 80 |foo...........= ..|=0D 00000010 9d c3 a3 c6 92 c2 bc |.......|=0D 00000017=0D ```=0D =0D When I ran the following Ruby script in the directory where the funny file = exists, then I got no errors:=0D ```=0D // -*- coding: utf-8 -*-=0D File.utime 0, 0, "foo=E3=82=B3=E3=83=94=E3=83=BC"=0D ```=0D =0D I cannot summarize this phenomenon, but I think it has something to do with= the main issue.=0D =0D ----------------------------------------=0D Bug #17626: FileUtils.cp may cause utime_failed=0D https://bugs.ruby-lang.org/issues/17626#change-90368=0D =0D * Author: agate-pris (agate pris)=0D * Status: Open=0D * Priority: Normal=0D * ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]=0D * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN=0D ----------------------------------------=0D FileUtils.cp will cause utime_failed if the file name contains Japanese cha= racters and preserve is true.=0D =0D This will probably only happen on Windows. It occures on Windows 10 version= 2004 build 21301.1010.=0D =0D ``` ruby=0D require 'fileutils'=0D =0D FileUtils.cp('foo', 'foo_copy', preserve: true)=0D FileUtils.cp('foo', 'foo=E3=82=B3=E3=83=94=E3=83=BC', preserve: true)=0D ```=0D =0D ``` sh=0D $ ruby test.rb=0D C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1424:in `utime': No such file o= r directory @ utime_failed - foo=E3=82=B3=E3=83=94=E3=83=BC (Errno::ENOENT)=0D from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1424:in `copy_meta= data'=0D from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:515:in `copy_file'=0D from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:433:in `block in c= p'=0D from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1597:in `block in = fu_each_src_dest'=0D from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1613:in `fu_each_s= rc_dest0'=0D from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1595:in `fu_each_s= rc_dest'=0D from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:432:in `cp'=0D from test.rb:4:in `
'=0D ```=0D =0D The expected result is copy to foo=E3=82=B3=E3=83=94=E3=83=BC is success sa= me like copy to foo_copy.=0D =0D =0D =0D =0D --=20=0D https://bugs.ruby-lang.org/=0D