Sam, just some notes.
I think this should have been done on the 1.3 branch, so that we have it right for the 1.3 release. I can merge it over if you like. Also, on 1.3 the index.html file no longer exists. I have already updated tar.html with the longfile attribute. Finally, you have made truncate work more like omit. When I read up on the GNU format, I am pretty sure it said that POSIX standard is to truncate the path but include the file in the archive. Do we want to have an omit AND truncate option. We should probably also only print the statement "Resulting tar file can only be processed successfully by GNU compatible tar commands" once per archive. -- Conor MacNeill [EMAIL PROTECTED] Cortex eBusiness http://www.cortexebusiness.com.au > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Sunday, 11 February 2001 2:13 > To: [EMAIL PROTECTED] > Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs > Tar.java > > > rubys 01/02/10 07:13:10 > > Modified: docs index.html > src/main/org/apache/tools/ant/taskdefs Tar.java > Log: > Add a warn on longfile mode > ---------------------------------------------------------------------- > > Revision Changes Path > 1.203 +9 -1 jakarta-ant/docs/index.html > > Index: index.html > =================================================================== > RCS file: /home/cvs/jakarta-ant/docs/index.html,v > retrieving revision 1.202 > retrieving revision 1.203 > diff -u -r1.202 -r1.203 > --- index.html 2001/02/04 13:08:52 1.202 > +++ index.html 2001/02/10 15:13:08 1.203 > @@ -34,7 +34,7 @@ > > <center> > <p>Version: @VERSION@<br> > -$Id: index.html,v 1.202 2001/02/04 13:08:52 nico Exp $</p> > +$Id: index.html,v 1.203 2001/02/10 15:13:08 rubys Exp $</p> > </center> > > <hr> > @@ -4952,6 +4952,14 @@ > <td valign="top">defaultexcludes</td> > <td valign="top">indicates whether default excludes should > be used or not > ("yes"/"no"). Default excludes are > used when omitted.</td> > + <td valign="top" align="center">No</td> > + </tr> > + <tr> > + <td valign="top">longfile</td> > + <td valign="top">One of <i>truncate</i>, <i>fail</i>, <i>warn</i>, > + <i>gnu</i>. Determines how long files (>100 chars) > are to be handled. > + Early versions did not support such names, and modern > versions do so in > + incompatible ways. Default is <i>warn</i>. > <td valign="top" align="center">No</td> > </tr> > </table> > > > > 1.11 +25 -12 > jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java > > Index: Tar.java > =================================================================== > RCS file: > /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v > retrieving revision 1.10 > retrieving revision 1.11 > diff -u -r1.10 -r1.11 > --- Tar.java 2001/02/04 13:58:16 1.10 > +++ Tar.java 2001/02/10 15:13:09 1.11 > @@ -70,13 +70,16 @@ > > public class Tar extends MatchingTask { > > + // permissable values for longfile attribute > + static public final String WARN = "warn"; > + static public final String FAIL = "fail"; > static public final String TRUNCATE = "truncate"; > static public final String GNU = "gnu"; > > File tarFile; > File baseDir; > > - String longFileMode = null; > + String longFileMode = WARN; > > Vector filesets = new Vector(); > Vector fileSetFiles = new Vector(); > @@ -107,10 +110,12 @@ > * > * Allowable values are > * truncate > + * fail > + * warn > * gnu > */ > - public void setLongfile(String method) { > - this.longFileMode = method; > + public void setLongfile(String mode) { > + this.longFileMode = mode; > } > > public void execute() throws BuildException { > @@ -156,15 +161,7 @@ > try { > tOut = new TarOutputStream(new FileOutputStream(tarFile)); > tOut.setDebug(true); > - if (longFileMode == null) { > - tOut.setLongFileMode(TarOutputStream.LONGFILE_ERROR); > - } > - else if (longFileMode.equalsIgnoreCase(TRUNCATE)) { > - > tOut.setLongFileMode(TarOutputStream.LONGFILE_TRUNCATE); > - } > - else if (longFileMode.equalsIgnoreCase(GNU)) { > - tOut.setLongFileMode(TarOutputStream.LONGFILE_GNU); > - } > + tOut.setLongFileMode(TarOutputStream.LONGFILE_GNU); > > for (Enumeration e = filesets.elements(); > e.hasMoreElements();) { > TarFileSet fs = (TarFileSet)e.nextElement(); > @@ -196,6 +193,22 @@ > FileInputStream fIn = new FileInputStream(file); > > try { > + if (vPath.length() >= TarConstants.NAMELEN) { > + if (longFileMode.equalsIgnoreCase(TRUNCATE)) { > + log("Skipping: "+ vPath, Project.MSG_INFO); > + return; > + } else if (longFileMode.equalsIgnoreCase(WARN)) { > + log("Entry: "+ vPath + " longer than " + > + TarConstants.NAMELEN + " characters.", > Project.MSG_WARN); > + log("Resulting tar file can only be > processed successfully" > + + " by GNU compatible tar commands", > Project.MSG_WARN); > + } else if (longFileMode.equalsIgnoreCase(FAIL)) { > + throw new BuildException( > + "Entry: "+ vPath + " longer than " + > + TarConstants.NAMELEN + "characters.", > location); > + } > + } > + > TarEntry te = new TarEntry(vPath); > te.setSize(file.length()); > te.setModTime(file.lastModified()); > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
