Skip to contentSkip to conversation

t/gitweb-lib: Don't pass constant to decode_utf8

PATCH Superseded Brian Gernhardt 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 t/gitweb-lib: Don't pass constant to decode_utf8

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

Modification of a read-only value attempted at /Library/Perl/Updates/5.10.0/darwin-thread-multi-2level/Encode.pm line 216.

Work around this by passing an empty variable instead of a constant string.

---

Changes since v1:
- Use an explicitly empty variable instead of $_
- Clearer commit message
- CC people who worked on t/gitweb-lib.sh
- based against maint

 t/gitweb-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
t/gitweb-lib.sh +1 -1
index 81ef2a0..1b9523d 100644
@@ -80,7 +80,7 @@ if ! test_have_prereq PERL; then
 	test_done
 fi
 
-perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
+perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
     skip_all='skipping gitweb tests, perl version is too old'
     test_done
 }
Signature · 1 line
1.7.3.1.209.g52408
Acked-by on v2 1/1
#1 lore raw
Quoted 3 lines · Brian Gernhardt

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

Very minor complaint: line break here makes it less readable.

Perhaps this?

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

Quoted 4 lines

Modification of a read-only value attempted at /Library/Perl/Updates/5.10.0/darwin-thread-multi-2level/Encode.pm line 216.

Very minor complaint: It might be better to not include path to installed Encode.pm, which is different on different filesystems.

Modification of a read-only value attempted at .../Encode.pm line 216.

Quoted 5 lines

Work around this by passing an empty variable instead of a constant string.

Quoted 4 lines

---

Changes since v1:
- Use an explicitly empty variable instead of $_

...which was undefined, not empty, I think.

Quoted 1 line

- Clearer commit message

It is very clear (though I don't remember previous one).

Quoted 1 line

- CC people who worked on t/gitweb-lib.sh

Thanks a lot.

Quoted 1 line

- based against maint

Was there any difference versus being based against 'master'?

Quoted 9 lines
 t/gitweb-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
t/gitweb-lib.sh +0 -0
index 81ef2a0..1b9523d 100644

t/gitweb-lib.sh if ! test_have_prereq PERL; then · line 86

Quoted 8 lines
t/gitweb-lib.sh +1 -1
@@ -80,7 +80,7 @@ if ! test_have_prereq PERL; then
 	test_done
 fi
 
-perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
+perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
     skip_all='skipping gitweb tests, perl version is too old'
     test_done
 }

Nicely done! Thanks!

Signature · 2 lines
Jakub Narebski
Poland
#2 lore raw

PATCH v3 1/1 t/gitweb-lib: Don't pass constant to decode_utf8

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

Modification of a read-only value attempted at .../Encode.pm line 216.

Work around this by passing an empty variable instead of a constant string.

---
Changes since v2:
- Re-wrapped first paragraph for easier reading
- Removed long OS X-specific Perl library path
- Added Ack

 t/gitweb-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
t/gitweb-lib.sh +1 -1
index 81ef2a0..1b9523d 100644
@@ -80,7 +80,7 @@ if ! test_have_prereq PERL; then
 	test_done
 fi
 
-perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
+perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
     skip_all='skipping gitweb tests, perl version is too old'
     test_done
 }
Signature · 1 line
1.7.3.1.209.g52408
#3 lore raw
In reply to Jakub Narebski
Quoted 6 lines · Jakub Narebski
Quoted 3 lines · Brian Gernhardt

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

Quoted 7 lines

Very minor complaint: line break here makes it less readable.

Perhaps this?

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

The wrapping was automatically done by vim. I'll try tweaking width/contents to make it flow better.

Quoted 7 lines
Quoted 3 lines

Modification of a read-only value attempted at /Library/Perl/Updates/5.10.0/darwin-thread-multi-2level/Encode.pm line 216.

Very minor complaint: It might be better to not include path to installed Encode.pm, which is different on different filesystems.

Quoted 7 lines

Modification of a read-only value attempted at .../Encode.pm line 216.

Quoted 2 lines

Changes since v1:
- Use an explicitly empty variable instead of $_

...which was undefined, not empty, I think.

It still served to test the two argument case, but I thought an explicit variable that exactly matched the previous call would be better.

Quoted 3 lines
Quoted 1 line

- based against maint

Was there any difference versus being based against 'master'?

Whitespace in context lines. The skip_all and test_done lines were re-indented at some point. Minor, but I thought I'd mention it.

~~ Brian

#4 lore raw
Quoted 9 lines · Brian Gernhardt
Quoted 8 lines · Jakub Narebski
Quoted 3 lines · Brian Gernhardt

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

Very minor complaint: line break here makes it less readable.

Quoted 8 lines
Quoted 5 lines

Perhaps this?

Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like:

The wrapping was automatically done by vim. I'll try tweaking width/contents to make it flow better.

Note that it is just nitpicking: the commit message is quite fine as it is.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Changes since v1:
- Use an explicitly empty variable instead of $_

...which was undefined, not empty, I think.

It still served to test the two argument case, but I thought an explicit variable that exactly matched the previous call would be better.

It is better, IMHO.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

- based against maint

Was there any difference versus being based against 'master'?

Whitespace in context lines. The skip_all and test_done lines were re-indented at some point. Minor, but I thought I'd mention it.

O.K.

Thanks again.

Signature · 2 lines
Jakub Narebski
Poland