-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] regen_lib.pl dont output Windows path seps on Windows #16446
Comments
From @bulk88Created by @bulk88See attached patch. Diff of what goes wrong when charclass_invlists.h ------------------------- Inline Patchdiff --git a/charclass_invlists.h b/charclass_invlists.h
index 60c64ef..e63df5a 100644
--- a/charclass_invlists.h
+++ b/charclass_invlists.h
@@ -1,6 +1,6 @@
/* -*- buffer-read-only: t -*-
* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- * This file is built by regen/mk_invlists.pl from Unicode::UCD.
+ * This file is built by regen\mk_invlists.pl from Unicode::UCD.
* Any changes made here will be lost!
*/
@@ -109516,26 +109516,26 @@ static const U8 WB_table[24][24] = {
* e9947a0e86f27353f0e776403c4826675001210bd39d7114118a8864a57f7472
Perl Info
|
From @bulk880001-regen_lib.pl-dont-output-Windows-path-seps-on-Window.patchFrom 6afdb886063eb2534f94b3bf5d6a0776ff5075c4 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Wed, 28 Feb 2018 13:06:52 -0500
Subject: [PATCH] regen_lib.pl dont output Windows path seps on Windows
See diff of charclass_invlists.h before this patch when running
mk_invlists.pl on Windows in the ticket associated with this patch. With
this patch running mk_invlists.pl on windows won't change the commited
charclass_invlists.h. Previously it did (windows path separators in
source code comments).
---
regen/regen_lib.pl | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/regen/regen_lib.pl b/regen/regen_lib.pl
index cbe51ed..a628114 100644
--- a/regen/regen_lib.pl
+++ b/regen/regen_lib.pl
@@ -148,6 +148,7 @@ EOM
$raw .= "!!!!!!! DO NOT EDIT THIS FILE !!!!!!!\n";
if ($args{by}) {
+ $args{by} =~ s/\\/\//g; #windows paths
$raw .= "This file is built by $args{by}";
if ($args{from}) {
my @from = ref $args{from} eq 'ARRAY' ? @{$args{from}} : $args{from};
@@ -189,6 +190,7 @@ sub read_only_bottom_close_and_rename {
# Porting tests likely will fail drawing attention
# to the problem.
: int(rand(1_000_000));
+ $file =~ s/\\/\//g; #windows paths
$comment .= "$digest $file\n";
}
}
--
1.7.9.msysgit.0
|
From @tonycozOn Wed, 28 Feb 2018 18:20:29 -0800, bulk88 wrote:
Your patch is a workaround for bugs in mktables and in mk_invlists.pl. a) mktables attempts to write out canonical pathnames, but due to a lexcial scoping issue, doesn't. b) mk_invlists.pl uses $0 for itself as a dependency rather than the literal that the other regen scripts that I looked at. You'll only encounter b) if you run mk_invlists.pl manually - regen.pl will run it as "regen/mk_invlists.pl" which matches the POSIX-ish name. Your patch will fix the user running: perl regen\mk_invlists.pl but it won't fix: perl j:/dev/perl/git/perl/regen/mk_invlists.pl Tony |
From @tonycoz0001-perl-132925-correct-path-handling-in-mktables.patchFrom 9277931e32ef3052fb988380f30095a8a9ca7b3b Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 1 Mar 2018 15:26:22 +1100
Subject: [PATCH 1/2] (perl #132925) correct path handling in mktables
the lexical my $file inside the loop masked the for loop $file,
wasting the work done to canonicalize the path names.
The grep on length is required since splitdir() can return empty
strings.
---
charclass_invlists.h | 2 +-
lib/unicore/mktables | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/charclass_invlists.h b/charclass_invlists.h
index 60c64ef157..e31e49cec5 100644
--- a/charclass_invlists.h
+++ b/charclass_invlists.h
@@ -109534,7 +109534,7 @@ static const U8 WB_table[24][24] = {
* be0f129691d479aa38646e4ca0ec1ee576ae7f75b0300a5624a7fa862fa8abba lib/unicore/extracted/DLineBreak.txt
* 92449d354d9f6b6f2f97a292ebb59f6344ffdeb83d120d7d23e569c43ba67cd5 lib/unicore/extracted/DNumType.txt
* e3a319527153b0c6c0c549b40fc6f3a01a7a0dcd6620784391db25901df3b154 lib/unicore/extracted/DNumValues.txt
- * 5671c3de473b25e7ea47097e4906260624dfabe3e9b1739f490aecbc3d858459 lib/unicore/mktables
+ * 823b41f276979dd5e2df12f0c7339f3d1aa2c805848958f31ddc549cb11bed9f lib/unicore/mktables
* 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version
* 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
* 4898ec84e2b81e8bf948dcdb1c015c14f258cc652337122719885a276ea46d7b regen/mk_invlists.pl
diff --git a/lib/unicore/mktables b/lib/unicore/mktables
index c6436723d5..88d9c036a3 100644
--- a/lib/unicore/mktables
+++ b/lib/unicore/mktables
@@ -20230,9 +20230,9 @@ if ( $file_list and $make_list ) {
print "Updating '$file_list'\n" if $verbosity >= $PROGRESS;
foreach my $file (@input_files, @files_actually_output) {
- my (undef, $directories, $file) = File::Spec->splitpath($file);
- my @directories = File::Spec->splitdir($directories);
- $file = join '/', @directories, $file;
+ my (undef, $directories, $basefile) = File::Spec->splitpath($file);
+ my @directories = grep length, File::Spec->splitdir($directories);
+ $file = join '/', @directories, $basefile;
}
my $ofh;
--
2.14.1.windows.1
|
From @tonycoz0002-perl-132925-don-t-use-0-to-get-the-name-of-mk_invlis.patchFrom 5270ff61edf70ef869e8d66ed568610b5c7e61ab Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 1 Mar 2018 15:42:56 +1100
Subject: [PATCH 2/2] (perl #132925) don't use $0 to get the name of
mk_invlists.pl
Other regen scripts simply embed the name as a literal, using $0
means that the output varies depending on the path used to call
regen/mk_invlists.pl.
---
charclass_invlists.h | 2 +-
regen/mk_invlists.pl | 11 ++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/charclass_invlists.h b/charclass_invlists.h
index e31e49cec5..beb185fc9e 100644
--- a/charclass_invlists.h
+++ b/charclass_invlists.h
@@ -109537,5 +109537,5 @@ static const U8 WB_table[24][24] = {
* 823b41f276979dd5e2df12f0c7339f3d1aa2c805848958f31ddc549cb11bed9f lib/unicore/mktables
* 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version
* 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
- * 4898ec84e2b81e8bf948dcdb1c015c14f258cc652337122719885a276ea46d7b regen/mk_invlists.pl
+ * d3e239a5688d86573d75b4ffc38a60e2f90add5845d359c28b3e76257b022870 regen/mk_invlists.pl
* ex: set ro: */
diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl
index 79ceba94a0..358e4e76c6 100644
--- a/regen/mk_invlists.pl
+++ b/regen/mk_invlists.pl
@@ -36,7 +36,7 @@ my $numeric_re = qr/ ^ -? \d+ (:? \. \d+ )? $ /ax;
my $enum_name_re = qr / ^ [[:alpha:]] \w* $ /ax;
my $out_fh = open_new('charclass_invlists.h', '>',
- {style => '*', by => $0,
+ {style => '*', by => 'regen/mk_invlists.pl',
from => "Unicode::UCD"});
my $in_file_pound_if = 0;
@@ -2236,10 +2236,11 @@ output_WB_table();
end_file_pound_if;
my $sources_list = "lib/unicore/mktables.lst";
-my @sources = ($0, qw(lib/unicore/mktables
- lib/Unicode/UCD.pm
- regen/charset_translations.pl
- ));
+my @sources = qw(regen/mk_invlists.pl
+ lib/unicore/mktables
+ lib/Unicode/UCD.pm
+ regen/charset_translations.pl
+ );
{
# Depend on mktables��� own sources. It���s a shorter list of files than
# those that Unicode::UCD uses.
--
2.14.1.windows.1
|
The RT System itself - Status changed from 'new' to 'open' |
From @bulk88On Wed, 28 Feb 2018 20:48:30 -0800, tonyc wrote:
As far as I can tell regen.pl never runs mk_invlists.pl, either it is manually run, or it its in TAP mode by from porting/regen.t, Your 2 patches fix the pathnames being rewriten if I regen the files, so feel free to push those 2 patches and reject my attempt at a fix. -- |
From @tonycozOn Thu, 01 Mar 2018 13:23:07 -0800, bulk88 wrote:
You're right, I think I got mixed up with porting/regen.t, which runs it with the /.
Thanks for the feedback. Applied as b857191 and b857191. Tony |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#132925 (status was 'resolved')
Searchable as RT132925$
The text was updated successfully, but these errors were encountered: