Skip to content

Commit 21709a5

Browse files
committed
merge revision(s) 7a05dbc: [Backport #21561]
File.dirname: return consistent encoding for `"."` [Bug #21561] It's preferable if the method is consistent in the encoding in the returned string.
1 parent 00fa53d commit 21709a5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

file.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4947,8 +4947,11 @@ rb_file_dirname_n(VALUE fname, int n)
49474947
break;
49484948
}
49494949
}
4950-
if (p == name)
4951-
return rb_usascii_str_new2(".");
4950+
if (p == name) {
4951+
dirname = rb_str_new(".", 1);
4952+
rb_enc_copy(dirname, fname);
4953+
return dirname;
4954+
}
49524955
#ifdef DOSISH_DRIVE_LETTER
49534956
if (has_drive_letter(name) && isdirsep(*(name + 2))) {
49544957
const char *top = skiproot(name + 2, end, enc);

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
1212
#define RUBY_VERSION_TEENY 5
1313
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
14-
#define RUBY_PATCHLEVEL 53
14+
#define RUBY_PATCHLEVEL 54
1515

1616
#include "ruby/version.h"
1717
#include "ruby/internal/abi.h"

0 commit comments

Comments
 (0)