public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch: FYI: fix PR libgcj/35950
@ 2008-04-17 17:14 Tom Tromey
  2008-04-19  1:29 ` Andrew John Hughes
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2008-04-17 17:14 UTC (permalink / raw)
  To: GCJ-patches

I'm checking this in on the trunk and the 4.3 branch.

This fixes PR 35950, aka PR 32516.  This makes gjar strip leading "./"
components from the path of files it puts into the jar.  This is a
regression from fastjar and is also an incompatibility with jar.

Tom

classpath/ChangeLog.gcj:
2008-04-17  Tom Tromey  <tromey@redhat.com>

	PR libgcj/35950:
	* tools/gnu/classpath/tools/jar/Entry.java: New version from
	Classpath.
	* tools/classes/gnu/classpath/tools/jar/Entry.class: Update.

Index: classpath/tools/gnu/classpath/tools/jar/Entry.java
===================================================================
--- classpath/tools/gnu/classpath/tools/jar/Entry.java	(revision 134368)
+++ classpath/tools/gnu/classpath/tools/jar/Entry.java	(working copy)
@@ -1,5 +1,5 @@
 /* Entry.java - represent a single file to write to a jar
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
  This file is part of GNU Classpath.
 
@@ -49,12 +49,22 @@
   public Entry(File file, String name)
   {
     this.file = file;
-    this.name = name;
+
+    /* Removes any './' prefixes automatically. Those caused trouble
+     * in (boot) classpath use-cases. See #32516.
+     */
+    int start = 0;
+    while (name.length() > start + 2
+           && name.codePointAt(start) == '.'
+           && name.codePointAt(start + 1) == File.separatorChar)
+      start += 2;
+
+    this.name = name.substring(start);
   }
 
   public Entry(File file)
   {
-    this.file = file;
-    this.name = file.toString();
+    this(file, file.toString());
   }
+
 }

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

* Re: Patch: FYI: fix PR libgcj/35950
  2008-04-17 17:14 Patch: FYI: fix PR libgcj/35950 Tom Tromey
@ 2008-04-19  1:29 ` Andrew John Hughes
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew John Hughes @ 2008-04-19  1:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: GCJ-patches

On 17/04/2008, Tom Tromey <tromey@redhat.com> wrote:
> I'm checking this in on the trunk and the 4.3 branch.
>
>  This fixes PR 35950, aka PR 32516.  This makes gjar strip leading "./"
>  components from the path of files it puts into the jar.  This is a
>  regression from fastjar and is also an incompatibility with jar.
>
>  Tom
>
>  classpath/ChangeLog.gcj:
>  2008-04-17  Tom Tromey  <tromey@redhat.com>
>
>         PR libgcj/35950:
>         * tools/gnu/classpath/tools/jar/Entry.java: New version from
>         Classpath.
>         * tools/classes/gnu/classpath/tools/jar/Entry.class: Update.
>
>  Index: classpath/tools/gnu/classpath/tools/jar/Entry.java
>  ===================================================================
>  --- classpath/tools/gnu/classpath/tools/jar/Entry.java  (revision 134368)
>  +++ classpath/tools/gnu/classpath/tools/jar/Entry.java  (working copy)
>  @@ -1,5 +1,5 @@
>   /* Entry.java - represent a single file to write to a jar
>  - Copyright (C) 2006 Free Software Foundation, Inc.
>  + Copyright (C) 2006, 2007 Free Software Foundation, Inc.
>
>   This file is part of GNU Classpath.
>
>  @@ -49,12 +49,22 @@
>    public Entry(File file, String name)
>    {
>      this.file = file;
>  -    this.name = name;
>  +
>  +    /* Removes any './' prefixes automatically. Those caused trouble
>  +     * in (boot) classpath use-cases. See #32516.
>  +     */
>  +    int start = 0;
>  +    while (name.length() > start + 2
>  +           && name.codePointAt(start) == '.'
>  +           && name.codePointAt(start + 1) == File.separatorChar)
>  +      start += 2;
>  +
>  +    this.name = name.substring(start);
>    }
>
>    public Entry(File file)
>    {
>  -    this.file = file;
>  -    this.name = file.toString();
>  +    this(file, file.toString());
>    }
>  +
>   }
>

Thanks for tracking this down and fixing.  Much appreciated.
-- 
Andrew :-)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

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

end of thread, other threads:[~2008-04-19  1:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-17 17:14 Patch: FYI: fix PR libgcj/35950 Tom Tromey
2008-04-19  1:29 ` Andrew John Hughes

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).