GNU bug report logs -
#40407
[PATCH] slow ENCODE_FILE and DECODE_FILE
Previous Next
Reported by: Mattias Engdegård <mattiase <at> acm.org>
Date: Fri, 3 Apr 2020 16:11:01 UTC
Severity: normal
Tags: patch
Done: Mattias Engdegård <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
Message #101 received at 40407 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
5 apr. 2020 kl. 17.56 skrev Eli Zaretskii <eliz <at> gnu.org>:
> Once we do set up default-file-name-coding-system, these macros will
> never return their argument (unless someone forcefully sets the
> encoding to nil, in which case they deserve what they get). Do you
> agree?
Thank you, and yes, I do agree partly: ENCODE_FILE is the identity for all unibyte strings no matter the coding system in use.
However, my point (which I didn't do a very good job explaining) was that if either ENCODE_FILE or DECODE_FILE are called with the assumption that they return a new string, that is at least a latent bug.
Thus I went through them all once again, and found a few questionable calls that I'd like to fix. They rely on Fexpand_file_name returning a new string, which may or may not be true now but we would be better without such assumptions. (I also stumbled on a potential GC-related bug.) Patch attached!
With these fixed, nothing prevents those two functions from using no-copy semantics. I agree this approach is better and safer than going straight for code_convert_string_norecord in one pass.
[0001-Don-t-rely-on-copying-in-EN-DE-CODE_FILE.patch (application/octet-stream, attachment)]
This bug report was last modified 5 years and 91 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.