GNU bug report logs -
#8401
removing duplication and improving the readlink code
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Fri, 1 Apr 2011 06:48:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Thu, 31 Mar 2011 23:47:14 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> CC: Eli Zaretskii <eliz <at> gnu.org>
>
> In two places Emacs calls readlink with similar code to reallocate
> buffers until there's enough room to store the symbolic link's value.
> And in both places there are minor problems with overflow, since Emacs
> uses 32-bit int where modern 64-bit systems use 64-bit ssize_t, and it
> doesn't check for overflow in buffer size calculations. These
> problems cause GCC to complain, if warnings are enabled. I plan to
> fix the problems with the following patch, which substitutes a gnulib
> implementation of the same basic readlink idea; this implementation
> does more-careful buffer size checking, and makes it possible to
> avoid the malloc+free in the usual case.
Isn't much easier and much more elegant to use ssize_t instead of an
int for the buffer sizes in both cases?
> This patch adds a couple of dependencies so it may affect the
> Windows build.
If this patch is accepted, the new emacs_readlink function will be a
trivial "fail" stub on Windows. I don't see a need to compile in all
this gnulib code just to return NULL because readlink always fails.
This bug report was last modified 14 years and 54 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.