This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Updated [test]: coreutils-8.24-2
- From: Sam Edge <cygwin at dwalin dot fsnet dot co dot uk>
- To: cygwin at cygwin dot com
- Date: Thu, 27 Aug 2015 20:47:45 +0100
- Subject: Re: Updated [test]: coreutils-8.24-2
- Authentication-results: sourceware.org; auth=none
- References: <001c01d0e04c$d8ebc210$8ac34630$ at bonhard dot uklinux dot net> <000001d0e051$965f38a0$c31da9e0$ at bonhard dot uklinux dot net> <55DE4B8B dot 6000401 at redhat dot com>
- Reply-to: cygwin at cygwin dot com
On 27/08/2015 00:28, Eric Blake wrote:
> On 08/26/2015 04:50 PM, Fergus wrote:
>>> .. No, you're the first to report it (so 8.24-2 has the same issue), but
>>> now that I know about it, it will get fixed soon.
> Spot the bugs:
>
> int
> cygwin_spelling (char const *path)
> {
> ...
> int len;
> ...
> if (! path || ! *path || len > PATH_MAX)
> /* PATH will cause EINVAL or ENAMETOOLONG, treat it as non-existing. */
> return -1;
> len = strlen (path);
>
>
> D'oh. But this same flub of mine was also present in at least 8.23-4; so
> it was the upstream churn in src/cp.c that caused the stack to be
> different to the point that it now matters.
>
> [For those keeping score, I should use size_t and not int to store
> strlen() values, since it matters on 64-bit when encountering the
> unlikely >2G string; and it helps to never branch on uninitialized memory]
>
One might add, "Always, always initialize automatic variables. This
ensures deterministic behaviour. The compiler will optimise out the
redundant ones."
Rapid diagnosis once reported so I'll let you off this time, Eric. ;-)
--
Sam Edge
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple