FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 02-24-2012, 02:59 PM
Dan McGee
 
Default Do not dereference symlinks when calculating size

On Fri, Feb 24, 2012 at 6:04 AM, Allan McRae <allan@archlinux.org> wrote:
> 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.
>
> Signed-off-by: Allan McRae <allan@archlinux.org>

NACK. You're reverting this commit. This is what we get for trying to
repurpose SIZECMD for use in makepkg, it looks like you need a second
command.

commit 20aa17c276c35e08c7a8e2aa20410b99a20f8129
Author: Dan McGee <dan@archlinux.org>
Date: Wed Sep 23 19:11:34 2009 -0500

repo-add: make sure we get size of target file

If the package we were adding was a symlink, we stuck the symlink size in
the database rather than the size of the file it referred to. Whoops!

Signed-off-by: Dan McGee <dan@archlinux.org>


> ---
> *configure.ac | * *6 +++---
> *1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index cfd3340..12a6e65 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -256,14 +256,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*)
> @@ -272,7 +272,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"
> --
> 1.7.9.2
>
>
 
Old 02-25-2012, 03:35 AM
Allan McRae
 
Default 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>
---

Version 2: Now with less repo-add breakage...

configure.ac | 6 +++---
scripts/repo-add.sh.in | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index cfd3340..12a6e65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -256,14 +256,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*)
@@ -272,7 +272,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"
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index b113bad..043a0b8 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -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 '
')
fi

- csize=$(@SIZECMD@ "$pkgfile")
+ csize=$(@SIZECMD@ -L "$pkgfile")

# compute checksums
msg2 "$(gettext "Computing checksums...")"
--
1.7.9.2
 

Thread Tools




All times are GMT. The time now is 04:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org