diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-07-30 21:24:48 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-08 21:28:10 +0200 |
commit | be3c71fa81e6d35a1fae0612a8b7b4b613d7d2f6 (patch) | |
tree | a5907bf32ccf54914ede5a355ea91137c760570e /makechrootpkg.in | |
parent | fb30cabe61862f640f0e99f214dc2777a8ec1b35 (diff) | |
download | devtools-be3c71fa81e6d35a1fae0612a8b7b4b613d7d2f6.tar.gz devtools-be3c71fa81e6d35a1fae0612a8b7b4b613d7d2f6.tar.xz |
avoid injecting code into the format string
Now that die() properly forwards arguments to error(), we can expect
that the first arg is a format string and not the entirety of the
output.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r-- | makechrootpkg.in | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in index d7d3ecf..1cd08fb 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -81,8 +81,8 @@ done # Canonicalize chrootdir, getting rid of trailing / chrootdir=$(readlink -e "$passeddir") -[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '$passeddir'" -[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot $chrootdir/root base-devel" +[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir" +[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir" # Detect chrootdir filesystem type chroottype=$(stat -f -c %T "$chrootdir") @@ -136,10 +136,10 @@ create_chroot() { if [[ "$chroottype" == btrfs ]]; then if [[ -d $copydir ]]; then btrfs subvolume delete "$copydir" >/dev/null || - die "Unable to delete subvolume $copydir" + die "Unable to delete subvolume %s" "$copydir" fi btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null || - die "Unable to create subvolume $copydir" + die "Unable to create subvolume %s" "$copydir" else mkdir -p "$copydir" rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir" @@ -155,11 +155,11 @@ clean_temporary() { stat_busy "Removing temporary copy [$copy]" if [[ "$chroottype" == btrfs ]]; then btrfs subvolume delete "$copydir" >/dev/null || - die "Unable to delete subvolume $copydir" + die "Unable to delete subvolume %s" "$copydir" else # avoid change of filesystem in case of an umount failure rm --recursive --force --one-file-system "$copydir" || - die "Unable to delete $copydir" + die "Unable to delete %s" "$copydir" fi # remove lock file @@ -362,7 +362,7 @@ if (( ret != 0 )); then if $temp_chroot; then die "Build failed" else - die "Build failed, check $copydir/build" + die "Build failed, check %s/build" "$copydir" fi else true |