1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Do not dereference symlinks when calculating size

Passing the "-L" flag to stat means we get the size of the file
being pointed to for symlinks instead of the size of the symlink.

Keep "-L" usage in repo-add as we want the actual size of the
package/delta/signature there.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2012-02-24 21:40:20 +10:00 committed by Dan McGee
parent ea7fc8962a
commit cb64fbeac4
2 changed files with 6 additions and 6 deletions

View File

@ -219,14 +219,14 @@ GCC_VISIBILITY_CC
GCC_GNU89_INLINE_CC
# Host-dependant definitions
SIZECMD="stat -L -c %s"
SIZECMD="stat -c %s"
SEDINPLACE="sed -i"
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
case "${host_os}" in
*bsd*)
SIZECMD="stat -L -f %z"
SIZECMD="stat -f %z"
SEDINPLACE="sed -i \"\""
;;
cygwin*)
@ -235,7 +235,7 @@ case "${host_os}" in
;;
darwin*)
host_os_darwin=yes
SIZECMD="/usr/bin/stat -L -f %z"
SIZECMD="/usr/bin/stat -f %z"
SEDINPLACE="/usr/bin/sed -i ''"
STRIP_BINARIES=""
STRIP_SHARED="-S"

View File

@ -144,7 +144,7 @@ db_write_delta() {
# get md5sum and compressed size of package
md5sum="$(openssl dgst -md5 "$deltafile")"
md5sum="${md5sum##* }"
csize=$(@SIZECMD@ "$deltafile")
csize=$(@SIZECMD@ -L "$deltafile")
oldfile=$(xdelta3 printhdr $deltafile | grep "XDELTA filename (source)" | sed 's/.*: *//')
newfile=$(xdelta3 printhdr $deltafile | grep "XDELTA filename (output)" | sed 's/.*: *//')
@ -294,7 +294,7 @@ db_write_entry() {
# compute base64'd PGP signature
if [[ -f "$pkgfile.sig" ]]; then
pgpsigsize=$(@SIZECMD@ "$pkgfile.sig")
pgpsigsize=$(@SIZECMD@ -L "$pkgfile.sig")
if (( pgpsigsize > 16384 )); then
error "$(gettext "Invalid package signature file '%s'.")" "$pkgfile.sig"
return 1
@ -303,7 +303,7 @@ db_write_entry() {
pgpsig=$(openssl base64 -in "$pkgfile.sig" | tr -d '\n')
fi
csize=$(@SIZECMD@ "$pkgfile")
csize=$(@SIZECMD@ -L "$pkgfile")
# compute checksums
msg2 "$(gettext "Computing checksums...")"