GNU bug report logs - #8295
coreutils 8.10 portability fixes

Previous Next

Package: coreutils;

Reported by: Andreas Stolcke <stolcke <at> speech.sri.com>

Date: Sat, 19 Mar 2011 20:04:02 UTC

Severity: normal

Tags: moreinfo, notabug

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Stolcke <stolcke <at> speech.sri.com>
To: bug-coreutils <at> gnu.org
Subject: coreutils 8.10 portability fixes
Date: Sat, 19 Mar 2011 12:04:46 -0700
Two sets of fixes:

- Several places where iterator variables are declared inside for(), failing compiles
   on systems that support c99.

- The inclusion of <langinfo.h> has to be protected by 
	#if HAVE_NL_LANGINFO
  instead of 
	#if HAVE_LANGINFO_CODESET
  to match the piece of code later where the langinfo is actually used.

These problems surfaced when building on an old IRIX5.3 system with gcc 3.4.6.

--Andreas

*** src/csplit.c.dist	Mon Jan 31 04:40:38 2011
--- src/csplit.c	Thu Mar 17 20:07:05 2011
***************
*** 1200,1207 ****
  get_format_flags (char const *format, int *flags_ptr)
  {
    int flags = 0;
  
!   for (size_t count = 0; ; count++)
      {
        switch (format[count])
          {
--- 1200,1208 ----
  get_format_flags (char const *format, int *flags_ptr)
  {
    int flags = 0;
+   size_t count;
  
!   for (count = 0; ; count++)
      {
        switch (format[count])
          {
***************
*** 1275,1282 ****
  max_out (char *format)
  {
    bool percent = false;
  
!   for (char *f = format; *f; f++)
      if (*f == '%' && *++f != '%')
        {
          if (percent)
--- 1276,1284 ----
  max_out (char *format)
  {
    bool percent = false;
+   char *f;
  
!   for (f = format; *f; f++)
      if (*f == '%' && *++f != '%')
        {
          if (percent)
*** src/ls.c.dist	Mon Jan 31 04:40:38 2011
--- src/ls.c	Thu Mar 17 20:12:24 2011
***************
*** 60,66 ****
  #include <selinux/selinux.h>
  #include <wchar.h>
  
! #if HAVE_LANGINFO_CODESET
  # include <langinfo.h>
  #endif
  
--- 60,66 ----
  #include <selinux/selinux.h>
  #include <wchar.h>
  
! #if HAVE_NL_LANGINFO
  # include <langinfo.h>
  #endif
  
***************
*** 1036,1044 ****
    size_t curr_max_width;
    do
      {
        curr_max_width = required_mon_width;
        required_mon_width = 0;
!       for (int i = 0; i < 12; i++)
          {
            size_t width = curr_max_width;
  
--- 1036,1045 ----
    size_t curr_max_width;
    do
      {
+       int i;
        curr_max_width = required_mon_width;
        required_mon_width = 0;
!       for (i = 0; i < 12; i++)
          {
            size_t width = curr_max_width;
  
*** src/sort.c.dist	Thu Feb  3 02:24:35 2011
--- src/sort.c	Thu Mar 17 20:23:49 2011
***************
*** 67,73 ****
    proper_name ("Mike Haertel"), \
    proper_name ("Paul Eggert")
  
! #if HAVE_LANGINFO_CODESET
  # include <langinfo.h>
  #endif
  
--- 67,73 ----
    proper_name ("Mike Haertel"), \
    proper_name ("Paul Eggert")
  
! #if HAVE_NL_LANGINFO
  # include <langinfo.h>
  #endif
  
*** src/stat.c.dist	Mon Jan 31 04:40:38 2011
--- src/stat.c	Thu Mar 17 20:53:00 2011
***************
*** 586,592 ****
                    if (1 < w)
                      {
                        char *dst = pformat;
!                       for (char const *src = dst; src < p; src++)
                          {
                            if (*src == '-')
                              frac_left_adjust = true;
--- 586,593 ----
                    if (1 < w)
                      {
                        char *dst = pformat;
! 		      char const *src;
!                       for (src = dst; src < p; src++)
                          {
                            if (*src == '-')
                              frac_left_adjust = true;
***************
*** 603,609 ****
      }
  
    int divisor = 1;
!   for (int i = precision; i < 9; i++)
      divisor *= 10;
    int frac_sec = arg.tv_nsec / divisor;
    int int_len;
--- 604,611 ----
      }
  
    int divisor = 1;
!   int i;
!   for (i = precision; i < 9; i++)
      divisor *= 10;
    int frac_sec = arg.tv_nsec / divisor;
    int int_len;




This bug report was last modified 11 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.