public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: binutils 2.9.5.0.46: IEEE support is broken in binutils because of `slashpatch'
@ 2000-06-19 23:03 Alexander Aganichev
  2000-06-20 22:28 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Aganichev @ 2000-06-19 23:03 UTC (permalink / raw)
  To: Nick Clifton; +Cc: bug-gnu-utils, binutils

[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]

Hi Nick,

I've made the changes you suggested and attach the patch to this message.
(See attached file: dosslash.fix.diff)

--
Alexander Aganichev
Hypercom Europe Limited, Inc.
Software Engineer


                                                                                                                                
                    Nick Clifton                                                                                                
                    <nickc@cygnus        To:     AAganichev@hypercom.com                                                        
                    .com>                cc:     bug-gnu-utils@gnu.org                                                          
                                         Subject:     Re: binutils 2.9.5.0.46: IEEE support is broken in binutils because of    
                    14.06.2000           `slash patch'                                                                          
                    21:45                                                                                                       
                                                                                                                                
                                                                                                                                



Hi Alexander,

: IEEE support is broken under cygwin (I believe UNIX systems affected as
: well). The following patch fixes this issue:
: (See attached file: ieee.diff)
:
: Also I found set of ugly code like this (it all around the
: HAVE_DOS_BASED_FILE_SYSTEM define check):
:
:   filename = strrchr (file, '/');
: #ifdef HAVE_DOS_BASED_FILE_SYSTEM
:   {
:     /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
:     char *bslash = strrchr (file, '\\');
:     if (bslash > filename)
:       filename = bslash;
:     if (filename == NULL && file[0] != '\0' && file[1] == ':')
:      filename = file + 1;
:   }
: #endif
:
: Since a filename could be NULL I suggest to replace this line
:
:     if (bslash > filename)
:
: with
:
:     if ((filename == NULL) || (bslash > filename))
:
: I'm not sure that NULL is smallest pointer for all supported compilers.

Strictly speaking, you ought to also check that bslash is not NULL,
since it is theoretically possible that filename is non-NULL but less
than 0 (in a signed address space) in which case filename would
erroneously be set to NULL.

Cheers
           Nick



[-- Attachment #2: dosslash.fix.diff --]
[-- Type: text/x-diff, Size: 2296 bytes --]

--- ar.c.orig	Tue May 30 20:57:08 2000
+++ ar.c	Tue Jun 20 09:42:07 2000
@@ -307,10 +307,10 @@
   {
     /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
     char *bslash = strrchr (file, '\\');
-    if (bslash > filename)
+    if (filename == NULL || (bslash != NULL && bslash > filename))
       filename = bslash;
     if (filename == NULL && file[0] != '\0' && file[1] == ':')
-	filename = file + 1;
+	filename = file + 2;
   }
 #endif
   if (filename != (char *) NULL)
@@ -392,10 +392,10 @@
 	{
 	  /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
 	  char *bslash = strrchr (program_name, '\\');
-	  if (bslash > temp)
+	  if (temp == NULL || (bslash != NULL && bslash > temp))
 	    temp = bslash;
 	  if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':')
-	    temp = program_name + 1;
+	    temp = program_name + 2;
 	}
 #endif
       if (temp == NULL)
--- bucomm.c.orig	Tue May 30 09:34:49 2000
+++ bucomm.c	Tue Jun 20 09:42:58 2000
@@ -219,10 +219,10 @@
   {
     /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
     char *bslash = strrchr (filename, '\\');
-    if (bslash > slash)
+    if (slash == NULL || (bslash != NULL && bslash > slash))
       slash = bslash;
     if (slash == NULL && filename[0] != '\0' && filename[1] == ':')
-      slash = filename + 1;
+      slash = filename + 2;
   }
 #endif
 
--- ieee.c.orig	Tue May 30 09:34:51 2000
+++ ieee.c	Tue Jun 20 09:52:30 2000
@@ -4940,8 +4940,8 @@
   info->filename = filename;
   modname = strrchr (filename, '/');
   /* We could have a mixed forward/back slash case.  */
-  backslash = strrchr (modname, '\\');
-  if (backslash > modname)
+  backslash = strrchr (filename, '\\');
+  if (modname == NULL || (backslash != NULL && backslash > modname))
     modname = backslash;
 
   if (modname != NULL)
@@ -5206,8 +5206,8 @@
       /* Start the enclosing BB10 block.  */
       filename = bfd_get_filename (info->abfd);
       modname = strrchr (filename, '/');
-      backslash = strrchr (modname, '\\');
-      if (backslash > modname)
+      backslash = strrchr (filename, '\\');
+      if (modname == NULL || (backslash != NULL && backslash > modname))
 	modname = backslash;
 
       if (modname != NULL)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: binutils 2.9.5.0.46: IEEE support is broken in binutils because of `slashpatch'
  2000-06-19 23:03 binutils 2.9.5.0.46: IEEE support is broken in binutils because of `slashpatch' Alexander Aganichev
@ 2000-06-20 22:28 ` Eli Zaretskii
  2000-06-20 22:39   ` binutils 2.9.5.0.46: IEEE support is broken in binutils becauseof `slash patch' Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2000-06-20 22:28 UTC (permalink / raw)
  To: AAganichev; +Cc: nickc, bug-gnu-utils, binutils

> From: "Alexander Aganichev" <AAganichev@hypercom.com>
> Date: Tue, 20 Jun 2000 10:03:05 +0100
> 
> I've made the changes you suggested and attach the patch to this message.
> (See attached file: dosslash.fix.diff)
[snip]
> -	filename = file + 1;
> +	filename = file + 2;
> -	    temp = program_name + 1;
> +	    temp = program_name + 2;

I think the above two changes in ar.c (and a similar change in
bucomm.c) are wrong: this code is handling the case of "d:foo", where
there's no slash or backslash in the file name, but there is a drive
letter.  In this case, the basename begins right after the colon.
However, the code later on increments `filename' and `temp', like
this:

  if (filename != (char *) NULL)
    filename++;
  else
    filename = file;

Therefore, we should set `filename' to point to the colon, not to the
character after it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: binutils 2.9.5.0.46: IEEE support is broken in binutils becauseof `slash patch'
  2000-06-20 22:28 ` Eli Zaretskii
@ 2000-06-20 22:39   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2000-06-20 22:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: AAganichev, nickc, bug-gnu-utils, binutils

On Wed, 21 Jun 2000, Eli Zaretskii wrote:

> > From: "Alexander Aganichev" <AAganichev@hypercom.com>
> > Date: Tue, 20 Jun 2000 10:03:05 +0100
> > 
> > I've made the changes you suggested and attach the patch to this message.
> > (See attached file: dosslash.fix.diff)
> [snip]
> > -	filename = file + 1;
> > +	filename = file + 2;
> > -	    temp = program_name + 1;
> > +	    temp = program_name + 2;
> 
> I think the above two changes in ar.c (and a similar change in
> bucomm.c) are wrong

Yes, I'd spotted that, and thought I'd replied to the list, but obviously
not.  Incidentally, the other errors that Alexander fixed were mine, not
Eli's.  All the damage should now be repaired.

Regards, Alan Modra
-- 
Linuxcare.  Support for the Revolution.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-06-20 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-19 23:03 binutils 2.9.5.0.46: IEEE support is broken in binutils because of `slashpatch' Alexander Aganichev
2000-06-20 22:28 ` Eli Zaretskii
2000-06-20 22:39   ` binutils 2.9.5.0.46: IEEE support is broken in binutils becauseof `slash patch' Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).