Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 301005 - sys-devel/patch-2.6.1 has logical error regarding strlen, fixed upstream
Summary: sys-devel/patch-2.6.1 has logical error regarding strlen, fixed upstream
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All IRIX
: High normal (vote)
Assignee: Gentoo Prefix
URL: http://lists.gnu.org/archive/html/bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-14 16:31 UTC by Stuart Shelton
Modified: 2010-03-06 08:54 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix logical errors in patch-2.6.1 (patch-2.6.1.patch,1013 bytes, patch)
2010-01-14 16:33 UTC, Stuart Shelton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2010-01-14 16:31:41 UTC
On IRIX (and, indeed, any platform without strnlen() or strndup()), patch-2.6.1 fails with:

cc-1196 cc: WARNING File = gl/lib/strndup.c, Line = 33
  The indicated function is declared implicitly.

    size_t len = strnlen (s, n);
                 ^

cc-1196 cc: WARNING File = gl/lib/xstrndup.c, Line = 36
  The indicated function is declared implicitly.

    char *s = strndup (string, n);
              ^                                                                     
                                                                                    
cc-1140 cc: ERROR File = gl/lib/xstrndup.c, Line = 36                               
  A value of type "int" cannot be used to initialize an entity of type "char *".    
                                                                                    
    char *s = strndup (string, n);                                                  
              ^                                                                     
                                                                                    
1 error detected in the compilation of "gl/lib/xstrndup.c".                         
make: *** [gl/lib/xstrndup.o] Error 2

... because config.h says that HAVE_DECL_STRNDUP and HAVE_DECL_STRNLEN should be set to '0' or '1' depending on whether the function is available, but then the code checks to see whether HAVE_DECL_STRNDUP and HAVE_DECL_STRNLEN are defined - which will always be the case.

patch-2.6.1 als runs into the infamous MIPSpro error:

cc-1999 cc: ERROR File = src/bestmatch.h, Line = 135                                                                                                                                                 "jumping out of a block containing VLAs" is not currently implemented
                                                                                                                                                                                                                                                                                                                                                                                                      1 error detected in the compilation of "src/merge.c".

... but the code (in a header file?) which does this appears to be entirely superfluous: a for block containing only a 'continue' instruction.  Removing this allows patch to compile and also pass all of its test-suite.
Comment 1 Stuart Shelton 2010-01-14 16:33:15 UTC
Created attachment 216514 [details, diff]
Fix logical errors in patch-2.6.1
Comment 2 Stuart Shelton 2010-01-16 00:11:18 UTC
After reporting, upstream state both problems fixed in this source:

ftp://alpha.gnu.org/gnu/patch/patch-2.6.1-9-gf376c5d.tar.gz
Comment 3 Fabian Groffen gentoo-dev 2010-01-16 10:31:44 UTC
do you have a bug reference for me?
Comment 4 Stuart Shelton 2010-01-17 11:37:05 UTC
Not as-such, I'm afraid - it was solved via mailing-list.

Here's the link:

http://lists.gnu.org/archive/html/bug-patch/2010-01/msg00009.html
Comment 5 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-03-05 23:50:27 UTC
Not sure why this why assigned to alt@
Comment 6 Fabian Groffen gentoo-dev 2010-03-06 08:54:04 UTC
http://git.savannah.gnu.org/gitweb/?p=patch.git;a=summary

Most of the time/blocker here is to fetch the patches, and make them apply to the sources.

Anyway, committed now.