other/9532: jar -C flag is incompatible with Sun's

Jim.Balter@cw.com Jim.Balter@cw.com
Sat Feb 1 04:36:00 GMT 2003


>Number:         9532
>Category:       other
>Synopsis:       jar -C flag is incompatible with Sun's
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 01 04:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jim Balter
>Release:        jar (fastjar) 0.92-gcc
>Organization:
>Environment:

>Description:
Sun's jar -C flag only affects the next argument,
and is documented as such at
http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/jar.html:
"Temporaily [sic] changes directories during execution of jar command while processing the next argument.  Its operation is intended to be similar to the -C option of the UNIX tar utility." (In the process of filing this,
I realized that GNU tar has the same bug, sigh.)

The jar that comes with gcc works differently;
-C affects all subsequent arguments (but the
wording from jar --help might mislead one into thinking otherwise:
-C DIR FILE     change to the specified directory and include the following file
).

The difference results in an incompatibility when
relative directories are used.  (I have an application
that generates a list of "-C directory file" strings
that breaks with GNU jar.)

>How-To-Repeat:
mkdir foo
echo > foo/bar
jar cf foo.jar -C foo bar -C foo bar

(The error message "Error adding -C to jar archive!"
suggests another bug).
>Fix:
a) use Sun's jar
b) use only absolute directories
c) change the semantics of GNU's jar -C to match Sun's
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list