This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFT/RFA] bashjar patch


Paolo Bonzini <paolo.bonzini@lu.unisi.ch> writes:

> +# Usage: copy SRC DEST
> +# Copy file SRC to directory DEST, which is the staging area of the jar file.
> +# Fail if it is already present or if it is not a regular file.
> +copy () {
> +  if test -f "$1"; then
> +    # A simple optimization.  Optimistically assuming that ln will work
> +    # cuts 60% of the run-time!
> +    if ln "$1" "$2"/"$1" > /dev/null 2>&1; then
> +      return 0
> +    fi
> +
> +    if test -e "$2"/"$1"; then
> +      error "$1": Duplicate entry.
> +    fi
> +    $mkdir_p "$2"/`dirname "$1"`

This lacks a pair of quotes around `dirname "$1"`.  Note that "`dirname
"$1"`" is not portable, but you can work around that by assigning the
output to a variable (which does not do word splitting) and using that
instead.

> +# Usage: make_manifest destfile kind [source-manifest]
> +# Create a manifest file and store it in destfile.  KIND can be "default",
> +# or "user", in which case SOURCE-MANIFEST must be specified as well.
> +make_manifest () {
> +  $mkdir_p `dirname "$1"`

Likewise.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]